Add nullable context to SabreTools.DatItems

This change also starts migrating the internals of the DatItem formats to the new internal models. Right now, it's basically just acting like a wrapper around those models.
This commit is contained in:
Matt Nadareski
2023-08-14 13:17:51 -04:00
parent 1752b1a0ac
commit b37aed389e
87 changed files with 3266 additions and 2199 deletions

View File

@@ -32,8 +32,8 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine.Clone() as Machine,
Source = this.Source.Clone() as Source,
Machine = this.Machine?.Clone() as Machine,
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
};
}
@@ -43,17 +43,17 @@ namespace SabreTools.DatItems.Formats
#region Comparision Methods
/// <inheritdoc/>
public override bool Equals(DatItem other)
public override bool Equals(DatItem? other)
{
// If we don't have a blank, return false
if (ItemType != other.ItemType)
if (ItemType != other?.ItemType)
return false;
// Otherwise, treat it as a Blank
Blank newOther = other as Blank;
Blank? newOther = other as Blank;
// If the archive information matches
return (Machine == newOther.Machine);
return (Machine == newOther!.Machine);
}
#endregion