ModelBackedItem doesn't need to be equatable

This commit is contained in:
Matt Nadareski
2026-04-05 01:08:41 -04:00
parent 0ed13167ba
commit 1997346988
49 changed files with 7 additions and 1381 deletions

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Metadata.DatFiles
/// Represents all possible DAT header information
/// </summary>
[JsonObject("header"), XmlRoot("header")]
public sealed class DatHeader : ModelBackedItem<Data.Models.Metadata.Header>, ICloneable
public sealed class DatHeader : ModelBackedItem<Data.Models.Metadata.Header>, ICloneable, IEquatable<DatHeader>
{
#region Properties
@@ -374,33 +374,14 @@ namespace SabreTools.Metadata.DatFiles
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? other)
public bool Equals(DatHeader? other)
{
// If other is null
if (other is null)
return false;
// If the type is mismatched
if (other is not DatHeader otherItem)
return false;
// Compare internal models
return _internal.Equals(otherItem._internal);
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.Header>? other)
{
// If other is null
if (other is null)
return false;
// If the type is mismatched
if (other is not DatHeader otherItem)
return false;
// Compare internal models
return _internal.Equals(otherItem._internal);
return _internal.Equals(other._internal);
}
#endregion

View File

@@ -61,36 +61,6 @@ namespace SabreTools.Metadata.DatItems.Test
/// <inheritdoc/>
public override void SetName(string? name) => Name = name;
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? other)
{
// If the other item is null
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(ModelBackedItem<Data.Models.Metadata.DatItem>? other)
{
// If the other item is null
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? other)
{

View File

@@ -168,12 +168,6 @@ namespace SabreTools.Metadata.DatItems
return string.Compare(selfName, otherName, StringComparison.Ordinal);
}
/// <inheritdoc/>
public abstract override bool Equals(ModelBackedItem? other);
/// <inheritdoc/>
public abstract override bool Equals(ModelBackedItem<Data.Models.Metadata.DatItem>? other);
/// <summary>
/// Determine if an item is a duplicate using partial matching logic
/// </summary>

View File

@@ -83,36 +83,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -60,36 +60,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -251,36 +251,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -72,36 +72,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -54,36 +54,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -90,36 +90,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -78,36 +78,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -72,36 +72,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -89,36 +89,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -112,36 +112,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -126,36 +126,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -96,36 +96,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -119,36 +119,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -60,36 +60,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -72,36 +72,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -142,36 +142,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -89,36 +89,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -173,36 +173,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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).Equals((Data.Models.Metadata.Disk)otherDisk._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.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).Equals((Data.Models.Metadata.Disk)otherDisk._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{

View File

@@ -78,36 +78,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -167,36 +167,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -126,36 +126,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -60,36 +60,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -84,36 +84,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -166,20 +166,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? other)
{
// This isn't implemented, so always return false
return false;
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.DatItem>? other)
{
// This isn't implemented, so always return false
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{

View File

@@ -66,36 +66,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -108,36 +108,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -66,36 +66,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -118,36 +118,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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).Equals((Data.Models.Metadata.Media)otherMedia._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.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).Equals((Data.Models.Metadata.Media)otherMedia._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{

View File

@@ -118,36 +118,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -89,36 +89,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -78,36 +78,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -72,36 +72,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -84,36 +84,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -149,36 +149,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -905,36 +905,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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).Equals((Data.Models.Metadata.Rom)otherRom._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.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).Equals((Data.Models.Metadata.Rom)otherRom._internal);
// Everything else fails
return false;
}
/// <inheritdoc/>
public override bool Equals(DatItem? other)
{

View File

@@ -60,36 +60,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -138,36 +138,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -66,36 +66,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -78,36 +78,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -72,36 +72,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -78,36 +78,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -60,36 +60,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -198,36 +198,6 @@ namespace SabreTools.Metadata.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? 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(ModelBackedItem<Data.Models.Metadata.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? other)
{

View File

@@ -455,36 +455,6 @@ namespace SabreTools.Metadata.DatItems
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(ModelBackedItem? other)
{
// If other is null
if (other is null)
return false;
// If the type is mismatched
if (other is not Machine otherItem)
return false;
// Compare internal models
return _internal.Equals(otherItem._internal);
}
/// <inheritdoc/>
public override bool Equals(ModelBackedItem<Data.Models.Metadata.Machine>? other)
{
// If other is null
if (other is null)
return false;
// If the type is mismatched
if (other is not Machine otherItem)
return false;
// Compare internal models
return _internal.Equals(otherItem._internal);
}
/// <inheritdoc/>
public bool Equals(Machine? other)
{

View File

@@ -1,17 +1,10 @@
using System;
namespace SabreTools.Metadata
namespace SabreTools.Metadata
{
/// <summary>
/// Represents an item that's backed by a constructable item
/// </summary>
public abstract class ModelBackedItem : IEquatable<ModelBackedItem>
public abstract class ModelBackedItem
{
#region Comparision Methods
/// <inheritdoc/>
public abstract bool Equals(ModelBackedItem? other);
#endregion
// No common, untyped functionality
}
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
@@ -7,7 +6,7 @@ namespace SabreTools.Metadata
/// <summary>
/// Represents an item that's backed by a constructable item
/// </summary>
public abstract class ModelBackedItem<T> : ModelBackedItem, IEquatable<ModelBackedItem<T>> where T : new()
public abstract class ModelBackedItem<T> : ModelBackedItem where T : new()
{
/// <summary>
/// Internal model wrapped by this DatItem
@@ -23,12 +22,5 @@ namespace SabreTools.Metadata
}
#endregion
#region Comparision Methods
/// <inheritdoc/>
public abstract bool Equals(ModelBackedItem<T>? other);
#endregion
}
}