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}'");
|
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
||||||
|
|
||||||
if (datItem is Disk || datItem is DatItems.Formats.File || datItem is Media || datItem is Rom)
|
// Get the duplicate suffix
|
||||||
{
|
datItemName += datItem.GetDuplicateSuffix();
|
||||||
datItemName += GetDuplicateSuffix(datItem);
|
lastrenamed ??= datItemName;
|
||||||
lastrenamed ??= datItemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a conflict with the last renamed item, do the right thing
|
// If we have a conflict with the last renamed item, do the right thing
|
||||||
if (datItemName == lastrenamed)
|
if (datItemName == lastrenamed)
|
||||||
@@ -906,11 +904,9 @@ namespace SabreTools.DatFiles
|
|||||||
{
|
{
|
||||||
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
_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)
|
// Get the duplicate suffix
|
||||||
{
|
datItemName += datItem.Value.GetDuplicateSuffix();
|
||||||
datItemName += GetDuplicateSuffix(datItem.Value);
|
lastrenamed ??= datItemName;
|
||||||
lastrenamed ??= datItemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a conflict with the last renamed item, do the right thing
|
// If we have a conflict with the last renamed item, do the right thing
|
||||||
if (datItemName == lastrenamed)
|
if (datItemName == lastrenamed)
|
||||||
@@ -1017,21 +1013,6 @@ namespace SabreTools.DatFiles
|
|||||||
return false;
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,6 +356,12 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region Sorting and Merging
|
#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>
|
/// <summary>
|
||||||
/// Get the dictionary key that should be used for a given item and bucketing type
|
/// Get the dictionary key that should be used for a given item and bucketing type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -114,12 +114,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
public void FillMissingInformation(Disk other)
|
public void FillMissingInformation(Disk other)
|
||||||
=> _internal.FillMissingHashes(other._internal);
|
=> _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>
|
/// <summary>
|
||||||
/// Returns if the Rom contains any hashes
|
/// Returns if the Rom contains any hashes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String representing the suffix</returns>
|
/// <returns>String representing the suffix</returns>
|
||||||
public string GetDuplicateSuffix()
|
public override string GetDuplicateSuffix()
|
||||||
{
|
{
|
||||||
if (!_crc.IsNullOrEmpty())
|
if (!_crc.IsNullOrEmpty())
|
||||||
return $"_{CRC}";
|
return $"_{CRC}";
|
||||||
|
|||||||
@@ -63,12 +63,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
public void FillMissingInformation(Media other)
|
public void FillMissingInformation(Media other)
|
||||||
=> _internal.FillMissingHashes(other._internal);
|
=> _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>
|
/// <summary>
|
||||||
/// Returns if the Rom contains any hashes
|
/// Returns if the Rom contains any hashes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -105,12 +105,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
public void FillMissingInformation(Rom other)
|
public void FillMissingInformation(Rom other)
|
||||||
=> _internal.FillMissingHashes(other._internal);
|
=> _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>
|
/// <summary>
|
||||||
/// Returns if the Rom contains any hashes
|
/// Returns if the Rom contains any hashes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user