mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make duplicate suffix inherent
This commit is contained in:
@@ -811,11 +811,9 @@ namespace SabreTools.DatFiles
|
||||
{
|
||||
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
||||
|
||||
if (datItem is Disk || datItem is DatItems.Formats.File || datItem is Media || datItem is Rom)
|
||||
{
|
||||
datItemName += GetDuplicateSuffix(datItem);
|
||||
// Get the duplicate suffix
|
||||
datItemName += datItem.GetDuplicateSuffix();
|
||||
lastrenamed ??= datItemName;
|
||||
}
|
||||
|
||||
// If we have a conflict with the last renamed item, do the right thing
|
||||
if (datItemName == lastrenamed)
|
||||
@@ -906,11 +904,9 @@ namespace SabreTools.DatFiles
|
||||
{
|
||||
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
||||
|
||||
if (datItem.Value is Disk || datItem.Value is DatItems.Formats.File || datItem.Value is Media || datItem.Value is Rom)
|
||||
{
|
||||
datItemName += GetDuplicateSuffix(datItem.Value);
|
||||
// Get the duplicate suffix
|
||||
datItemName += datItem.Value.GetDuplicateSuffix();
|
||||
lastrenamed ??= datItemName;
|
||||
}
|
||||
|
||||
// If we have a conflict with the last renamed item, do the right thing
|
||||
if (datItemName == lastrenamed)
|
||||
@@ -1017,21 +1013,6 @@ namespace SabreTools.DatFiles
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get duplicate suffix based on the item type
|
||||
/// </summary>
|
||||
private static string GetDuplicateSuffix(DatItem datItem)
|
||||
{
|
||||
return datItem switch
|
||||
{
|
||||
Disk disk => disk.GetDuplicateSuffix(),
|
||||
DatItems.Formats.File file => file.GetDuplicateSuffix(),
|
||||
Media media => media.GetDuplicateSuffix(),
|
||||
Rom rom => rom.GetDuplicateSuffix(),
|
||||
_ => "_1",
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,6 +356,12 @@ namespace SabreTools.DatItems
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
/// <returns>String representing the suffix</returns>
|
||||
public virtual string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||
|
||||
/// <summary>
|
||||
/// Get the dictionary key that should be used for a given item and bucketing type
|
||||
/// </summary>
|
||||
|
||||
@@ -114,12 +114,6 @@ namespace SabreTools.DatItems.Formats
|
||||
public void FillMissingInformation(Disk other)
|
||||
=> _internal.FillMissingHashes(other._internal);
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
/// <returns>String representing the suffix</returns>
|
||||
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the Rom contains any hashes
|
||||
/// </summary>
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace SabreTools.DatItems.Formats
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
/// <returns>String representing the suffix</returns>
|
||||
public string GetDuplicateSuffix()
|
||||
public override string GetDuplicateSuffix()
|
||||
{
|
||||
if (!_crc.IsNullOrEmpty())
|
||||
return $"_{CRC}";
|
||||
|
||||
@@ -63,12 +63,6 @@ namespace SabreTools.DatItems.Formats
|
||||
public void FillMissingInformation(Media other)
|
||||
=> _internal.FillMissingHashes(other._internal);
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
/// <returns>String representing the suffix</returns>
|
||||
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the Rom contains any hashes
|
||||
/// </summary>
|
||||
|
||||
@@ -105,12 +105,6 @@ namespace SabreTools.DatItems.Formats
|
||||
public void FillMissingInformation(Rom other)
|
||||
=> _internal.FillMissingHashes(other._internal);
|
||||
|
||||
/// <summary>
|
||||
/// Get unique duplicate suffix on name collision
|
||||
/// </summary>
|
||||
/// <returns>String representing the suffix</returns>
|
||||
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the Rom contains any hashes
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user