Add a way to search for byaml hashes in the Hashes folder
This commit is contained in:
parent
ea962c6201
commit
a6951ec000
@ -13,6 +13,7 @@ using ByamlExt;
|
|||||||
using SharpYaml.Serialization;
|
using SharpYaml.Serialization;
|
||||||
using SharpYaml;
|
using SharpYaml;
|
||||||
using Syroot.BinaryData;
|
using Syroot.BinaryData;
|
||||||
|
using Toolbox.Library.Security.Cryptography;
|
||||||
|
|
||||||
namespace FirstPlugin
|
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
|
#region Text Converter Interface
|
||||||
public TextFileType TextFileType => TextFileType.Yaml;
|
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);
|
path = Utils.RenameDuplicateString(batchExportFileList, path, 0, 3);
|
||||||
batchExportFileList.Add(path);
|
batchExportFileList.Add(path);
|
||||||
|
|
||||||
path = $"{path}.{extension}";
|
DAE.Export($"{path}.{extension}", daesettings, model, textures, skeleton);
|
||||||
|
|
||||||
DAE.Export(path, daesettings, model, textures, skeleton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileFormat.Unload();
|
fileFormat.Unload();
|
||||||
@ -1528,9 +1526,8 @@ namespace Toolbox
|
|||||||
private void ExportTexture(STGenericTexture tex, string filePath, string ext) {
|
private void ExportTexture(STGenericTexture tex, string filePath, string ext) {
|
||||||
filePath = Utils.RenameDuplicateString(batchExportFileList, filePath, 0, 3);
|
filePath = Utils.RenameDuplicateString(batchExportFileList, filePath, 0, 3);
|
||||||
batchExportFileList.Add(filePath);
|
batchExportFileList.Add(filePath);
|
||||||
filePath = $"{filePath}.{ext}";
|
|
||||||
|
|
||||||
tex.Export(filePath);
|
tex.Export($"{filePath}.{ext}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchArchive(BatchFormatExport.Settings settings, IArchiveFile archiveFile,
|
private void SearchArchive(BatchFormatExport.Settings settings, IArchiveFile archiveFile,
|
||||||
|
@ -385,6 +385,9 @@
|
|||||||
<Content Include="Gl_EditorFramework.dll">
|
<Content Include="Gl_EditorFramework.dll">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Hashes\ACNH.txt">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Lib\aamp_hashed_names.txt">
|
<Content Include="Lib\aamp_hashed_names.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user