mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, DatItem] Fix desc-to-name replacements
Previously, sets that had multiple items would trigger issues because of shared information in the items, mostly the Machine parts. By making all of it a clone, it takes a little more memory but ends up resolving all issues in desc-to-name mapping and replacement.
This commit is contained in:
@@ -14,7 +14,7 @@ using NaturalSort;
|
||||
|
||||
namespace SabreTools.Library.Dats
|
||||
{
|
||||
public abstract class DatItem : IEquatable<DatItem>, IComparable<DatItem>
|
||||
public abstract class DatItem : IEquatable<DatItem>, IComparable<DatItem>, ICloneable
|
||||
{
|
||||
#region Protected instance variables
|
||||
|
||||
@@ -144,6 +144,31 @@ namespace SabreTools.Library.Dats
|
||||
|
||||
#region Instance Methods
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
switch (_itemType)
|
||||
{
|
||||
case ItemType.Archive:
|
||||
return ((Archive)this).Clone();
|
||||
case ItemType.BiosSet:
|
||||
return ((BiosSet)this).Clone();
|
||||
case ItemType.Disk:
|
||||
return ((Disk)this).Clone();
|
||||
case ItemType.Release:
|
||||
return ((Release)this).Clone();
|
||||
case ItemType.Rom:
|
||||
return ((Rom)this).Clone();
|
||||
case ItemType.Sample:
|
||||
return ((Sample)this).Clone();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public int CompareTo(DatItem other)
|
||||
|
||||
Reference in New Issue
Block a user