Add DeviceReference type, cleanup TODOs

This commit is contained in:
Matt Nadareski
2020-08-31 23:01:51 -07:00
parent 22a73c318f
commit 3e9b4e510c
18 changed files with 629 additions and 442 deletions

View File

@@ -262,7 +262,7 @@ namespace SabreTools.Library.FileTypes
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
// Check if the name is the right length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
{
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
return false;
@@ -284,7 +284,7 @@ namespace SabreTools.Library.FileTypes
string datum = Path.GetFileName(this.Filename).ToLowerInvariant();
// Check if the name is the right length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz")) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
if (!Regex.IsMatch(datum, @"^[0-9a-f]{" + Constants.SHA1Length + @"}\.xz"))
{
Globals.Logger.Warning($"Non SHA-1 filename found, skipping: '{Path.GetFullPath(this.Filename)}'");
return null;
@@ -293,7 +293,7 @@ namespace SabreTools.Library.FileTypes
BaseFile baseFile = new BaseFile
{
Filename = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)), // TODO: When updating to SHA-256, this needs to update to SHA256
SHA1 = Utilities.StringToByteArray(Path.GetFileNameWithoutExtension(this.Filename)),
Parent = Path.GetFileNameWithoutExtension(this.Filename).ToLowerInvariant(),
};
@@ -357,7 +357,7 @@ namespace SabreTools.Library.FileTypes
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
// Get the output file name
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth));
outfile = outfile.Replace(".gz", ".xz");
// Check to see if the folder needs to be created