From 26c4e1a93f437e759aa083e2caaf0193044aaf07 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 8 Jan 2019 17:40:12 -0800 Subject: [PATCH] [DatItems/] Clean these up a bit --- SabreTools.Library/DatItems/Archive.cs | 134 +++--- SabreTools.Library/DatItems/BiosSet.cs | 166 ++++---- SabreTools.Library/DatItems/Blank.cs | 134 +++--- SabreTools.Library/DatItems/Disk.cs | 396 +++++++++--------- SabreTools.Library/DatItems/Release.cs | 204 +++++----- SabreTools.Library/DatItems/Rom.cs | 542 +++++++++++++------------ SabreTools.Library/DatItems/Sample.cs | 134 +++--- 7 files changed, 857 insertions(+), 853 deletions(-) diff --git a/SabreTools.Library/DatItems/Archive.cs b/SabreTools.Library/DatItems/Archive.cs index 9f11fdfa..282fac00 100644 --- a/SabreTools.Library/DatItems/Archive.cs +++ b/SabreTools.Library/DatItems/Archive.cs @@ -2,84 +2,84 @@ namespace SabreTools.Library.DatItems { - /// - /// Represents generic archive files to be included in a set - /// - public class Archive : DatItem - { - #region Constructors + /// + /// Represents generic archive files to be included in a set + /// + public class Archive : DatItem + { + #region Constructors - /// - /// Create a default, empty Archive object - /// - public Archive() - { - _name = ""; - _itemType = ItemType.Archive; - } + /// + /// Create a default, empty Archive object + /// + public Archive() + { + this.Name = ""; + this.ItemType = ItemType.Archive; + } - #endregion + #endregion - #region Cloning Methods + #region Cloning Methods - public override object Clone() - { - return new Archive() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + public override object Clone() + { + return new Archive() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, - }; - } + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, + }; + } - #endregion + #endregion - #region Comparision Methods + #region Comparision Methods - public override bool Equals(DatItem other) - { - // If we don't have an archive, return false - if (_itemType != other.ItemType) - { - return false; - } + public override bool Equals(DatItem other) + { + // If we don't have an archive, return false + if (this.ItemType != other.ItemType) + { + return false; + } - // Otherwise, treat it as an archive - Archive newOther = (Archive)other; + // Otherwise, treat it as an archive + Archive newOther = (Archive)other; - // If the archive information matches - return (_name == newOther.Name); - } + // If the archive information matches + return (this.Name == newOther.Name); + } - #endregion - } + #endregion + } } diff --git a/SabreTools.Library/DatItems/BiosSet.cs b/SabreTools.Library/DatItems/BiosSet.cs index e7729d97..0d1bf0a8 100644 --- a/SabreTools.Library/DatItems/BiosSet.cs +++ b/SabreTools.Library/DatItems/BiosSet.cs @@ -2,109 +2,101 @@ namespace SabreTools.Library.DatItems { - /// - /// Represents which BIOS(es) is associated with a set - /// - public class BiosSet : DatItem - { - #region Private instance variables + /// + /// Represents which BIOS(es) is associated with a set + /// + public class BiosSet : DatItem + { + #region Publicly facing variables - private string _description; - private bool? _default; + /// + /// Description of the BIOS + /// + public string Description { get; set; } - #endregion + /// + /// Determine whether the BIOS is default + /// + public bool? Default { get; set; } - #region Publicly facing variables + #endregion - public string Description - { - get { return _description; } - set { _description = value; } - } - public bool? Default - { - get { return _default; } - set { _default = value; } - } + #region Constructors - #endregion + /// + /// Create a default, empty Sample object + /// + public BiosSet() + { + this.Name = ""; + this.ItemType = ItemType.BiosSet; + } - #region Constructors + #endregion - /// - /// Create a default, empty Sample object - /// - public BiosSet() - { - _name = ""; - _itemType = ItemType.BiosSet; - } + #region Cloning Methods - #endregion + public override object Clone() + { + return new BiosSet() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - #region Cloning Methods + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - public override object Clone() - { - return new BiosSet() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + Description = this.Description, + Default = this.Default, + }; + } - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, + #endregion - Description = this.Description, - Default = this.Default, - }; - } + #region Comparision Methods - #endregion + public override bool Equals(DatItem other) + { + // If we don't have a biosset, return false + if (this.ItemType != other.ItemType) + { + return false; + } - #region Comparision Methods + // Otherwise, treat it as a biosset + BiosSet newOther = (BiosSet)other; - public override bool Equals(DatItem other) - { - // If we don't have a biosset, return false - if (_itemType != other.ItemType) - { - return false; - } + // If the archive information matches + return (this.Name == newOther.Name && this.Description == newOther.Description && this.Default == newOther.Default); + } - // Otherwise, treat it as a biosset - BiosSet newOther = (BiosSet)other; - - // If the archive information matches - return (_name == newOther.Name && _description == newOther.Description && _default == newOther.Default); - } - - #endregion - } + #endregion + } } diff --git a/SabreTools.Library/DatItems/Blank.cs b/SabreTools.Library/DatItems/Blank.cs index 7e4b8277..f36eff4d 100644 --- a/SabreTools.Library/DatItems/Blank.cs +++ b/SabreTools.Library/DatItems/Blank.cs @@ -2,84 +2,84 @@ namespace SabreTools.Library.DatItems { - /// - /// Represents a blank set from an input DAT - /// - public class Blank : DatItem - { - #region Constructors + /// + /// Represents a blank set from an input DAT + /// + public class Blank : DatItem + { + #region Constructors - /// - /// Create a default, empty Archive object - /// - public Blank() - { - _name = ""; - _itemType = ItemType.Blank; - } + /// + /// Create a default, empty Archive object + /// + public Blank() + { + this.Name = ""; + this.ItemType = ItemType.Blank; + } - #endregion + #endregion - #region Cloning Methods + #region Cloning Methods - public override object Clone() - { - return new Blank() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + public override object Clone() + { + return new Blank() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, - }; - } + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, + }; + } - #endregion + #endregion - #region Comparision Methods + #region Comparision Methods - public override bool Equals(DatItem other) - { - // If we don't have a blank, return false - if (_itemType != other.ItemType) - { - return false; - } + public override bool Equals(DatItem other) + { + // If we don't have a blank, return false + if (this.ItemType != other.ItemType) + { + return false; + } - // Otherwise, treat it as a - Blank newOther = (Blank)other; + // Otherwise, treat it as a + Blank newOther = (Blank)other; - // If the archive information matches - return (_machine == newOther._machine); - } + // If the archive information matches + return (_machine == newOther._machine); + } - #endregion - } + #endregion + } } diff --git a/SabreTools.Library/DatItems/Disk.cs b/SabreTools.Library/DatItems/Disk.cs index 1d51bb72..a62b20a2 100644 --- a/SabreTools.Library/DatItems/Disk.cs +++ b/SabreTools.Library/DatItems/Disk.cs @@ -1,227 +1,237 @@ using System.Linq; - using SabreTools.Library.Data; using SabreTools.Library.FileTypes; using SabreTools.Library.Tools; namespace SabreTools.Library.DatItems { - /// - /// Represents Compressed Hunks of Data (CHD) formatted disks which use internal hashes - /// - public class Disk : DatItem - { - #region Private instance variables + /// + /// Represents Compressed Hunks of Data (CHD) formatted disks which use internal hashes + /// + public class Disk : DatItem + { + #region Private instance variables - // Disk information - private byte[] _md5; // 16 bytes - private byte[] _sha1; // 20 bytes - private byte[] _sha256; // 32 bytes - private byte[] _sha384; // 48 bytes - private byte[] _sha512; // 64 bytes - private string _merge; - private string _region; - private string _index; - private bool? _writable; - private ItemStatus _itemStatus; - private bool? _optional; + private byte[] _md5; // 16 bytes + private byte[] _sha1; // 20 bytes + private byte[] _sha256; // 32 bytes + private byte[] _sha384; // 48 bytes + private byte[] _sha512; // 64 bytes - #endregion + #endregion - #region Publicly facing variables + #region Publicly facing variables - // Disk information - public string MD5 - { - get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); } - set { _md5 = Utilities.StringToByteArray(value); } - } - public string SHA1 - { - get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); } - set { _sha1 = Utilities.StringToByteArray(value); } - } - public string SHA256 - { - get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); } - set { _sha256 = Utilities.StringToByteArray(value); } - } - public string SHA384 - { - get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); } - set { _sha384 = Utilities.StringToByteArray(value); } - } - public string SHA512 - { - get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); } - set { _sha512 = Utilities.StringToByteArray(value); } - } - public string MergeTag - { - get { return _merge; } - set { _merge = value; } - } - public string Region - { - get { return _region; } - set { _region = value; } - } - public string Index - { - get { return _index; } - set { _index = value; } - } - public bool? Writable - { - get { return _writable; } - set { _writable = value; } - } - public ItemStatus ItemStatus - { - get { return _itemStatus; } - set { _itemStatus = value; } - } - public bool? Optional - { - get { return _optional; } - set { _optional = value; } - } + /// + /// Data MD5 hash + /// + public string MD5 + { + get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); } + set { _md5 = Utilities.StringToByteArray(value); } + } - #endregion + /// + /// Data SHA-1 hash + /// + public string SHA1 + { + get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); } + set { _sha1 = Utilities.StringToByteArray(value); } + } - #region Constructors + /// + /// Data SHA-256 hash + /// + public string SHA256 + { + get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); } + set { _sha256 = Utilities.StringToByteArray(value); } + } - /// - /// Create a default, empty Disk object - /// - public Disk() - { - _name = ""; - _itemType = ItemType.Disk; - _dupeType = 0x00; - _itemStatus = ItemStatus.None; - } + /// + /// Data SHA-384 hash + /// + public string SHA384 + { + get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); } + set { _sha384 = Utilities.StringToByteArray(value); } + } - /// - /// Create a Rom object from a BaseFile - /// - /// - public Disk(BaseFile baseFile) - { - _name = baseFile.Filename; - _md5 = baseFile.MD5; - _sha1 = baseFile.SHA1; - _sha256 = baseFile.SHA256; - _sha384 = baseFile.SHA384; - _sha512 = baseFile.SHA512; + /// + /// Data SHA-512 hash + /// + public string SHA512 + { + get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); } + set { _sha512 = Utilities.StringToByteArray(value); } + } - _itemType = ItemType.Disk; - _dupeType = 0x00; - _itemStatus = ItemStatus.None; - } + /// + /// Disk name to merge from parent + /// + public string MergeTag { get; set; } - #endregion + /// + /// Disk region + /// + public string Region { get; set; } - #region Cloning Methods + /// + /// Disk index + /// + public string Index { get; set; } - public override object Clone() - { - return new Disk() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + /// + /// Disk writable flag + /// + public bool? Writable { get; set; } - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + /// + /// Disk dump status + /// + public ItemStatus ItemStatus { get; set; } - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + /// + /// Determine if the disk is optional in the set + /// + public bool? Optional { get; set; } - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, + #endregion - _md5 = this._md5, - _sha1 = this._sha1, - _sha256 = this._sha256, - _sha384 = this._sha384, - _sha512 = this._sha512, - ItemStatus = this.ItemStatus, - }; - } + #region Constructors - #endregion + /// + /// Create a default, empty Disk object + /// + public Disk() + { + this.Name = ""; + this.ItemType = ItemType.Disk; + this.DupeType = 0x00; + this.ItemStatus = ItemStatus.None; + } - #region Comparision Methods + /// + /// Create a Rom object from a BaseFile + /// + /// + public Disk(BaseFile baseFile) + { + this.Name = baseFile.Filename; + _md5 = baseFile.MD5; + _sha1 = baseFile.SHA1; + _sha256 = baseFile.SHA256; + _sha384 = baseFile.SHA384; + _sha512 = baseFile.SHA512; - public override bool Equals(DatItem other) - { - bool dupefound = false; + this.ItemType = ItemType.Disk; + this.DupeType = 0x00; + this.ItemStatus = ItemStatus.None; + } - // If we don't have a rom, return false - if (_itemType != other.ItemType) - { - return dupefound; - } + #endregion - // Otherwise, treat it as a rom - Disk newOther = (Disk)other; + #region Cloning Methods - // If all hashes are empty but they're both nodump and the names match, then they're dupes - if ((this._itemStatus == ItemStatus.Nodump && newOther._itemStatus == ItemStatus.Nodump) - && (this._name == newOther._name) - && (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace()) - && (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace()) - && (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace()) - && (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace()) - && (this._sha512.IsNullOrWhiteSpace() && newOther._sha512.IsNullOrWhiteSpace())) - { - dupefound = true; - } + public override object Clone() + { + return new Disk() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - // If we can determine that the disks have no non-empty hashes in common, we return false - else if ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) - && (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) - && (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) - && (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) - && (this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace())) - { - dupefound = false; - } + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - // Otherwise if we get a partial match - else if (((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) - && ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) - && ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) - && ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) - && ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) - { - dupefound = true; - } + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - return dupefound; - } + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, - #endregion - } + _md5 = this._md5, + _sha1 = this._sha1, + _sha256 = this._sha256, + _sha384 = this._sha384, + _sha512 = this._sha512, + ItemStatus = this.ItemStatus, + }; + } + + #endregion + + #region Comparision Methods + + public override bool Equals(DatItem other) + { + bool dupefound = false; + + // If we don't have a rom, return false + if (this.ItemType != other.ItemType) + { + return dupefound; + } + + // Otherwise, treat it as a rom + Disk newOther = (Disk)other; + + // If all hashes are empty but they're both nodump and the names match, then they're dupes + if ((this.ItemStatus == ItemStatus.Nodump && newOther.ItemStatus == ItemStatus.Nodump) + && (this.Name == newOther.Name) + && (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace()) + && (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace()) + && (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace()) + && (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace()) + && (this._sha512.IsNullOrWhiteSpace() && newOther._sha512.IsNullOrWhiteSpace())) + { + dupefound = true; + } + + // If we can determine that the disks have no non-empty hashes in common, we return false + else if ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) + && (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) + && (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) + && (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) + && (this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace())) + { + dupefound = false; + } + + // Otherwise if we get a partial match + else if (((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) + && ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) + && ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) + && ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) + && ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) + { + dupefound = true; + } + + return dupefound; + } + + #endregion + } } diff --git a/SabreTools.Library/DatItems/Release.cs b/SabreTools.Library/DatItems/Release.cs index e02b7c6e..7b947eb4 100644 --- a/SabreTools.Library/DatItems/Release.cs +++ b/SabreTools.Library/DatItems/Release.cs @@ -2,131 +2,121 @@ namespace SabreTools.Library.DatItems { - /// - /// Represents release information about a set - /// - public class Release : DatItem - { - #region Private instance variables + /// + /// Represents release information about a set + /// + public class Release : DatItem + { + #region Publicly facing variables - private string _region; - private string _language; - private string _date; - private bool? _default; + /// + /// Release region(s) + /// + public string Region { get; set; } - #endregion + /// + /// Release language(s) + /// + public string Language { get; set; } - #region Publicly facing variables + /// + /// Date of release + /// + public string Date { get; set; } - public string Region - { - get { return _region; } - set { _region = value; } - } - public string Language - { - get { return _language; } - set { _language = value; } - } - public string Date - { - get { return _date; } - set { _date = value; } - } - public bool? Default - { - get { return _default; } - set { _default = value; } - } + /// + /// Default release, if applicable + /// + public bool? Default { get; set; } - #endregion + #endregion - #region Constructors + #region Constructors - /// - /// Create a default, empty Release object - /// - public Release() - { - _name = ""; - _itemType = ItemType.Release; - _region = ""; - _language = ""; - _date = ""; - _default = null; - } + /// + /// Create a default, empty Release object + /// + public Release() + { + this.Name = ""; + this.ItemType = ItemType.Release; + this.Region = ""; + this.Language = ""; + this.Date = ""; + this.Default = null; + } - #endregion + #endregion - #region Cloning Methods + #region Cloning Methods - public override object Clone() - { - return new Release() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + public override object Clone() + { + return new Release() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, - Region = this.Region, - Language = this.Language, - Date = this.Date, - Default = this.Default, - }; - } + Region = this.Region, + Language = this.Language, + Date = this.Date, + Default = this.Default, + }; + } - #endregion + #endregion - #region Comparision Methods + #region Comparision Methods - public override bool Equals(DatItem other) - { - // If we don't have a release return false - if (_itemType != other.ItemType) - { - return false; - } + public override bool Equals(DatItem other) + { + // If we don't have a release return false + if (this.ItemType != other.ItemType) + { + return false; + } - // Otherwise, treat it as a reease - Release newOther = (Release)other; + // Otherwise, treat it as a reease + Release newOther = (Release)other; - // If the archive information matches - return (_name == newOther.Name - && _region == newOther.Region - && _language == newOther.Language - && _date == newOther.Date - && _default == newOther.Default); - } + // If the archive information matches + return (this.Name == newOther.Name + && this.Region == newOther.Region + && this.Language == newOther.Language + && this.Date == newOther.Date + && this.Default == newOther.Default); + } - #endregion - } + #endregion + } } diff --git a/SabreTools.Library/DatItems/Rom.cs b/SabreTools.Library/DatItems/Rom.cs index ba39dd78..66fa4727 100644 --- a/SabreTools.Library/DatItems/Rom.cs +++ b/SabreTools.Library/DatItems/Rom.cs @@ -1,301 +1,313 @@ using System.Linq; - using SabreTools.Library.Data; using SabreTools.Library.FileTypes; using SabreTools.Library.Tools; namespace SabreTools.Library.DatItems { - /// - /// Represents a generic file within a set - /// - public class Rom : DatItem - { - #region Private instance variables + /// + /// Represents a generic file within a set + /// + public class Rom : DatItem + { + #region Private instance variables - // Rom information - private string _bios; - private long _size; - private byte[] _crc; // 8 bytes - private byte[] _md5; // 16 bytes - private byte[] _sha1; // 20 bytes - private byte[] _sha256; // 32 bytes - private byte[] _sha384; // 48 bytes - private byte[] _sha512; // 64 bytes - private string _merge; - private string _region; - private string _offset; - private string _date; - private ItemStatus _itemStatus; - private bool? _optional; + private byte[] _crc; // 8 bytes + private byte[] _md5; // 16 bytes + private byte[] _sha1; // 20 bytes + private byte[] _sha256; // 32 bytes + private byte[] _sha384; // 48 bytes + private byte[] _sha512; // 64 bytes - #endregion + #endregion - #region Publicly facing variables + #region Publicly facing variables - // Rom information - public string Bios - { - get { return _bios; } - set { _bios = value; } - } - public long Size - { - get { return _size; } - set { _size = value; } - } - public string CRC - { - get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); } - set { _crc = (value == "null" ? Constants.CRCZeroBytes : Utilities.StringToByteArray(value)); } - } - public string MD5 - { - get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); } - set { _md5 = (value == "null" ? Constants.MD5ZeroBytes : Utilities.StringToByteArray(value)); } - } - public string SHA1 - { - get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); } - set { _sha1 = (value == "null" ? Constants.SHA1ZeroBytes : Utilities.StringToByteArray(value)); } - } - public string SHA256 - { - get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); } - set { _sha256 = (value == "null" ? Constants.SHA256ZeroBytes : Utilities.StringToByteArray(value)); } - } - public string SHA384 - { - get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); } - set { _sha384 = (value == "null" ? Constants.SHA384ZeroBytes : Utilities.StringToByteArray(value)); } - } - public string SHA512 - { - get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); } - set { _sha512 = (value == "null" ? Constants.SHA512ZeroBytes : Utilities.StringToByteArray(value)); } - } - public string MergeTag - { - get { return _merge; } - set { _merge = value; } - } - public string Region - { - get { return _region; } - set { _region = value; } - } - public string Offset - { - get { return _offset; } - set { _offset = value; } - } - public string Date - { - get { return _date; } - set { _date = value; } - } - public ItemStatus ItemStatus - { - get { return _itemStatus; } - set { _itemStatus = value; } - } - public bool? Optional - { - get { return _optional; } - set { _optional = value; } - } + /// + /// What BIOS is required for this rom + /// + public string Bios { get; set; } - #endregion + /// + /// Byte size of the rom + /// + public long Size { get; set; } - #region Constructors + /// + /// File CRC32 hash + /// + public string CRC + { + get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); } + set { _crc = (value == "null" ? Constants.CRCZeroBytes : Utilities.StringToByteArray(value)); } + } - /// - /// Create a default, empty Rom object - /// - public Rom() - { - _name = ""; - _itemType = ItemType.Rom; - _dupeType = 0x00; - _itemStatus = ItemStatus.None; - _date = ""; - } + /// + /// File MD5 hash + /// + public string MD5 + { + get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); } + set { _md5 = Utilities.StringToByteArray(value); } + } - /// - /// Create a "blank" Rom object - /// - /// - /// - /// - /// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually - public Rom(string name, string machineName, Hash omitFromScan = Hash.DeepHashes) - { - _name = name; - _itemType = ItemType.Rom; - _size = -1; - if ((omitFromScan & Hash.CRC) == 0) - { - _crc = null; - } - if ((omitFromScan & Hash.MD5) == 0) - { - _md5 = null; - } - if ((omitFromScan & Hash.SHA1) == 0) - { - _sha1 = null; - } - if ((omitFromScan & Hash.SHA256) == 0) - { - _sha256 = null; - } - if ((omitFromScan & Hash.SHA384) == 0) - { - _sha384 = null; - } - if ((omitFromScan & Hash.SHA512) == 0) - { - _sha512 = null; - } - _itemStatus = ItemStatus.None; + /// + /// File SHA-1 hash + /// + public string SHA1 + { + get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); } + set { _sha1 = Utilities.StringToByteArray(value); } + } - _machine = new Machine - { - Name = machineName, - Description = machineName, - }; - } + /// + /// File SHA-256 hash + /// + public string SHA256 + { + get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); } + set { _sha256 = Utilities.StringToByteArray(value); } + } - /// - /// Create a Rom object from a BaseFile - /// - /// - public Rom(BaseFile baseFile) - { - _name = baseFile.Filename; - _size = baseFile.Size ?? -1; - _crc = baseFile.CRC; - _md5 = baseFile.MD5; - _sha1 = baseFile.SHA1; - _sha256 = baseFile.SHA256; - _sha384 = baseFile.SHA384; - _sha512 = baseFile.SHA512; + /// + /// File SHA-384 hash + /// + public string SHA384 + { + get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); } + set { _sha384 = Utilities.StringToByteArray(value); } + } - _itemType = ItemType.Rom; - _dupeType = 0x00; - _itemStatus = ItemStatus.None; - _date = baseFile.Date; - } + /// + /// File SHA-512 hash + /// + public string SHA512 + { + get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); } + set { _sha512 = Utilities.StringToByteArray(value); } + } - #endregion + /// + /// Rom name to merge from parent + /// + public string MergeTag { get; set; } - #region Cloning Methods + /// + /// Rom region + /// + public string Region { get; set; } - public override object Clone() - { - return new Rom() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + /// + /// Data offset within rom + /// + public string Offset { get; set; } - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + /// + /// File created date + /// + public string Date { get; set; } - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + /// + /// Rom dump status + /// + public ItemStatus ItemStatus { get; set; } - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, + /// + /// Determine if the rom is optional in the set + /// + public bool? Optional { get; set; } - Size = this.Size, - _crc = this._crc, - _md5 = this._md5, - _sha1 = this._sha1, - _sha256 = this._sha256, - _sha384 = this._sha384, - _sha512 = this._sha512, - ItemStatus = this.ItemStatus, - Date = this.Date, - }; - } + #endregion - #endregion + #region Constructors - #region Comparision Methods + /// + /// Create a default, empty Rom object + /// + public Rom() + { + this.Name = ""; + this.ItemType = ItemType.Rom; + this.DupeType = 0x00; + this.ItemStatus = ItemStatus.None; + this.Date = ""; + } - public override bool Equals(DatItem other) - { - bool dupefound = false; + /// + /// Create a "blank" Rom object + /// + /// + /// + /// + /// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually + public Rom(string name, string machineName, Hash omitFromScan = Hash.DeepHashes) + { + this.Name = name; + this.ItemType = ItemType.Rom; + this.Size = -1; + if ((omitFromScan & Hash.CRC) == 0) + { + _crc = null; + } + if ((omitFromScan & Hash.MD5) == 0) + { + _md5 = null; + } + if ((omitFromScan & Hash.SHA1) == 0) + { + _sha1 = null; + } + if ((omitFromScan & Hash.SHA256) == 0) + { + _sha256 = null; + } + if ((omitFromScan & Hash.SHA384) == 0) + { + _sha384 = null; + } + if ((omitFromScan & Hash.SHA512) == 0) + { + _sha512 = null; + } + this.ItemStatus = ItemStatus.None; - // If we don't have a rom, return false - if (_itemType != other.ItemType) - { - return dupefound; - } + _machine = new Machine + { + Name = machineName, + Description = machineName, + }; + } - // Otherwise, treat it as a rom - Rom newOther = (Rom)other; + /// + /// Create a Rom object from a BaseFile + /// + /// + public Rom(BaseFile baseFile) + { + this.Name = baseFile.Filename; + this.Size = baseFile.Size ?? -1; + _crc = baseFile.CRC; + _md5 = baseFile.MD5; + _sha1 = baseFile.SHA1; + _sha256 = baseFile.SHA256; + _sha384 = baseFile.SHA384; + _sha512 = baseFile.SHA512; - // If all hashes are empty but they're both nodump and the names match, then they're dupes - if ((this._itemStatus == ItemStatus.Nodump && newOther._itemStatus == ItemStatus.Nodump) - && (this._name == newOther._name) - && (this._crc.IsNullOrWhiteSpace() && newOther._crc.IsNullOrWhiteSpace()) - && (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace()) - && (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace()) - && (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace()) - && (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace()) - && (this._sha512.IsNullOrWhiteSpace() && newOther._sha512.IsNullOrWhiteSpace())) - { - dupefound = true; - } + this.ItemType = ItemType.Rom; + this.DupeType = 0x00; + this.ItemStatus = ItemStatus.None; + this.Date = baseFile.Date; + } - // If we can determine that the roms have no non-empty hashes in common, we return false - else if ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) - && (this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) - && (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) - && (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) - && (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) - && (this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace())) - { - dupefound = false; - } + #endregion - // Otherwise if we get a partial match - else if ((this.Size == newOther.Size) - && ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc)) - && ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) - && ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) - && ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) - && ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) - && ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) - { - dupefound = true; - } + #region Cloning Methods - return dupefound; - } + public override object Clone() + { + return new Rom() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - #endregion - } + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, + + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, + + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, + + Size = this.Size, + _crc = this._crc, + _md5 = this._md5, + _sha1 = this._sha1, + _sha256 = this._sha256, + _sha384 = this._sha384, + _sha512 = this._sha512, + ItemStatus = this.ItemStatus, + Date = this.Date, + }; + } + + #endregion + + #region Comparision Methods + + public override bool Equals(DatItem other) + { + bool dupefound = false; + + // If we don't have a rom, return false + if (this.ItemType != other.ItemType) + { + return dupefound; + } + + // Otherwise, treat it as a rom + Rom newOther = (Rom)other; + + // If all hashes are empty but they're both nodump and the names match, then they're dupes + if ((this.ItemStatus == ItemStatus.Nodump && newOther.ItemStatus == ItemStatus.Nodump) + && (this.Name == newOther.Name) + && (this._crc.IsNullOrWhiteSpace() && newOther._crc.IsNullOrWhiteSpace()) + && (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace()) + && (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace()) + && (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace()) + && (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace()) + && (this._sha512.IsNullOrWhiteSpace() && newOther._sha512.IsNullOrWhiteSpace())) + { + dupefound = true; + } + + // If we can determine that the roms have no non-empty hashes in common, we return false + else if ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) + && (this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) + && (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) + && (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) + && (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) + && (this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace())) + { + dupefound = false; + } + + // Otherwise if we get a partial match + else if ((this.Size == newOther.Size) + && ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc)) + && ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) + && ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) + && ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) + && ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) + && ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) + { + dupefound = true; + } + + return dupefound; + } + + #endregion + } } diff --git a/SabreTools.Library/DatItems/Sample.cs b/SabreTools.Library/DatItems/Sample.cs index 2dc4a7a2..0d2c68a5 100644 --- a/SabreTools.Library/DatItems/Sample.cs +++ b/SabreTools.Library/DatItems/Sample.cs @@ -2,84 +2,84 @@ namespace SabreTools.Library.DatItems { - /// - /// Represents a (usually WAV-formatted) sample to be included for use in the set - /// - public class Sample : DatItem - { - #region Constructors + /// + /// Represents a (usually WAV-formatted) sample to be included for use in the set + /// + public class Sample : DatItem + { + #region Constructors - /// - /// Create a default, empty Sample object - /// - public Sample() - { - _name = ""; - _itemType = ItemType.Sample; - } + /// + /// Create a default, empty Sample object + /// + public Sample() + { + this.Name = ""; + this.ItemType = ItemType.Sample; + } - #endregion + #endregion - #region Cloning Methods + #region Cloning Methods - public override object Clone() - { - return new Sample() - { - Name = this.Name, - ItemType = this.ItemType, - DupeType = this.DupeType, + public override object Clone() + { + return new Sample() + { + Name = this.Name, + ItemType = this.ItemType, + DupeType = this.DupeType, - Supported = this.Supported, - Publisher = this.Publisher, - Infos = this.Infos, - PartName = this.PartName, - PartInterface = this.PartInterface, - Features = this.Features, - AreaName = this.AreaName, - AreaSize = this.AreaSize, + Supported = this.Supported, + Publisher = this.Publisher, + Infos = this.Infos, + PartName = this.PartName, + PartInterface = this.PartInterface, + Features = this.Features, + AreaName = this.AreaName, + AreaSize = this.AreaSize, - MachineName = this.MachineName, - Comment = this.Comment, - MachineDescription = this.MachineDescription, - Year = this.Year, - Manufacturer = this.Manufacturer, - RomOf = this.RomOf, - CloneOf = this.CloneOf, - SampleOf = this.SampleOf, - SourceFile = this.SourceFile, - Runnable = this.Runnable, - Board = this.Board, - RebuildTo = this.RebuildTo, - Devices = this.Devices, - MachineType = this.MachineType, + MachineName = this.MachineName, + Comment = this.Comment, + MachineDescription = this.MachineDescription, + Year = this.Year, + Manufacturer = this.Manufacturer, + RomOf = this.RomOf, + CloneOf = this.CloneOf, + SampleOf = this.SampleOf, + SourceFile = this.SourceFile, + Runnable = this.Runnable, + Board = this.Board, + RebuildTo = this.RebuildTo, + Devices = this.Devices, + MachineType = this.MachineType, - SystemID = this.SystemID, - System = this.System, - SourceID = this.SourceID, - Source = this.Source, - }; - } + SystemID = this.SystemID, + System = this.System, + SourceID = this.SourceID, + Source = this.Source, + }; + } - #endregion + #endregion - #region Comparision Methods + #region Comparision Methods - public override bool Equals(DatItem other) - { - // If we don't have a sample, return false - if (_itemType != other.ItemType) - { - return false; - } + public override bool Equals(DatItem other) + { + // If we don't have a sample, return false + if (this.ItemType != other.ItemType) + { + return false; + } - // Otherwise, treat it as a sample - Sample newOther = (Sample)other; + // Otherwise, treat it as a sample + Sample newOther = (Sample)other; - // If the archive information matches - return (_name == newOther.Name); - } + // If the archive information matches + return (this.Name == newOther.Name); + } - #endregion - } + #endregion + } }