Merge pull request #289 from McSpazzy/bcsv-hash
Hash support for BCSV headers
This commit is contained in:
commit
604f7b3d36
@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Toolbox.Library;
|
||||
using Toolbox.Library.IO;
|
||||
using Toolbox.Library.Security.Cryptography;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
@ -27,8 +30,8 @@ namespace FirstPlugin
|
||||
{
|
||||
get
|
||||
{
|
||||
// if (hashes.Count == 0)
|
||||
//CalculateHashes();
|
||||
if (hashes.Count == 0)
|
||||
CalculateHashes();
|
||||
return hashes;
|
||||
}
|
||||
}
|
||||
@ -137,7 +140,27 @@ namespace FirstPlugin
|
||||
|
||||
private static void CalculateHashes()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38988
Toolbox/Hashes/ACNH.txt
38988
Toolbox/Hashes/ACNH.txt
File diff suppressed because one or more lines are too long
2917
Toolbox/Hashes/ACNHBYML.txt
Normal file
2917
Toolbox/Hashes/ACNHBYML.txt
Normal file
File diff suppressed because it is too large
Load Diff
1509
Toolbox/Hashes/ACNHHeaders.txt
Normal file
1509
Toolbox/Hashes/ACNHHeaders.txt
Normal file
File diff suppressed because it is too large
Load Diff
34335
Toolbox/Hashes/ACNHValues.txt
Normal file
34335
Toolbox/Hashes/ACNHValues.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -397,7 +397,13 @@
|
||||
<Content Include="Gl_EditorFramework.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hashes\ACNH.txt">
|
||||
<Content Include="Hashes\ACNHBYML.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hashes\ACNHHeaders.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Hashes\ACNHValues.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Lib\aamp_hashed_names.txt">
|
||||
|
Loading…
Reference in New Issue
Block a user