This commit is contained in:
Perfare 2018-08-30 21:34:41 +08:00
parent 2fd2b71148
commit 10f02af70b
2 changed files with 10 additions and 12 deletions

View File

@ -2,7 +2,6 @@
using System.IO;
using System.Linq;
using Lz4;
using SevenZip.Compression.LZMA;
namespace AssetStudio
{
@ -229,7 +228,7 @@ namespace AssetStudio
file.stream = memoryMappedFile.CreateViewStream();*/
var extractPath = path + "_unpacked\\";
Directory.CreateDirectory(extractPath);
file.stream = new FileStream(extractPath + file.fileName, FileMode.Create);
file.stream = File.Create(extractPath + file.fileName);
}
else
{

View File

@ -12,6 +12,13 @@ namespace AssetStudio
public static byte[] GetData(string path, string sourceFilePath, long offset, int size)
{
var resourceFileName = Path.GetFileName(path);
if (Studio.resourceFileReaders.TryGetValue(resourceFileName.ToUpper(), out var reader))
{
reader.Position = offset;
return reader.ReadBytes(size);
}
var resourceFilePath = Path.GetDirectoryName(sourceFilePath) + "\\" + resourceFileName;
if (!File.Exists(resourceFilePath))
{
@ -31,16 +38,8 @@ namespace AssetStudio
}
else
{
if (Studio.resourceFileReaders.TryGetValue(resourceFileName.ToUpper(), out var resourceReader))
{
resourceReader.Position = offset;
return resourceReader.ReadBytes(size);
}
else
{
MessageBox.Show($"can't find the resource file {resourceFileName}");
return null;
}
MessageBox.Show($"can't find the resource file {resourceFileName}");
return null;
}
}
}