diff --git a/SabreTools.Core.Test/DictionaryBaseExtensionsTests.cs b/SabreTools.Core.Test/DictionaryBaseExtensionsTests.cs
index bd476d0b..1e20b000 100644
--- a/SabreTools.Core.Test/DictionaryBaseExtensionsTests.cs
+++ b/SabreTools.Core.Test/DictionaryBaseExtensionsTests.cs
@@ -1988,176 +1988,5 @@ namespace SabreTools.Core.Test
}
#endregion
-
- #region GetDuplicateSuffix
-
- [Fact]
- public void GetDuplicateSuffix_Disk_NoHash_Generic()
- {
- DictionaryBase self = new Disk();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Disk_MD5()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Disk { [Disk.MD5Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Disk_SHA1()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Disk { [Disk.SHA1Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Media_NoHash_Generic()
- {
- DictionaryBase self = new Media();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Media_MD5()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Media { [Media.MD5Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Media_SHA1()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Media { [Media.SHA1Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Media_SHA256()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Media { [Media.SHA256Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Media_SpamSum()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Media { [Media.SpamSumKey] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_NoHash_Generic()
- {
- DictionaryBase self = new Rom();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_CRC()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.CRCKey] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_MD2()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.MD2Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_MD4()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.MD4Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_MD5()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.MD5Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_SHA1()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.SHA1Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_SHA256()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.SHA256Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_SHA384()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.SHA384Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_SHA512()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.SHA512Key] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Rom_SpamSum()
- {
- string hash = "XXXXXX";
- DictionaryBase self = new Rom { [Rom.SpamSumKey] = hash };
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Other_Generic()
- {
- DictionaryBase self = new Sample();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- #endregion
}
}
\ No newline at end of file
diff --git a/SabreTools.Core/DictionaryBaseExtensions.cs b/SabreTools.Core/DictionaryBaseExtensions.cs
index 7af53f6a..01625f5f 100644
--- a/SabreTools.Core/DictionaryBaseExtensions.cs
+++ b/SabreTools.Core/DictionaryBaseExtensions.cs
@@ -929,110 +929,5 @@ namespace SabreTools.Core
}
#endregion
-
- #region Suffix Generation
-
- ///
- /// Get unique duplicate suffix on name collision
- ///
- 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",
- };
- }
-
- ///
- /// Get unique duplicate suffix on name collision
- ///
- 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";
- }
-
- ///
- /// Get unique duplicate suffix on name collision
- ///
- 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";
- }
-
- ///
- /// Get unique duplicate suffix on name collision
- ///
- 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
}
}
\ No newline at end of file
diff --git a/SabreTools.DatFiles.Test/DatFileTests.cs b/SabreTools.DatFiles.Test/DatFileTests.cs
index 61e1e675..a595f064 100644
--- a/SabreTools.DatFiles.Test/DatFileTests.cs
+++ b/SabreTools.DatFiles.Test/DatFileTests.cs
@@ -1616,6 +1616,255 @@ namespace SabreTools.DatFiles.Test
#endregion
+ #region GetDuplicateSuffix
+
+ [Fact]
+ public void GetDuplicateSuffix_Disk_NoHash_Generic()
+ {
+ DatItem datItem = new Disk();
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal("_1", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Disk_MD5()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Disk();
+ datItem.SetFieldValue(Models.Metadata.Disk.MD5Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Disk_SHA1()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Disk();
+ datItem.SetFieldValue(Models.Metadata.Disk.SHA1Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_File_NoHash_Generic()
+ {
+ DatItem datItem = new DatItems.Formats.File();
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal("_1", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_File_CRC()
+ {
+ string hash = "deadbeef";
+ DatItems.Formats.File datItem = new DatItems.Formats.File { CRC = hash };
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_File_MD5()
+ {
+ string hash = "000000000000000000000000deadbeef";
+ DatItem datItem = new DatItems.Formats.File { MD5 = hash };
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_File_SHA1()
+ {
+ string hash = "00000000000000000000000000000000deadbeef";
+ DatItem datItem = new DatItems.Formats.File { SHA1 = hash };
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_File_SHA256()
+ {
+ string hash = "00000000000000000000000000000000000000000000000000000000deadbeef";
+ DatItem datItem = new DatItems.Formats.File { SHA256 = hash };
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Media_NoHash_Generic()
+ {
+ DatItem datItem = new Media();
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal("_1", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Media_MD5()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Media();
+ datItem.SetFieldValue(Models.Metadata.Media.MD5Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Media_SHA1()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Media();
+ datItem.SetFieldValue(Models.Metadata.Media.SHA1Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Media_SHA256()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Media();
+ datItem.SetFieldValue(Models.Metadata.Media.SHA256Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Media_SpamSum()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Media();
+ datItem.SetFieldValue(Models.Metadata.Media.SpamSumKey, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_NoHash_Generic()
+ {
+ DatItem datItem = new Rom();
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal("_1", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_CRC()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.CRCKey, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_MD2()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.MD2Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_MD4()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.MD4Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_MD5()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.MD5Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_SHA1()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.SHA1Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_SHA256()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.SHA256Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_SHA384()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.SHA384Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_SHA512()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.SHA512Key, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Rom_SpamSum()
+ {
+ string hash = "XXXXXX";
+ DatItem datItem = new Rom();
+ datItem.SetFieldValue(Models.Metadata.Rom.SpamSumKey, hash);
+
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal($"_{hash}", actual);
+ }
+
+ [Fact]
+ public void GetDuplicateSuffix_Other_Generic()
+ {
+ DatItem datItem = new Sample();
+ string actual = DatFile.GetDuplicateSuffix(datItem);
+ Assert.Equal("_1", actual);
+ }
+
+ #endregion
+
#region ResolveNames
[Fact]
diff --git a/SabreTools.DatFiles/DatFile.cs b/SabreTools.DatFiles/DatFile.cs
index 7625de92..88599c8a 100644
--- a/SabreTools.DatFiles/DatFile.cs
+++ b/SabreTools.DatFiles/DatFile.cs
@@ -721,6 +721,22 @@ namespace SabreTools.DatFiles
return false;
}
+ ///
+ /// Get unique duplicate suffix on name collision
+ ///
+ /// String representing the suffix
+ protected static internal string GetDuplicateSuffix(DatItem datItem)
+ {
+ return datItem switch
+ {
+ Disk diskItem => GetDuplicateSuffix(diskItem),
+ DatItems.Formats.File fileItem => GetDuplicateSuffix(fileItem),
+ Media mediaItem => GetDuplicateSuffix(mediaItem),
+ Rom romItem => GetDuplicateSuffix(romItem),
+ _ => "_1",
+ };
+ }
+
///
/// Resolve name duplicates in an arbitrary set of DatItems based on the supplied information
///
@@ -781,7 +797,7 @@ namespace SabreTools.DatFiles
_logger.Verbose($"Name duplicate found for '{datItemName}'");
// Get the duplicate suffix
- datItemName += datItem.GetDuplicateSuffix();
+ datItemName += GetDuplicateSuffix(datItem);
lastrenamed ??= datItemName;
// If we have a conflict with the last renamed item, do the right thing
@@ -882,7 +898,7 @@ namespace SabreTools.DatFiles
_logger.Verbose($"Name duplicate found for '{datItemName}'");
// Get the duplicate suffix
- datItemName += datItem.Value.GetDuplicateSuffix();
+ datItemName += GetDuplicateSuffix(datItem.Value);
lastrenamed ??= datItemName;
// If we have a conflict with the last renamed item, do the right thing
@@ -989,6 +1005,108 @@ namespace SabreTools.DatFiles
return false;
}
+ ///
+ /// Get unique duplicate suffix on name collision
+ ///
+ private static string GetDuplicateSuffix(Disk datItem)
+ {
+ string? md5 = datItem.GetStringFieldValue(Models.Metadata.Disk.MD5Key);
+ if (!string.IsNullOrEmpty(md5))
+ return $"_{md5}";
+
+ string? sha1 = datItem.GetStringFieldValue(Models.Metadata.Disk.SHA1Key);
+ if (!string.IsNullOrEmpty(sha1))
+ return $"_{sha1}";
+
+ return "_1";
+ }
+
+ ///
+ /// Get unique duplicate suffix on name collision
+ ///
+ /// String representing the suffix
+ private static string GetDuplicateSuffix(DatItems.Formats.File datItem)
+ {
+ if (!string.IsNullOrEmpty(datItem.CRC))
+ return $"_{datItem.CRC}";
+ else if (!string.IsNullOrEmpty(datItem.MD5))
+ return $"_{datItem.MD5}";
+ else if (!string.IsNullOrEmpty(datItem.SHA1))
+ return $"_{datItem.SHA1}";
+ else if (!string.IsNullOrEmpty(datItem.SHA256))
+ return $"_{datItem.SHA256}";
+ else
+ return "_1";
+ }
+
+ ///
+ /// Get unique duplicate suffix on name collision
+ ///
+ private static string GetDuplicateSuffix(Media datItem)
+ {
+ string? md5 = datItem.GetStringFieldValue(Models.Metadata.Media.MD5Key);
+ if (!string.IsNullOrEmpty(md5))
+ return $"_{md5}";
+
+ string? sha1 = datItem.GetStringFieldValue(Models.Metadata.Media.SHA1Key);
+ if (!string.IsNullOrEmpty(sha1))
+ return $"_{sha1}";
+
+ string? sha256 = datItem.GetStringFieldValue(Models.Metadata.Media.SHA256Key);
+ if (!string.IsNullOrEmpty(sha256))
+ return $"_{sha256}";
+
+ string? spamSum = datItem.GetStringFieldValue(Models.Metadata.Media.SpamSumKey);
+ if (!string.IsNullOrEmpty(spamSum))
+ return $"_{spamSum}";
+
+ return "_1";
+ }
+
+ ///
+ /// Get unique duplicate suffix on name collision
+ ///
+ private static string GetDuplicateSuffix(Rom datItem)
+ {
+ string? crc = datItem.GetStringFieldValue(Models.Metadata.Rom.CRCKey);
+ if (!string.IsNullOrEmpty(crc))
+ return $"_{crc}";
+
+ string? md2 = datItem.GetStringFieldValue(Models.Metadata.Rom.MD2Key);
+ if (!string.IsNullOrEmpty(md2))
+ return $"_{md2}";
+
+ string? md4 = datItem.GetStringFieldValue(Models.Metadata.Rom.MD4Key);
+ if (!string.IsNullOrEmpty(md4))
+ return $"_{md4}";
+
+ string? md5 = datItem.GetStringFieldValue(Models.Metadata.Rom.MD5Key);
+ if (!string.IsNullOrEmpty(md5))
+ return $"_{md5}";
+
+ string? sha1 = datItem.GetStringFieldValue(Models.Metadata.Rom.SHA1Key);
+ if (!string.IsNullOrEmpty(sha1))
+ return $"_{sha1}";
+
+ string? sha256 = datItem.GetStringFieldValue(Models.Metadata.Rom.SHA256Key);
+ if (!string.IsNullOrEmpty(sha256))
+ return $"_{sha256}";
+
+ string? sha384 = datItem.GetStringFieldValue(Models.Metadata.Rom.SHA384Key);
+ if (!string.IsNullOrEmpty(sha384))
+ return $"_{sha384}";
+
+ string? sha512 = datItem.GetStringFieldValue(Models.Metadata.Rom.SHA512Key);
+ if (!string.IsNullOrEmpty(sha512))
+ return $"_{sha512}";
+
+ string? spamSum = datItem.GetStringFieldValue(Models.Metadata.Rom.SpamSumKey);
+ if (!string.IsNullOrEmpty(spamSum))
+ return $"_{spamSum}";
+
+ return "_1";
+ }
+
///
/// Sort a list of DatItem objects by SourceID, Game, and Name (in order)
///
diff --git a/SabreTools.DatItems.Test/Formats/DiskTests.cs b/SabreTools.DatItems.Test/Formats/DiskTests.cs
index c8911983..ad03ecf0 100644
--- a/SabreTools.DatItems.Test/Formats/DiskTests.cs
+++ b/SabreTools.DatItems.Test/Formats/DiskTests.cs
@@ -101,40 +101,6 @@ namespace SabreTools.DatItems.Test.Formats
#endregion
- #region GetDuplicateSuffix
-
- [Fact]
- public void GetDuplicateSuffix_Disk_NoHash_Generic()
- {
- Disk self = new Disk();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Disk_MD5()
- {
- string hash = "XXXXXX";
- Disk self = new Disk();
- self.SetFieldValue(Models.Metadata.Disk.MD5Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_Disk_SHA1()
- {
- string hash = "XXXXXX";
- Disk self = new Disk();
- self.SetFieldValue(Models.Metadata.Disk.SHA1Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- #endregion
-
#region HasHashes
[Fact]
diff --git a/SabreTools.DatItems.Test/Formats/FileTests.cs b/SabreTools.DatItems.Test/Formats/FileTests.cs
index cb88ea08..667aa1db 100644
--- a/SabreTools.DatItems.Test/Formats/FileTests.cs
+++ b/SabreTools.DatItems.Test/Formats/FileTests.cs
@@ -96,58 +96,6 @@ namespace SabreTools.DatItems.Test.Formats
#endregion
- #region GetDuplicateSuffix
-
- [Fact]
- public void GetDuplicateSuffix_NoHash_Generic()
- {
- File self = new File();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_CRC()
- {
- string hash = "deadbeef";
- File self = new File { CRC = hash };
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_MD5()
- {
- string hash = "000000000000000000000000deadbeef";
- File self = new File { MD5 = hash };
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA1()
- {
- string hash = "00000000000000000000000000000000deadbeef";
- File self = new File { SHA1 = hash };
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA256()
- {
- string hash = "00000000000000000000000000000000000000000000000000000000deadbeef";
- File self = new File { SHA256 = hash };
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- #endregion
-
#region HasHashes
[Fact]
diff --git a/SabreTools.DatItems.Test/Formats/MediaTests.cs b/SabreTools.DatItems.Test/Formats/MediaTests.cs
index f162d7f0..909a7e5a 100644
--- a/SabreTools.DatItems.Test/Formats/MediaTests.cs
+++ b/SabreTools.DatItems.Test/Formats/MediaTests.cs
@@ -87,62 +87,6 @@ namespace SabreTools.DatItems.Test.Formats
#endregion
- #region GetDuplicateSuffix
-
- [Fact]
- public void GetDuplicateSuffix_NoHash_Generic()
- {
- Media self = new Media();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_MD5()
- {
- string hash = "XXXXXX";
- Media self = new Media();
- self.SetFieldValue(Models.Metadata.Media.MD5Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA1()
- {
- string hash = "XXXXXX";
- Media self = new Media();
- self.SetFieldValue(Models.Metadata.Media.SHA1Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA256()
- {
- string hash = "XXXXXX";
- Media self = new Media();
- self.SetFieldValue(Models.Metadata.Media.SHA256Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SpamSum()
- {
- string hash = "XXXXXX";
- Media self = new Media();
- self.SetFieldValue(Models.Metadata.Media.SpamSumKey, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- #endregion
-
#region HasHashes
[Fact]
diff --git a/SabreTools.DatItems.Test/Formats/RomTests.cs b/SabreTools.DatItems.Test/Formats/RomTests.cs
index 8bb6a1cc..dd5d3c85 100644
--- a/SabreTools.DatItems.Test/Formats/RomTests.cs
+++ b/SabreTools.DatItems.Test/Formats/RomTests.cs
@@ -58,117 +58,6 @@ namespace SabreTools.DatItems.Test.Formats
#endregion
- #region GetDuplicateSuffix
-
- [Fact]
- public void GetDuplicateSuffix_NoHash_Generic()
- {
- Rom self = new Rom();
- string actual = self.GetDuplicateSuffix();
- Assert.Equal("_1", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_CRC()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.CRCKey, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_MD2()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.MD2Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_MD4()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.MD4Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_MD5()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.MD5Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA1()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.SHA1Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA256()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.SHA256Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA384()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.SHA384Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SHA512()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.SHA512Key, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- [Fact]
- public void GetDuplicateSuffix_SpamSum()
- {
- string hash = "XXXXXX";
- Rom self = new Rom();
- self.SetFieldValue(Models.Metadata.Rom.SpamSumKey, hash);
-
- string actual = self.GetDuplicateSuffix();
- Assert.Equal($"_{hash}", actual);
- }
-
- #endregion
-
#region HasHashes
[Fact]
diff --git a/SabreTools.DatItems/DatItem.cs b/SabreTools.DatItems/DatItem.cs
index bd74a053..f7e42699 100644
--- a/SabreTools.DatItems/DatItem.cs
+++ b/SabreTools.DatItems/DatItem.cs
@@ -264,12 +264,6 @@ namespace SabreTools.DatItems
#region Sorting and Merging
- ///
- /// Get unique duplicate suffix on name collision
- ///
- /// String representing the suffix
- public virtual string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
-
///
/// Get the dictionary key that should be used for a given item and bucketing type
///
diff --git a/SabreTools.DatItems/Formats/File.cs b/SabreTools.DatItems/Formats/File.cs
index cbf3bffe..2e052ce0 100644
--- a/SabreTools.DatItems/Formats/File.cs
+++ b/SabreTools.DatItems/Formats/File.cs
@@ -212,24 +212,6 @@ namespace SabreTools.DatItems.Formats
_sha256 = other._sha256;
}
- ///
- /// Get unique duplicate suffix on name collision
- ///
- /// String representing the suffix
- public override string GetDuplicateSuffix()
- {
- if (!_crc.IsNullOrEmpty())
- return $"_{CRC}";
- else if (!_md5.IsNullOrEmpty())
- return $"_{MD5}";
- else if (!_sha1.IsNullOrEmpty())
- return $"_{SHA1}";
- else if (!_sha256.IsNullOrEmpty())
- return $"_{SHA256}";
- else
- return "_1";
- }
-
///
/// Returns if the File contains any hashes
///