mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-06-03 00:58:13 -04:00
Fixed #256
This commit is contained in:
parent
2fd2b71148
commit
10f02af70b
@ -2,7 +2,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Lz4;
|
using Lz4;
|
||||||
using SevenZip.Compression.LZMA;
|
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
@ -229,7 +228,7 @@ namespace AssetStudio
|
|||||||
file.stream = memoryMappedFile.CreateViewStream();*/
|
file.stream = memoryMappedFile.CreateViewStream();*/
|
||||||
var extractPath = path + "_unpacked\\";
|
var extractPath = path + "_unpacked\\";
|
||||||
Directory.CreateDirectory(extractPath);
|
Directory.CreateDirectory(extractPath);
|
||||||
file.stream = new FileStream(extractPath + file.fileName, FileMode.Create);
|
file.stream = File.Create(extractPath + file.fileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,13 @@ namespace AssetStudio
|
|||||||
public static byte[] GetData(string path, string sourceFilePath, long offset, int size)
|
public static byte[] GetData(string path, string sourceFilePath, long offset, int size)
|
||||||
{
|
{
|
||||||
var resourceFileName = Path.GetFileName(path);
|
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;
|
var resourceFilePath = Path.GetDirectoryName(sourceFilePath) + "\\" + resourceFileName;
|
||||||
if (!File.Exists(resourceFilePath))
|
if (!File.Exists(resourceFilePath))
|
||||||
{
|
{
|
||||||
@ -30,18 +37,10 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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}");
|
MessageBox.Show($"can't find the resource file {resourceFileName}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user