diff --git a/SabreTools.Metadata.DatItems/Formats/Blank.cs b/SabreTools.Metadata.DatItems/Formats/Blank.cs index e00521e7..abc7f6b7 100644 --- a/SabreTools.Metadata.DatItems/Formats/Blank.cs +++ b/SabreTools.Metadata.DatItems/Formats/Blank.cs @@ -1,5 +1,6 @@ using System.Xml.Serialization; using Newtonsoft.Json; +using SabreTools.Data.Extensions; namespace SabreTools.Metadata.DatItems.Formats { @@ -7,84 +8,26 @@ namespace SabreTools.Metadata.DatItems.Formats /// Represents a blank set from an input DAT /// [JsonObject("blank"), XmlRoot("blank")] - public sealed class Blank : DatItem + public sealed class Blank : DatItem { - #region Fields - - /// /> - public override Data.Models.Metadata.ItemType ItemType => Data.Models.Metadata.ItemType.Blank; - - #endregion - #region Constructors - /// - /// Create a default, empty Blank object - /// - public Blank() { } + public Blank() : base() { } + + public Blank(Data.Models.Metadata.Blank item) : base(item) { } + + public Blank(Data.Models.Metadata.Blank item, Machine machine, Source source) : this(item) + { + Write(SourceKey, source); + CopyMachineInformation(machine); + } #endregion #region Cloning Methods /// - public override object Clone() - { - var blank = new Blank(); - blank.Write(MachineKey, GetMachine()); - blank.Write(RemoveKey, ReadBool(RemoveKey)); - blank.Write(SourceKey, Read(SourceKey)); - - return blank; - } - - #endregion - - #region Comparision Methods - - /// - 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 DatItem otherItem) - return false; - - // Compare internal models - return Equals(otherItem); - } - - /// - 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 DatItem otherItem) - return false; - - // Compare internal models - return Equals(otherItem); - } - - /// - public override bool Equals(DatItem? other) - { - // If we don't have a blank, return false - if (ItemType != other?.ItemType) - return false; - - // Otherwise, treat it as a Blank - Blank? newOther = other as Blank; - - // If the machine information matches - return GetMachine() == newOther!.GetMachine(); - } + public override object Clone() => new Blank(_internal.Clone() as Data.Models.Metadata.Blank ?? []); #endregion }