mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move GetDuplicateSuffix to where it's used
This commit is contained in:
@@ -929,110 +929,5 @@ namespace SabreTools.Core
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Suffix Generation
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
public static string GetDuplicateSuffix(this DictionaryBase? self)
|
||||
{
|
||||
if (self == null)
|
||||
return string.Empty;
|
||||
|
||||
return self switch
|
||||
{
|
||||
Disk diskSelf => diskSelf.GetDuplicateSuffix(),
|
||||
Media mediaSelf => mediaSelf.GetDuplicateSuffix(),
|
||||
Rom romSelf => romSelf.GetDuplicateSuffix(),
|
||||
_ => "_1",
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
private static string GetDuplicateSuffix(this Disk self)
|
||||
{
|
||||
string? md5 = self.ReadString(Disk.MD5Key);
|
||||
if (!string.IsNullOrEmpty(md5))
|
||||
return $"_{md5}";
|
||||
|
||||
string? sha1 = self.ReadString(Disk.SHA1Key);
|
||||
if (!string.IsNullOrEmpty(sha1))
|
||||
return $"_{sha1}";
|
||||
|
||||
return "_1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
private static string GetDuplicateSuffix(this Media self)
|
||||
{
|
||||
string? md5 = self.ReadString(Media.MD5Key);
|
||||
if (!string.IsNullOrEmpty(md5))
|
||||
return $"_{md5}";
|
||||
|
||||
string? sha1 = self.ReadString(Media.SHA1Key);
|
||||
if (!string.IsNullOrEmpty(sha1))
|
||||
return $"_{sha1}";
|
||||
|
||||
string? sha256 = self.ReadString(Media.SHA256Key);
|
||||
if (!string.IsNullOrEmpty(sha256))
|
||||
return $"_{sha256}";
|
||||
|
||||
string? spamSum = self.ReadString(Media.SpamSumKey);
|
||||
if (!string.IsNullOrEmpty(spamSum))
|
||||
return $"_{spamSum}";
|
||||
|
||||
return "_1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
private static string GetDuplicateSuffix(this Rom self)
|
||||
{
|
||||
string? crc = self.ReadString(Rom.CRCKey);
|
||||
if (!string.IsNullOrEmpty(crc))
|
||||
return $"_{crc}";
|
||||
|
||||
string? md2 = self.ReadString(Rom.MD2Key);
|
||||
if (!string.IsNullOrEmpty(md2))
|
||||
return $"_{md2}";
|
||||
|
||||
string? md4 = self.ReadString(Rom.MD4Key);
|
||||
if (!string.IsNullOrEmpty(md4))
|
||||
return $"_{md4}";
|
||||
|
||||
string? md5 = self.ReadString(Rom.MD5Key);
|
||||
if (!string.IsNullOrEmpty(md5))
|
||||
return $"_{md5}";
|
||||
|
||||
string? sha1 = self.ReadString(Rom.SHA1Key);
|
||||
if (!string.IsNullOrEmpty(sha1))
|
||||
return $"_{sha1}";
|
||||
|
||||
string? sha256 = self.ReadString(Rom.SHA256Key);
|
||||
if (!string.IsNullOrEmpty(sha256))
|
||||
return $"_{sha256}";
|
||||
|
||||
string? sha384 = self.ReadString(Rom.SHA384Key);
|
||||
if (!string.IsNullOrEmpty(sha384))
|
||||
return $"_{sha384}";
|
||||
|
||||
string? sha512 = self.ReadString(Rom.SHA512Key);
|
||||
if (!string.IsNullOrEmpty(sha512))
|
||||
return $"_{sha512}";
|
||||
|
||||
string? spamSum = self.ReadString(Rom.SpamSumKey);
|
||||
if (!string.IsNullOrEmpty(spamSum))
|
||||
return $"_{spamSum}";
|
||||
|
||||
return "_1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user