Fix build after package update

This commit is contained in:
Matt Nadareski
2023-09-11 10:27:17 -04:00
parent ee84812918
commit 106c5e4cdd
6 changed files with 60 additions and 42 deletions

View File

@@ -78,7 +78,7 @@ namespace SabreTools.DatFiles.Formats
/// <param name="filename">Name of the file to be parsed</param>
/// <param name="indexId">Index ID for the DAT</param>
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
private void ConvertGames(Models.ClrMamePro.GameBase[]? games, string filename, int indexId, bool statsOnly)
private void ConvertGames(Models.ClrMamePro.GameBase?[]? games, string filename, int indexId, bool statsOnly)
{
// If the game array is missing, we can't do anything
if (games == null || !games.Any())
@@ -98,7 +98,7 @@ namespace SabreTools.DatFiles.Formats
/// <param name="filename">Name of the file to be parsed</param>
/// <param name="indexId">Index ID for the DAT</param>
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
private void ConvertGame(Models.ClrMamePro.GameBase game, string filename, int indexId, bool statsOnly)
private void ConvertGame(Models.ClrMamePro.GameBase? game, string filename, int indexId, bool statsOnly)
{
// If the game is missing, we can't do anything
if (game == null)

View File

@@ -23,25 +23,25 @@ namespace SabreTools.DatFiles.Formats
// Convert items
switch (_hash)
{
case Hash.CRC:
case Serialization.Hash.CRC:
ConvertSFV(hashfile?.SFV, filename, indexId, statsOnly);
break;
case Hash.MD5:
case Serialization.Hash.MD5:
ConvertMD5(hashfile?.MD5, filename, indexId, statsOnly);
break;
case Hash.SHA1:
case Serialization.Hash.SHA1:
ConvertSHA1(hashfile?.SHA1, filename, indexId, statsOnly);
break;
case Hash.SHA256:
case Serialization.Hash.SHA256:
ConvertSHA256(hashfile?.SHA256, filename, indexId, statsOnly);
break;
case Hash.SHA384:
case Serialization.Hash.SHA384:
ConvertSHA384(hashfile?.SHA384, filename, indexId, statsOnly);
break;
case Hash.SHA512:
case Serialization.Hash.SHA512:
ConvertSHA512(hashfile?.SHA512, filename, indexId, statsOnly);
break;
case Hash.SpamSum:
case Serialization.Hash.SpamSum:
ConvertSpamSum(hashfile?.SpamSum, filename, indexId, statsOnly);
break;
}

View File

@@ -36,7 +36,7 @@ namespace SabreTools.DatFiles.Formats
// Check hash linked to specific Hashfile type
switch (_hash)
{
case Hash.CRC:
case Serialization.Hash.CRC:
switch (datItem.ItemType)
{
case ItemType.Rom:
@@ -48,7 +48,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.MD5:
case Serialization.Hash.MD5:
switch (datItem.ItemType)
{
case ItemType.Disk:
@@ -68,7 +68,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.SHA1:
case Serialization.Hash.SHA1:
switch (datItem.ItemType)
{
case ItemType.Disk:
@@ -88,7 +88,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.SHA256:
case Serialization.Hash.SHA256:
switch (datItem.ItemType)
{
case ItemType.Media:
@@ -104,7 +104,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.SHA384:
case Serialization.Hash.SHA384:
switch (datItem.ItemType)
{
case ItemType.Rom:
@@ -116,7 +116,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.SHA512:
case Serialization.Hash.SHA512:
switch (datItem.ItemType)
{
case ItemType.Rom:
@@ -128,7 +128,7 @@ namespace SabreTools.DatFiles.Formats
break;
}
break;
case Hash.SpamSum:
case Serialization.Hash.SpamSum:
switch (datItem.ItemType)
{
case ItemType.Media:
@@ -185,25 +185,25 @@ namespace SabreTools.DatFiles.Formats
switch (_hash)
{
case Hash.CRC:
case Serialization.Hash.CRC:
hashfile.SFV = CreateSFV(ignoreblanks);
break;
case Hash.MD5:
case Serialization.Hash.MD5:
hashfile.MD5 = CreateMD5(ignoreblanks);
break;
case Hash.SHA1:
case Serialization.Hash.SHA1:
hashfile.SHA1 = CreateSHA1(ignoreblanks);
break;
case Hash.SHA256:
case Serialization.Hash.SHA256:
hashfile.SHA256 = CreateSHA256(ignoreblanks);
break;
case Hash.SHA384:
case Serialization.Hash.SHA384:
hashfile.SHA384 = CreateSHA384(ignoreblanks);
break;
case Hash.SHA512:
case Serialization.Hash.SHA512:
hashfile.SHA512 = CreateSHA512(ignoreblanks);
break;
case Hash.SpamSum:
case Serialization.Hash.SpamSum:
hashfile.SpamSum = CreateSpamSum(ignoreblanks);
break;
}

View File

@@ -8,7 +8,7 @@ namespace SabreTools.DatFiles.Formats
internal partial class Hashfile : DatFile
{
// Private instance variables specific to Hashfile DATs
private readonly Hash _hash;
private readonly Serialization.Hash _hash;
/// <summary>
/// Constructor designed for casting a base DatFile
@@ -18,7 +18,25 @@ namespace SabreTools.DatFiles.Formats
public Hashfile(DatFile? datFile, Hash hash)
: base(datFile)
{
_hash = hash;
_hash = ConvertHash(hash);
}
/// <summary>
/// Convert hash types between internal and Serialization
/// </summary>
private Serialization.Hash ConvertHash(Hash hash)
{
return hash switch
{
Hash.CRC => Serialization.Hash.CRC,
Hash.MD5 => Serialization.Hash.MD5,
Hash.SHA1 => Serialization.Hash.SHA1,
Hash.SHA256 => Serialization.Hash.SHA256,
Hash.SHA384 => Serialization.Hash.SHA384,
Hash.SHA512 => Serialization.Hash.SHA512,
Hash.SpamSum => Serialization.Hash.SpamSum,
_ => throw new System.ArgumentOutOfRangeException(),
};
}
}
}