Add GetKeyDB tests

This commit is contained in:
Matt Nadareski
2025-01-08 13:32:09 -05:00
parent 0e034a332b
commit 19efc30c44
6 changed files with 279 additions and 5 deletions

View File

@@ -141,6 +141,36 @@ namespace SabreTools.DatItems.Formats
return key;
}
/// <inheritdoc/>
public override string GetKeyDB(ItemKey bucketedBy, Source? source, bool lower = true, bool norename = true)
{
// Set the output key as the default blank string
string? key;
// Now determine what the key should be based on the bucketedBy value
switch (bucketedBy)
{
case ItemKey.MD5:
key = GetStringFieldValue(Models.Metadata.Disk.MD5Key);
break;
case ItemKey.SHA1:
key = GetStringFieldValue(Models.Metadata.Disk.SHA1Key);
break;
// Let the base handle generic stuff
default:
return base.GetKeyDB(bucketedBy, source, lower, norename);
}
// Double and triple check the key for corner cases
key ??= string.Empty;
if (lower)
key = key.ToLowerInvariant();
return key;
}
#endregion
}
}