Further reduce calls to EqualTo

This commit is contained in:
Matt Nadareski
2026-04-04 19:47:00 -04:00
parent c819be57a5
commit 8fe2b51d6f
46 changed files with 712 additions and 71 deletions

View File

@@ -385,7 +385,7 @@ namespace SabreTools.Metadata.DatFiles
return false;
// Compare internal models
return _internal.EqualTo(otherItem._internal);
return _internal.Equals(otherItem._internal);
}
/// <inheritdoc/>
@@ -400,7 +400,7 @@ namespace SabreTools.Metadata.DatFiles
return false;
// Compare internal models
return _internal.EqualTo(otherItem._internal);
return _internal.Equals(otherItem._internal);
}
#endregion

View File

@@ -11,12 +11,21 @@ namespace SabreTools.Metadata.DatItems.Test
/// <summary>
/// Testing implementation of Data.Models.Metadata.DatItem
/// </summary>
private class TestDatItemModel : Data.Models.Metadata.DatItem, ICloneable
private class TestDatItemModel : Data.Models.Metadata.DatItem, ICloneable, IEquatable<TestDatItemModel>
{
public string? Name { get; set; }
/// <inheritdoc/>
public object Clone() => new TestDatItemModel { Name = Name };
/// <inheritdoc/>
public bool Equals(TestDatItemModel? other)
{
if (other is null)
return false;
return string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase);
}
}
/// <summary>
@@ -52,6 +61,20 @@ namespace SabreTools.Metadata.DatItems.Test
/// <inheritdoc/>
public override void SetName(string? name) => Name = name;
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other value is invalid
if (other is null)
return false;
// If the type matches
if (other is TestDatItem otherTestDatItem)
return ((TestDatItemModel)_internal).Equals((TestDatItemModel)otherTestDatItem._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<TestDatItemModel>? other)
@@ -62,7 +85,7 @@ namespace SabreTools.Metadata.DatItems.Test
// If the type matches
if (other is TestDatItem otherTestDatItem)
return _internal.Equals(otherTestDatItem._internal);
return ((TestDatItemModel)_internal).Equals((TestDatItemModel)otherTestDatItem._internal);
// Everything else fails
return false;

View File

@@ -203,19 +203,7 @@ namespace SabreTools.Metadata.DatItems
/// </summary>
/// <param name="other">DatItem to use as a baseline</param>
/// <returns>True if the items are duplicates, false otherwise</returns>
public virtual bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If we don't have a matched type, return false
if (ItemType != other.ItemType)
return false;
// Compare the internal models
return _internal.EqualTo(other._internal);
}
public abstract bool Equals(DatItem? other);
#endregion

View File

@@ -83,6 +83,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Adjuster otherAdjuster)
return ((Data.Models.Metadata.Adjuster)_internal).Equals((Data.Models.Metadata.Adjuster)otherAdjuster._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Adjuster>? other)
{
@@ -92,7 +107,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Adjuster otherAdjuster)
return _internal.Equals(otherAdjuster._internal);
return ((Data.Models.Metadata.Adjuster)_internal).Equals((Data.Models.Metadata.Adjuster)otherAdjuster._internal);
// Everything else fails
return false;

View File

@@ -60,6 +60,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Analog otherAnalog)
return ((Data.Models.Metadata.Analog)_internal).Equals((Data.Models.Metadata.Analog)otherAnalog._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Analog>? other)
{
@@ -69,7 +84,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Analog otherAnalog)
return _internal.Equals(otherAnalog._internal);
return ((Data.Models.Metadata.Analog)_internal).Equals((Data.Models.Metadata.Analog)otherAnalog._internal);
// Everything else fails
return false;

View File

@@ -251,6 +251,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Archive otherArchive)
return ((Data.Models.Metadata.Archive)_internal).Equals((Data.Models.Metadata.Archive)otherArchive._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Archive>? other)
{
@@ -260,7 +275,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Archive otherArchive)
return _internal.Equals(otherArchive._internal);
return ((Data.Models.Metadata.Archive)_internal).Equals((Data.Models.Metadata.Archive)otherArchive._internal);
// Everything else fails
return false;

View File

@@ -72,6 +72,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is BiosSet otherBiosSet)
return ((Data.Models.Metadata.BiosSet)_internal).Equals((Data.Models.Metadata.BiosSet)otherBiosSet._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.BiosSet>? other)
{
@@ -81,7 +96,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is BiosSet otherBiosSet)
return _internal.Equals(otherBiosSet._internal);
return ((Data.Models.Metadata.BiosSet)_internal).Equals((Data.Models.Metadata.BiosSet)otherBiosSet._internal);
// Everything else fails
return false;

View File

@@ -54,6 +54,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Blank otherBlank)
return ((Data.Models.Metadata.Blank)_internal).Equals((Data.Models.Metadata.Blank)otherBlank._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Blank>? other)
{
@@ -63,7 +78,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Blank otherBlank)
return _internal.Equals(otherBlank._internal);
return ((Data.Models.Metadata.Blank)_internal).Equals((Data.Models.Metadata.Blank)otherBlank._internal);
// Everything else fails
return false;

View File

@@ -90,6 +90,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Chip otherChip)
return ((Data.Models.Metadata.Chip)_internal).Equals((Data.Models.Metadata.Chip)otherChip._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Chip>? other)
{
@@ -99,7 +114,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Chip otherChip)
return _internal.Equals(otherChip._internal);
return ((Data.Models.Metadata.Chip)_internal).Equals((Data.Models.Metadata.Chip)otherChip._internal);
// Everything else fails
return false;

View File

@@ -78,6 +78,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Condition otherCondition)
return ((Data.Models.Metadata.Condition)_internal).Equals((Data.Models.Metadata.Condition)otherCondition._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Condition>? other)
{
@@ -87,7 +102,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Condition otherCondition)
return _internal.Equals(otherCondition._internal);
return ((Data.Models.Metadata.Condition)_internal).Equals((Data.Models.Metadata.Condition)otherCondition._internal);
// Everything else fails
return false;

View File

@@ -72,6 +72,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is ConfLocation otherConfLocation)
return ((Data.Models.Metadata.ConfLocation)_internal).Equals((Data.Models.Metadata.ConfLocation)otherConfLocation._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.ConfLocation>? other)
{
@@ -81,7 +96,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is ConfLocation otherConfLocation)
return _internal.Equals(otherConfLocation._internal);
return ((Data.Models.Metadata.ConfLocation)_internal).Equals((Data.Models.Metadata.ConfLocation)otherConfLocation._internal);
// Everything else fails
return false;

View File

@@ -89,6 +89,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is ConfSetting otherConfSetting)
return ((Data.Models.Metadata.ConfSetting)_internal).Equals((Data.Models.Metadata.ConfSetting)otherConfSetting._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.ConfSetting>? other)
{
@@ -98,7 +113,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is ConfSetting otherConfSetting)
return _internal.Equals(otherConfSetting._internal);
return ((Data.Models.Metadata.ConfSetting)_internal).Equals((Data.Models.Metadata.ConfSetting)otherConfSetting._internal);
// Everything else fails
return false;

View File

@@ -112,6 +112,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Configuration otherConfiguration)
return ((Data.Models.Metadata.Configuration)_internal).Equals((Data.Models.Metadata.Configuration)otherConfiguration._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Configuration>? other)
{
@@ -121,7 +136,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Configuration otherConfiguration)
return _internal.Equals(otherConfiguration._internal);
return ((Data.Models.Metadata.Configuration)_internal).Equals((Data.Models.Metadata.Configuration)otherConfiguration._internal);
// Everything else fails
return false;

View File

@@ -126,6 +126,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Control otherControl)
return ((Data.Models.Metadata.Control)_internal).Equals((Data.Models.Metadata.Control)otherControl._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Control>? other)
{
@@ -135,7 +150,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Control otherControl)
return _internal.Equals(otherControl._internal);
return ((Data.Models.Metadata.Control)_internal).Equals((Data.Models.Metadata.Control)otherControl._internal);
// Everything else fails
return false;

View File

@@ -96,6 +96,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DataArea otherDataArea)
return ((Data.Models.Metadata.DataArea)_internal).Equals((Data.Models.Metadata.DataArea)otherDataArea._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DataArea>? other)
{
@@ -105,7 +120,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DataArea otherDataArea)
return _internal.Equals(otherDataArea._internal);
return ((Data.Models.Metadata.DataArea)_internal).Equals((Data.Models.Metadata.DataArea)otherDataArea._internal);
// Everything else fails
return false;

View File

@@ -119,6 +119,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Device otherDevice)
return ((Data.Models.Metadata.Device)_internal).Equals((Data.Models.Metadata.Device)otherDevice._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Device>? other)
{
@@ -128,7 +143,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Device otherDevice)
return _internal.Equals(otherDevice._internal);
return ((Data.Models.Metadata.Device)_internal).Equals((Data.Models.Metadata.Device)otherDevice._internal);
// Everything else fails
return false;

View File

@@ -60,6 +60,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DeviceRef otherDeviceRef)
return ((Data.Models.Metadata.DeviceRef)_internal).Equals((Data.Models.Metadata.DeviceRef)otherDeviceRef._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DeviceRef>? other)
{
@@ -69,7 +84,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DeviceRef otherDeviceRef)
return _internal.Equals(otherDeviceRef._internal);
return ((Data.Models.Metadata.DeviceRef)_internal).Equals((Data.Models.Metadata.DeviceRef)otherDeviceRef._internal);
// Everything else fails
return false;

View File

@@ -72,6 +72,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DipLocation otherDipLocation)
return ((Data.Models.Metadata.DipLocation)_internal).Equals((Data.Models.Metadata.DipLocation)otherDipLocation._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DipLocation>? other)
{
@@ -81,7 +96,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DipLocation otherDipLocation)
return _internal.Equals(otherDipLocation._internal);
return ((Data.Models.Metadata.DipLocation)_internal).Equals((Data.Models.Metadata.DipLocation)otherDipLocation._internal);
// Everything else fails
return false;

View File

@@ -142,6 +142,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DipSwitch otherDipSwitch)
return ((Data.Models.Metadata.DipSwitch)_internal).Equals((Data.Models.Metadata.DipSwitch)otherDipSwitch._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DipSwitch>? other)
{
@@ -151,7 +166,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DipSwitch otherDipSwitch)
return _internal.Equals(otherDipSwitch._internal);
return ((Data.Models.Metadata.DipSwitch)_internal).Equals((Data.Models.Metadata.DipSwitch)otherDipSwitch._internal);
// Everything else fails
return false;

View File

@@ -89,6 +89,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DipValue otherDipValue)
return ((Data.Models.Metadata.DipValue)_internal).Equals((Data.Models.Metadata.DipValue)otherDipValue._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DipValue>? other)
{
@@ -98,7 +113,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DipValue otherDipValue)
return _internal.Equals(otherDipValue._internal);
return ((Data.Models.Metadata.DipValue)_internal).Equals((Data.Models.Metadata.DipValue)otherDipValue._internal);
// Everything else fails
return false;

View File

@@ -173,6 +173,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Disk otherDisk)
return ((Data.Models.Metadata.Disk)_internal).PartialEquals((Data.Models.Metadata.Disk)otherDisk._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Disk>? other)
{
@@ -182,7 +197,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Disk otherDisk)
return _internal.Equals(otherDisk._internal);
return ((Data.Models.Metadata.Disk)_internal).PartialEquals((Data.Models.Metadata.Disk)otherDisk._internal);
// Everything else fails
return false;

View File

@@ -78,6 +78,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is DiskArea otherDiskArea)
return ((Data.Models.Metadata.DiskArea)_internal).Equals((Data.Models.Metadata.DiskArea)otherDiskArea._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.DiskArea>? other)
{
@@ -87,7 +102,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is DiskArea otherDiskArea)
return _internal.Equals(otherDiskArea._internal);
return ((Data.Models.Metadata.DiskArea)_internal).Equals((Data.Models.Metadata.DiskArea)otherDiskArea._internal);
// Everything else fails
return false;

View File

@@ -167,6 +167,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Display otherDisplay)
return ((Data.Models.Metadata.Display)_internal).Equals((Data.Models.Metadata.Display)otherDisplay._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Display>? other)
{
@@ -176,7 +191,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Display otherDisplay)
return _internal.Equals(otherDisplay._internal);
return ((Data.Models.Metadata.Display)_internal).Equals((Data.Models.Metadata.Display)otherDisplay._internal);
// Everything else fails
return false;

View File

@@ -126,6 +126,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Driver otherDriver)
return ((Data.Models.Metadata.Driver)_internal).Equals((Data.Models.Metadata.Driver)otherDriver._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Driver>? other)
{
@@ -135,7 +150,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Driver otherDriver)
return _internal.Equals(otherDriver._internal);
return ((Data.Models.Metadata.Driver)_internal).Equals((Data.Models.Metadata.Driver)otherDriver._internal);
// Everything else fails
return false;

View File

@@ -60,6 +60,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Extension otherExtension)
return ((Data.Models.Metadata.Extension)_internal).Equals((Data.Models.Metadata.Extension)otherExtension._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Extension>? other)
{
@@ -69,7 +84,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Extension otherExtension)
return _internal.Equals(otherExtension._internal);
return ((Data.Models.Metadata.Extension)_internal).Equals((Data.Models.Metadata.Extension)otherExtension._internal);
// Everything else fails
return false;

View File

@@ -84,6 +84,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Feature otherFeature)
return ((Data.Models.Metadata.Feature)_internal).Equals((Data.Models.Metadata.Feature)otherFeature._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Feature>? other)
{
@@ -93,7 +108,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Feature otherFeature)
return _internal.Equals(otherFeature._internal);
return ((Data.Models.Metadata.Feature)_internal).Equals((Data.Models.Metadata.Feature)otherFeature._internal);
// Everything else fails
return false;

View File

@@ -66,6 +66,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Info otherInfo)
return ((Data.Models.Metadata.Info)_internal).Equals((Data.Models.Metadata.Info)otherInfo._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Info>? other)
{
@@ -75,7 +90,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Info otherInfo)
return _internal.Equals(otherInfo._internal);
return ((Data.Models.Metadata.Info)_internal).Equals((Data.Models.Metadata.Info)otherInfo._internal);
// Everything else fails
return false;

View File

@@ -108,6 +108,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Input otherInput)
return ((Data.Models.Metadata.Input)_internal).Equals((Data.Models.Metadata.Input)otherInput._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Input>? other)
{
@@ -117,7 +132,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Input otherInput)
return _internal.Equals(otherInput._internal);
return ((Data.Models.Metadata.Input)_internal).Equals((Data.Models.Metadata.Input)otherInput._internal);
// Everything else fails
return false;

View File

@@ -66,6 +66,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Instance otherInstance)
return ((Data.Models.Metadata.Instance)_internal).Equals((Data.Models.Metadata.Instance)otherInstance._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Instance>? other)
{
@@ -75,7 +90,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Instance otherInstance)
return _internal.Equals(otherInstance._internal);
return ((Data.Models.Metadata.Instance)_internal).Equals((Data.Models.Metadata.Instance)otherInstance._internal);
// Everything else fails
return false;

View File

@@ -118,6 +118,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Media otherMedia)
return ((Data.Models.Metadata.Media)_internal).PartialEquals((Data.Models.Metadata.Media)otherMedia._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Media>? other)
{
@@ -127,7 +142,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Media otherMedia)
return _internal.Equals(otherMedia._internal);
return ((Data.Models.Metadata.Media)_internal).PartialEquals((Data.Models.Metadata.Media)otherMedia._internal);
// Everything else fails
return false;

View File

@@ -118,6 +118,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Part otherPart)
return ((Data.Models.Metadata.Part)_internal).Equals((Data.Models.Metadata.Part)otherPart._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Part>? other)
{
@@ -127,7 +142,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Part otherPart)
return _internal.Equals(otherPart._internal);
return ((Data.Models.Metadata.Part)_internal).Equals((Data.Models.Metadata.Part)otherPart._internal);
// Everything else fails
return false;

View File

@@ -89,6 +89,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is PartFeature otherPartFeature)
return ((Data.Models.Metadata.Feature)_internal).Equals((Data.Models.Metadata.Feature)otherPartFeature._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Feature>? other)
{
@@ -97,8 +112,8 @@ namespace SabreTools.Metadata.DatItems.Formats
return false;
// If the type matches
if (other is PartFeature otherFeature)
return _internal.Equals(otherFeature._internal);
if (other is PartFeature otherPartFeature)
return ((Data.Models.Metadata.Feature)_internal).Equals((Data.Models.Metadata.Feature)otherPartFeature._internal);
// Everything else fails
return false;

View File

@@ -78,6 +78,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Port otherPort)
return ((Data.Models.Metadata.Port)_internal).Equals((Data.Models.Metadata.Port)otherPort._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Port>? other)
{
@@ -87,7 +102,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Port otherPort)
return _internal.Equals(otherPort._internal);
return ((Data.Models.Metadata.Port)_internal).Equals((Data.Models.Metadata.Port)otherPort._internal);
// Everything else fails
return false;

View File

@@ -72,6 +72,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is RamOption otherRamOption)
return ((Data.Models.Metadata.RamOption)_internal).Equals((Data.Models.Metadata.RamOption)otherRamOption._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.RamOption>? other)
{
@@ -81,7 +96,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is RamOption otherRamOption)
return _internal.Equals(otherRamOption._internal);
return ((Data.Models.Metadata.RamOption)_internal).Equals((Data.Models.Metadata.RamOption)otherRamOption._internal);
// Everything else fails
return false;

View File

@@ -1,4 +1,4 @@
using System.Xml.Serialization;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Metadata.DatItems.Formats
@@ -84,6 +84,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Release otherRelease)
return ((Data.Models.Metadata.Release)_internal).Equals((Data.Models.Metadata.Release)otherRelease._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Release>? other)
{
@@ -93,7 +108,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Release otherRelease)
return _internal.Equals(otherRelease._internal);
return ((Data.Models.Metadata.Release)_internal).Equals((Data.Models.Metadata.Release)otherRelease._internal);
// Everything else fails
return false;

View File

@@ -149,6 +149,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is ReleaseDetails otherReleaseDetails)
return ((Data.Models.Metadata.ReleaseDetails)_internal).Equals((Data.Models.Metadata.ReleaseDetails)otherReleaseDetails._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.ReleaseDetails>? other)
{
@@ -158,7 +173,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is ReleaseDetails otherReleaseDetails)
return _internal.Equals(otherReleaseDetails._internal);
return ((Data.Models.Metadata.ReleaseDetails)_internal).Equals((Data.Models.Metadata.ReleaseDetails)otherReleaseDetails._internal);
// Everything else fails
return false;

View File

@@ -418,6 +418,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Rom otherRom)
return ((Data.Models.Metadata.Rom)_internal).PartialEquals((Data.Models.Metadata.Rom)otherRom._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Rom>? other)
{
@@ -427,7 +442,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Rom otherRom)
return _internal.Equals(otherRom._internal);
return ((Data.Models.Metadata.Rom)_internal).PartialEquals((Data.Models.Metadata.Rom)otherRom._internal);
// Everything else fails
return false;

View File

@@ -60,6 +60,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Sample otherSample)
return ((Data.Models.Metadata.Sample)_internal).Equals((Data.Models.Metadata.Sample)otherSample._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Sample>? other)
{
@@ -69,7 +84,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Sample otherSample)
return _internal.Equals(otherSample._internal);
return ((Data.Models.Metadata.Sample)_internal).Equals((Data.Models.Metadata.Sample)otherSample._internal);
// Everything else fails
return false;

View File

@@ -138,6 +138,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Serials otherSerials)
return ((Data.Models.Metadata.Serials)_internal).Equals((Data.Models.Metadata.Serials)otherSerials._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Serials>? other)
{
@@ -147,7 +162,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Serials otherSerials)
return _internal.Equals(otherSerials._internal);
return ((Data.Models.Metadata.Serials)_internal).Equals((Data.Models.Metadata.Serials)otherSerials._internal);
// Everything else fails
return false;

View File

@@ -66,6 +66,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is SharedFeat otherSharedFeat)
return ((Data.Models.Metadata.SharedFeat)_internal).Equals((Data.Models.Metadata.SharedFeat)otherSharedFeat._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.SharedFeat>? other)
{
@@ -75,7 +90,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is SharedFeat otherSharedFeat)
return _internal.Equals(otherSharedFeat._internal);
return ((Data.Models.Metadata.SharedFeat)_internal).Equals((Data.Models.Metadata.SharedFeat)otherSharedFeat._internal);
// Everything else fails
return false;

View File

@@ -78,6 +78,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Slot otherSlot)
return ((Data.Models.Metadata.Slot)_internal).Equals((Data.Models.Metadata.Slot)otherSlot._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Slot>? other)
{
@@ -87,7 +102,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Slot otherSlot)
return _internal.Equals(otherSlot._internal);
return ((Data.Models.Metadata.Slot)_internal).Equals((Data.Models.Metadata.Slot)otherSlot._internal);
// Everything else fails
return false;

View File

@@ -1,4 +1,4 @@
using System.Xml.Serialization;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Metadata.DatItems.Formats
@@ -72,6 +72,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is SlotOption otherSlotOption)
return ((Data.Models.Metadata.SlotOption)_internal).Equals((Data.Models.Metadata.SlotOption)otherSlotOption._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.SlotOption>? other)
{
@@ -81,7 +96,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is SlotOption otherSlotOption)
return _internal.Equals(otherSlotOption._internal);
return ((Data.Models.Metadata.SlotOption)_internal).Equals((Data.Models.Metadata.SlotOption)otherSlotOption._internal);
// Everything else fails
return false;

View File

@@ -78,6 +78,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is SoftwareList otherSoftwareList)
return ((Data.Models.Metadata.SoftwareList)_internal).Equals((Data.Models.Metadata.SoftwareList)otherSoftwareList._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.SoftwareList>? other)
{
@@ -87,7 +102,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is SoftwareList otherSoftwareList)
return _internal.Equals(otherSoftwareList._internal);
return ((Data.Models.Metadata.SoftwareList)_internal).Equals((Data.Models.Metadata.SoftwareList)otherSoftwareList._internal);
// Everything else fails
return false;

View File

@@ -60,6 +60,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is Sound otherSound)
return ((Data.Models.Metadata.Sound)_internal).Equals((Data.Models.Metadata.Sound)otherSound._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.Sound>? other)
{
@@ -69,7 +84,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is Sound otherSound)
return _internal.Equals(otherSound._internal);
return ((Data.Models.Metadata.Sound)_internal).Equals((Data.Models.Metadata.Sound)otherSound._internal);
// Everything else fails
return false;

View File

@@ -198,6 +198,21 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{
// If the other item is null
if (other is null)
return false;
// If the type matches
if (other is SourceDetails otherSourceDetails)
return ((Data.Models.Metadata.SourceDetails)_internal).Equals((Data.Models.Metadata.SourceDetails)otherSourceDetails._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem<Data.Models.Metadata.SourceDetails>? other)
{
@@ -207,7 +222,7 @@ namespace SabreTools.Metadata.DatItems.Formats
// If the type matches
if (other is SourceDetails otherSourceDetails)
return _internal.Equals(otherSourceDetails._internal);
return ((Data.Models.Metadata.SourceDetails)_internal).Equals((Data.Models.Metadata.SourceDetails)otherSourceDetails._internal);
// Everything else fails
return false;

View File

@@ -39,7 +39,7 @@ namespace SabreTools.Metadata
(DipLocation selfDipLocation, DipLocation otherDipLocation) => selfDipLocation.Equals(otherDipLocation),
(DipSwitch selfDipSwitch, DipSwitch otherDipSwitch) => selfDipSwitch.Equals(otherDipSwitch),
(DipValue selfDipValue, DipValue otherDipValue) => selfDipValue.Equals(otherDipValue),
(Disk selfDisk, Disk otherDisk) => EqualsImpl(selfDisk, otherDisk),
(Disk selfDisk, Disk otherDisk) => PartialEquals(selfDisk, otherDisk),
(DiskArea selfDiskArea, DiskArea otherDiskArea) => selfDiskArea.Equals(otherDiskArea),
(Display selfDisplay, Display otherDisplay) => selfDisplay.Equals(otherDisplay),
(Driver selfDriver, Driver otherDriver) => selfDriver.Equals(otherDriver),
@@ -50,14 +50,14 @@ namespace SabreTools.Metadata
(Input selfInput, Input otherInput) => selfInput.Equals(otherInput),
(Instance selfInstance, Instance otherInstance) => selfInstance.Equals(otherInstance),
(Machine selfMachine, Machine otherMachine) => EqualsImpl(selfMachine, otherMachine),
(Media selfMedia, Media otherMedia) => EqualsImpl(selfMedia, otherMedia),
(Media selfMedia, Media otherMedia) => PartialEquals(selfMedia, otherMedia),
(Original selfOriginal, Original otherOriginal) => selfOriginal.Equals(otherOriginal),
(Part selfPart, Part otherPart) => selfPart.Equals(otherPart),
(Port selfPort, Port otherPort) => selfPort.Equals(otherPort),
(RamOption selfRamOption, RamOption otherRamOption) => selfRamOption.Equals(otherRamOption),
(Release selfRelease, Release otherRelease) => selfRelease.Equals(otherRelease),
(ReleaseDetails selfReleaseDetails, ReleaseDetails otherReleaseDetails) => selfReleaseDetails.Equals(otherReleaseDetails),
(Rom selfRom, Rom otherRom) => EqualsImpl(selfRom, otherRom),
(Rom selfRom, Rom otherRom) => PartialEquals(selfRom, otherRom),
(Serials selfSerials, Serials otherSerials) => selfSerials.Equals(otherSerials),
(SharedFeat selfSharedFeat, SharedFeat otherSharedFeat) => selfSharedFeat.Equals(otherSharedFeat),
(Slot selfSlot, Slot otherSlot) => selfSlot.Equals(otherSlot),
@@ -100,7 +100,7 @@ namespace SabreTools.Metadata
else if (self is DipValue selfDipValue && other is DipValue otherDipValue)
return selfDipValue.Equals(otherDipValue);
else if (self is Disk selfDisk && other is Disk otherDisk)
return EqualsImpl(selfDisk, otherDisk);
return PartialEquals(selfDisk, otherDisk);
else if (self is DiskArea selfDiskArea && other is DiskArea otherDiskArea)
return selfDiskArea.Equals(otherDiskArea);
else if (self is Display selfDisplay && other is Display otherDisplay)
@@ -122,7 +122,7 @@ namespace SabreTools.Metadata
else if (self is Machine selfMachine && other is Machine otherMachine)
return EqualsImpl(selfMachine, otherMachine);
else if (self is Media selfMedia && other is Media otherMedia)
return EqualsImpl(selfMedia, otherMedia);
return PartialEquals(selfMedia, otherMedia);
else if (self is Original selfOriginal && other is Original otherOriginal)
return selfOriginal.Equals(otherOriginal);
else if (self is Part selfPart && other is Part otherPart)
@@ -136,7 +136,7 @@ namespace SabreTools.Metadata
else if (self is ReleaseDetails selfReleaseDetails && other is ReleaseDetails otherReleaseDetails)
return selfReleaseDetails.Equals(otherReleaseDetails);
else if (self is Rom selfRom && other is Rom otherRom)
return EqualsImpl(selfRom, otherRom);
return PartialEquals(selfRom, otherRom);
else if (self is Serials selfSerials && other is Serials otherSerials)
return selfSerials.Equals(otherSerials);
else if (self is SharedFeat selfSharedFeat && other is SharedFeat otherSharedFeat)
@@ -289,7 +289,7 @@ namespace SabreTools.Metadata
/// <summary>
/// Check equality of two Disk objects
/// </summary>
private static bool EqualsImpl(this Disk self, Disk other)
public static bool PartialEquals(this Disk self, Disk other)
{
ItemStatus? selfStatus = self.Status;
ItemStatus? otherStatus = other.Status;
@@ -318,7 +318,7 @@ namespace SabreTools.Metadata
/// <summary>
/// Check equality of two Media objects
/// </summary>
private static bool EqualsImpl(this Media self, Media other)
public static bool PartialEquals(this Media self, Media other)
{
// If we get a partial match
if (self.HashMatch(other))
@@ -331,7 +331,7 @@ namespace SabreTools.Metadata
/// <summary>
/// Check equality of two Rom objects
/// </summary>
private static bool EqualsImpl(this Rom self, Rom other)
public static bool PartialEquals(this Rom self, Rom other)
{
ItemStatus? selfStatus = self.Status;
ItemStatus? otherStatus = other.Status;