mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Handle nested item comparisons, add Equals tests
This commit is contained in:
@@ -163,6 +163,11 @@ namespace SabreTools.Core
|
||||
return false;
|
||||
break;
|
||||
|
||||
case (ModelBackedItem selfMbi, ModelBackedItem otherMbi):
|
||||
if (!selfMbi.Equals(otherMbi))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case (DictionaryBase selfDb, DictionaryBase otherDb):
|
||||
if (!selfDb.Equals(otherDb))
|
||||
return false;
|
||||
|
||||
@@ -8,7 +8,20 @@ namespace SabreTools.Core
|
||||
/// <summary>
|
||||
/// Represents an item that's backed by a DictionaryBase item
|
||||
/// </summary>
|
||||
public abstract class ModelBackedItem<T> where T : Models.Metadata.DictionaryBase
|
||||
public abstract class ModelBackedItem : IEquatable<ModelBackedItem>
|
||||
{
|
||||
#region Comparision Methods
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract bool Equals(ModelBackedItem? other);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents an item that's backed by a DictionaryBase item
|
||||
/// </summary>
|
||||
public abstract class ModelBackedItem<T> : ModelBackedItem, IEquatable<ModelBackedItem<T>> where T : Models.Metadata.DictionaryBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal model wrapped by this DatItem
|
||||
@@ -150,6 +163,13 @@ namespace SabreTools.Core
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract bool Equals(ModelBackedItem<T>? other);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user