BucketedBy superseded by Field

This commit is contained in:
Matt Nadareski
2020-08-22 23:02:30 -07:00
parent d4be402380
commit dc448a5008
8 changed files with 76 additions and 95 deletions

View File

@@ -897,11 +897,12 @@ namespace SabreTools.Library.DatItems
/// <summary>
/// Get the dictionary key that should be used for a given item and bucketing type
/// </summary>
/// <param name="bucketedBy">BucketedBy enum representing what key to get</param>
/// <param name="bucketedBy">Field value representing what key to get</param>
/// <param name="lower">True if the key should be lowercased (default), false otherwise</param>
/// <param name="norename">True if games should only be compared on game and file name, false if system and source are counted</param>
/// <returns>String representing the key to be used for the DatItem</returns>
public virtual string GetKey(BucketedBy bucketedBy, bool lower = true, bool norename = true)
/// TODO: What other fields can we reasonably allow bucketing on?
public virtual string GetKey(Field bucketedBy, bool lower = true, bool norename = true)
{
// Set the output key as the default blank string
string key = string.Empty;
@@ -909,11 +910,11 @@ namespace SabreTools.Library.DatItems
// Now determine what the key should be based on the bucketedBy value
switch (bucketedBy)
{
case BucketedBy.CRC:
case Field.CRC:
key = Constants.CRCZero;
break;
case BucketedBy.Game:
case Field.MachineName:
key = (norename ? string.Empty
: Source.Index.ToString().PadLeft(10, '0')
+ "-")
@@ -929,29 +930,29 @@ namespace SabreTools.Library.DatItems
key = WebUtility.HtmlEncode(key);
break;
case BucketedBy.MD5:
case Field.MD5:
key = Constants.MD5Zero;
break;
#if NET_FRAMEWORK
case BucketedBy.RIPEMD160:
case Field.RIPEMD160:
key = Constants.RIPEMD160Zero;
break;
#endif
case BucketedBy.SHA1:
case Field.SHA1:
key = Constants.SHA1Zero;
break;
case BucketedBy.SHA256:
case Field.SHA256:
key = Constants.SHA256Zero;
break;
case BucketedBy.SHA384:
case Field.SHA384:
key = Constants.SHA384Zero;
break;
case BucketedBy.SHA512:
case Field.SHA512:
key = Constants.SHA512Zero;
break;
}