mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
keep path when extracting folder
This commit is contained in:
parent
422851cdab
commit
7596dcc7cd
@ -29,8 +29,18 @@ namespace AssetStudioGUI
|
|||||||
|
|
||||||
public static int ExtractFolder(string path, string savePath)
|
public static int ExtractFolder(string path, string savePath)
|
||||||
{
|
{
|
||||||
|
int extractedCount = 0;
|
||||||
|
Progress.Reset();
|
||||||
var files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
|
var files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
|
||||||
return ExtractFile(files, savePath);
|
for (int i = 0; i < files.Length; i++)
|
||||||
|
{
|
||||||
|
var file = files[i];
|
||||||
|
var fileOriPath = Path.GetDirectoryName(file);
|
||||||
|
var fileSavePath = fileOriPath.Replace(path, savePath);
|
||||||
|
extractedCount += ExtractFile(file, fileSavePath);
|
||||||
|
Progress.Report(i + 1, files.Length);
|
||||||
|
}
|
||||||
|
return extractedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ExtractFile(string[] fileNames, string savePath)
|
public static int ExtractFile(string[] fileNames, string savePath)
|
||||||
@ -40,18 +50,25 @@ namespace AssetStudioGUI
|
|||||||
for (var i = 0; i < fileNames.Length; i++)
|
for (var i = 0; i < fileNames.Length; i++)
|
||||||
{
|
{
|
||||||
var fileName = fileNames[i];
|
var fileName = fileNames[i];
|
||||||
var type = ImportHelper.CheckFileType(fileName, out var reader);
|
extractedCount += ExtractFile(fileName, savePath);
|
||||||
if (type == FileType.BundleFile)
|
|
||||||
extractedCount += ExtractBundleFile(fileName, reader, savePath);
|
|
||||||
else if (type == FileType.WebFile)
|
|
||||||
extractedCount += ExtractWebDataFile(fileName, reader, savePath);
|
|
||||||
else
|
|
||||||
reader.Dispose();
|
|
||||||
Progress.Report(i + 1, fileNames.Length);
|
Progress.Report(i + 1, fileNames.Length);
|
||||||
}
|
}
|
||||||
return extractedCount;
|
return extractedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int ExtractFile(string fileName, string savePath)
|
||||||
|
{
|
||||||
|
int extractedCount = 0;
|
||||||
|
var type = ImportHelper.CheckFileType(fileName, out var reader);
|
||||||
|
if (type == FileType.BundleFile)
|
||||||
|
extractedCount += ExtractBundleFile(fileName, reader, savePath);
|
||||||
|
else if (type == FileType.WebFile)
|
||||||
|
extractedCount += ExtractWebDataFile(fileName, reader, savePath);
|
||||||
|
else
|
||||||
|
reader.Dispose();
|
||||||
|
return extractedCount;
|
||||||
|
}
|
||||||
|
|
||||||
private static int ExtractBundleFile(string bundleFilePath, EndianBinaryReader reader, string savePath)
|
private static int ExtractBundleFile(string bundleFilePath, EndianBinaryReader reader, string savePath)
|
||||||
{
|
{
|
||||||
StatusStripUpdate($"Decompressing {Path.GetFileName(bundleFilePath)} ...");
|
StatusStripUpdate($"Decompressing {Path.GetFileName(bundleFilePath)} ...");
|
||||||
|
Loading…
Reference in New Issue
Block a user