mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
minor fixes
This commit is contained in:
parent
0a764c74d6
commit
19534ebb4d
@ -186,6 +186,7 @@ namespace AssetStudio
|
||||
|
||||
public void SetVersion(string stringVersion)
|
||||
{
|
||||
unityVersion = stringVersion;
|
||||
var buildSplit = Regex.Replace(stringVersion, @"\d", "").Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries);
|
||||
buildType = new BuildType(buildSplit[0]);
|
||||
var versionSplit = Regex.Replace(stringVersion, @"\D", ".").Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
@ -148,9 +148,11 @@ namespace AssetStudioGUI
|
||||
treeNodeCollection = BuildTreeStructure(tempDic);
|
||||
}
|
||||
tempDic.Clear();
|
||||
|
||||
Dictionary<string, SortedDictionary<int, TypeTreeItem>> typeMap = null;
|
||||
if (buildClassStructuresMenuItem.Checked)
|
||||
{
|
||||
BuildClassStructure();
|
||||
typeMap = BuildClassStructure();
|
||||
}
|
||||
|
||||
BeginInvoke(new Action(() =>
|
||||
@ -182,7 +184,7 @@ namespace AssetStudioGUI
|
||||
if (buildClassStructuresMenuItem.Checked)
|
||||
{
|
||||
classesListView.BeginUpdate();
|
||||
foreach (var version in AllTypeMap)
|
||||
foreach (var version in typeMap)
|
||||
{
|
||||
var versionGroup = new ListViewGroup(version.Key);
|
||||
classesListView.Groups.Add(versionGroup);
|
||||
@ -193,6 +195,7 @@ namespace AssetStudioGUI
|
||||
classesListView.Items.Add(uclass.Value);
|
||||
}
|
||||
}
|
||||
typeMap.Clear();
|
||||
classesListView.EndUpdate();
|
||||
}
|
||||
|
||||
@ -299,31 +302,22 @@ namespace AssetStudioGUI
|
||||
|
||||
private void exportClassStructuresMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AllTypeMap.Count > 0)
|
||||
if (classesListView.Items.Count > 0)
|
||||
{
|
||||
var saveFolderDialog = new OpenFolderDialog();
|
||||
if (saveFolderDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
var count = AllTypeMap.Count;
|
||||
var savePath = saveFolderDialog.Folder;
|
||||
var count = classesListView.Items.Count;
|
||||
int i = 0;
|
||||
Progress.Reset();
|
||||
foreach (var version in AllTypeMap)
|
||||
foreach (TypeTreeItem item in classesListView.Items)
|
||||
{
|
||||
var savePath = saveFolderDialog.Folder;
|
||||
if (version.Value.Count > 0)
|
||||
{
|
||||
string versionPath = savePath + "\\" + version.Key;
|
||||
Directory.CreateDirectory(versionPath);
|
||||
var versionPath = savePath + "\\" + item.Group.Header;
|
||||
Directory.CreateDirectory(versionPath);
|
||||
|
||||
foreach (var uclass in version.Value)
|
||||
{
|
||||
string saveFile = $"{versionPath}\\{uclass.Key} {uclass.Value.Text}.txt";
|
||||
using (var writer = new StreamWriter(saveFile))
|
||||
{
|
||||
writer.Write(uclass.Value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
var saveFile = $"{versionPath}\\{item.SubItems[1].Text} {item.Text}.txt";
|
||||
File.WriteAllText(saveFile, item.ToString());
|
||||
|
||||
Progress.Report(++i, count);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ namespace AssetStudioGUI
|
||||
public static AssetsManager assetsManager = new AssetsManager();
|
||||
public static List<AssetItem> exportableAssets = new List<AssetItem>();
|
||||
public static List<AssetItem> visibleAssets = new List<AssetItem>();
|
||||
public static Dictionary<string, SortedDictionary<int, TypeTreeItem>> AllTypeMap = new Dictionary<string, SortedDictionary<int, TypeTreeItem>>(); //TODO Delete it
|
||||
public static bool ModuleLoaded;
|
||||
public static Dictionary<string, ModuleDef> LoadedModuleDic = new Dictionary<string, ModuleDef>();
|
||||
|
||||
@ -38,7 +37,7 @@ namespace AssetStudioGUI
|
||||
extractedCount += ExtractWebDataFile(fileName, reader);
|
||||
else
|
||||
reader.Dispose();
|
||||
Progress.Report(i + 1, fileName.Length);
|
||||
Progress.Report(++i, fileNames.Length);
|
||||
}
|
||||
|
||||
Logger.Info($"Finished extracting {extractedCount} files.");
|
||||
@ -53,7 +52,6 @@ namespace AssetStudioGUI
|
||||
if (bundleFile.fileList.Count > 0)
|
||||
{
|
||||
var extractPath = bundleFileName + "_unpacked\\";
|
||||
Directory.CreateDirectory(extractPath);
|
||||
return ExtractStreamFile(extractPath, bundleFile.fileList);
|
||||
}
|
||||
return 0;
|
||||
@ -67,7 +65,6 @@ namespace AssetStudioGUI
|
||||
if (webFile.fileList.Count > 0)
|
||||
{
|
||||
var extractPath = webFileName + "_unpacked\\";
|
||||
Directory.CreateDirectory(extractPath);
|
||||
return ExtractStreamFile(extractPath, webFile.fileList);
|
||||
}
|
||||
return 0;
|
||||
@ -300,11 +297,12 @@ namespace AssetStudioGUI
|
||||
return treeNodeCollection;
|
||||
}
|
||||
|
||||
public static void BuildClassStructure()
|
||||
public static Dictionary<string, SortedDictionary<int, TypeTreeItem>> BuildClassStructure()
|
||||
{
|
||||
var typeMap = new Dictionary<string, SortedDictionary<int, TypeTreeItem>>();
|
||||
foreach (var assetsFile in assetsManager.assetsFileList)
|
||||
{
|
||||
if (AllTypeMap.TryGetValue(assetsFile.unityVersion, out var curVer))
|
||||
if (typeMap.TryGetValue(assetsFile.unityVersion, out var curVer))
|
||||
{
|
||||
foreach (var type in assetsFile.m_Types.Where(x => x.m_Nodes != null))
|
||||
{
|
||||
@ -328,9 +326,11 @@ namespace AssetStudioGUI
|
||||
}
|
||||
items.Add(key, new TypeTreeItem(key, type.m_Nodes));
|
||||
}
|
||||
AllTypeMap.Add(assetsFile.unityVersion, items);
|
||||
typeMap.Add(assetsFile.unityVersion, items);
|
||||
}
|
||||
}
|
||||
|
||||
return typeMap;
|
||||
}
|
||||
|
||||
public static string FixFileName(string str)
|
||||
|
Loading…
Reference in New Issue
Block a user