mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-29 07:50:27 +00:00
Add a way to search for byaml hashes in the Hashes folder
This commit is contained in:
parent
ea962c6201
commit
a6951ec000
4 changed files with 42 additions and 6 deletions
|
@ -13,6 +13,7 @@ using ByamlExt;
|
|||
using SharpYaml.Serialization;
|
||||
using SharpYaml;
|
||||
using Syroot.BinaryData;
|
||||
using Toolbox.Library.Security.Cryptography;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
|
@ -52,7 +53,41 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public static Dictionary<uint, string> Hashes = new Dictionary<uint, string>();
|
||||
private static new Dictionary<uint, string> hashes = new Dictionary<uint, string>();
|
||||
|
||||
public static Dictionary<uint, string> Hashes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Hashes.Count == 0)
|
||||
CreateHashList();
|
||||
return Hashes;
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateHashList()
|
||||
{
|
||||
string dir = Path.Combine(Runtime.ExecutableDir, "Hashes");
|
||||
if (!Directory.Exists(dir))
|
||||
return;
|
||||
|
||||
foreach (var file in Directory.GetFiles(dir))
|
||||
{
|
||||
if (Utils.GetExtension(file) != ".txt")
|
||||
continue;
|
||||
|
||||
foreach (string hashStr in File.ReadAllLines(file)) {
|
||||
CheckHash(hashStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckHash(string hashStr)
|
||||
{
|
||||
uint hash = Crc32.Compute(hashStr);
|
||||
if (!hashes.ContainsKey(hash))
|
||||
hashes.Add(hash, hashStr);
|
||||
}
|
||||
|
||||
#region Text Converter Interface
|
||||
public TextFileType TextFileType => TextFileType.Yaml;
|
||||
|
|
1
Toolbox/Hashes/ACNH.txt
Normal file
1
Toolbox/Hashes/ACNH.txt
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -1511,9 +1511,7 @@ namespace Toolbox
|
|||
path = Utils.RenameDuplicateString(batchExportFileList, path, 0, 3);
|
||||
batchExportFileList.Add(path);
|
||||
|
||||
path = $"{path}.{extension}";
|
||||
|
||||
DAE.Export(path, daesettings, model, textures, skeleton);
|
||||
DAE.Export($"{path}.{extension}", daesettings, model, textures, skeleton);
|
||||
}
|
||||
|
||||
fileFormat.Unload();
|
||||
|
@ -1528,9 +1526,8 @@ namespace Toolbox
|
|||
private void ExportTexture(STGenericTexture tex, string filePath, string ext) {
|
||||
filePath = Utils.RenameDuplicateString(batchExportFileList, filePath, 0, 3);
|
||||
batchExportFileList.Add(filePath);
|
||||
filePath = $"{filePath}.{ext}";
|
||||
|
||||
tex.Export(filePath);
|
||||
tex.Export($"{filePath}.{ext}");
|
||||
}
|
||||
|
||||
private void SearchArchive(BatchFormatExport.Settings settings, IArchiveFile archiveFile,
|
||||
|
|
|
@ -385,6 +385,9 @@
|
|||
<Content Include="Gl_EditorFramework.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hashes\ACNH.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Lib\aamp_hashed_names.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Reference in a new issue