mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Simplify GetKey implementations for DatItem
This commit is contained in:
@@ -296,7 +296,7 @@ namespace SabreTools.DatItems.Formats
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GetKey(ItemKey bucketedBy, bool lower = true, bool norename = true)
|
||||
public override string GetKey(ItemKey bucketedBy, Machine? machine, Source? source, bool lower = true, bool norename = true)
|
||||
{
|
||||
// Set the output key as the default blank string
|
||||
string? key;
|
||||
@@ -322,45 +322,7 @@ namespace SabreTools.DatItems.Formats
|
||||
|
||||
// Let the base handle generic stuff
|
||||
default:
|
||||
return base.GetKey(bucketedBy, lower, norename);
|
||||
}
|
||||
|
||||
// Double and triple check the key for corner cases
|
||||
key ??= string.Empty;
|
||||
if (lower)
|
||||
key = key.ToLowerInvariant();
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GetKeyDB(ItemKey bucketedBy, Machine? machine, 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.CRC:
|
||||
key = CRC;
|
||||
break;
|
||||
|
||||
case ItemKey.MD5:
|
||||
key = MD5;
|
||||
break;
|
||||
|
||||
case ItemKey.SHA1:
|
||||
key = SHA1;
|
||||
break;
|
||||
|
||||
case ItemKey.SHA256:
|
||||
key = SHA256;
|
||||
break;
|
||||
|
||||
// Let the base handle generic stuff
|
||||
default:
|
||||
return base.GetKeyDB(bucketedBy, machine, source, lower, norename);
|
||||
return base.GetKey(bucketedBy, machine, source, lower, norename);
|
||||
}
|
||||
|
||||
// Double and triple check the key for corner cases
|
||||
|
||||
Reference in New Issue
Block a user