mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add GetKeyDB tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user