[DatItems/] Clean these up a bit

This commit is contained in:
Matt Nadareski
2019-01-08 17:40:12 -08:00
parent 1768370199
commit 26c4e1a93f
7 changed files with 857 additions and 853 deletions

View File

@@ -2,84 +2,84 @@
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents generic archive files to be included in a set /// Represents generic archive files to be included in a set
/// </summary> /// </summary>
public class Archive : DatItem public class Archive : DatItem
{ {
#region Constructors #region Constructors
/// <summary> /// <summary>
/// Create a default, empty Archive object /// Create a default, empty Archive object
/// </summary> /// </summary>
public Archive() public Archive()
{ {
_name = ""; this.Name = "";
_itemType = ItemType.Archive; this.ItemType = ItemType.Archive;
} }
#endregion #endregion
#region Cloning Methods #region Cloning Methods
public override object Clone() public override object Clone()
{ {
return new Archive() return new Archive()
{ {
Name = this.Name, Name = this.Name,
ItemType = this.ItemType, ItemType = this.ItemType,
DupeType = this.DupeType, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
Infos = this.Infos, Infos = this.Infos,
PartName = this.PartName, PartName = this.PartName,
PartInterface = this.PartInterface, PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,
MachineName = this.MachineName, MachineName = this.MachineName,
Comment = this.Comment, Comment = this.Comment,
MachineDescription = this.MachineDescription, MachineDescription = this.MachineDescription,
Year = this.Year, Year = this.Year,
Manufacturer = this.Manufacturer, Manufacturer = this.Manufacturer,
RomOf = this.RomOf, RomOf = this.RomOf,
CloneOf = this.CloneOf, CloneOf = this.CloneOf,
SampleOf = this.SampleOf, SampleOf = this.SampleOf,
SourceFile = this.SourceFile, SourceFile = this.SourceFile,
Runnable = this.Runnable, Runnable = this.Runnable,
Board = this.Board, Board = this.Board,
RebuildTo = this.RebuildTo, RebuildTo = this.RebuildTo,
Devices = this.Devices, Devices = this.Devices,
MachineType = this.MachineType, MachineType = this.MachineType,
SystemID = this.SystemID, SystemID = this.SystemID,
System = this.System, System = this.System,
SourceID = this.SourceID, SourceID = this.SourceID,
Source = this.Source, Source = this.Source,
}; };
} }
#endregion #endregion
#region Comparision Methods #region Comparision Methods
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have an archive, return false // If we don't have an archive, return false
if (_itemType != other.ItemType) if (this.ItemType != other.ItemType)
{ {
return false; return false;
} }
// Otherwise, treat it as an archive // Otherwise, treat it as an archive
Archive newOther = (Archive)other; Archive newOther = (Archive)other;
// If the archive information matches // If the archive information matches
return (_name == newOther.Name); return (this.Name == newOther.Name);
} }
#endregion #endregion
} }
} }

View File

@@ -2,109 +2,101 @@
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents which BIOS(es) is associated with a set /// Represents which BIOS(es) is associated with a set
/// </summary> /// </summary>
public class BiosSet : DatItem public class BiosSet : DatItem
{ {
#region Private instance variables #region Publicly facing variables
private string _description; /// <summary>
private bool? _default; /// Description of the BIOS
/// </summary>
public string Description { get; set; }
#endregion /// <summary>
/// Determine whether the BIOS is default
/// </summary>
public bool? Default { get; set; }
#region Publicly facing variables #endregion
public string Description #region Constructors
{
get { return _description; }
set { _description = value; }
}
public bool? Default
{
get { return _default; }
set { _default = value; }
}
#endregion /// <summary>
/// Create a default, empty Sample object
/// </summary>
public BiosSet()
{
this.Name = "";
this.ItemType = ItemType.BiosSet;
}
#region Constructors #endregion
/// <summary> #region Cloning Methods
/// Create a default, empty Sample object
/// </summary>
public BiosSet()
{
_name = "";
_itemType = ItemType.BiosSet;
}
#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() MachineName = this.MachineName,
{ Comment = this.Comment,
return new BiosSet() MachineDescription = this.MachineDescription,
{ Year = this.Year,
Name = this.Name, Manufacturer = this.Manufacturer,
ItemType = this.ItemType, RomOf = this.RomOf,
DupeType = this.DupeType, 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, SystemID = this.SystemID,
Publisher = this.Publisher, System = this.System,
Infos = this.Infos, SourceID = this.SourceID,
PartName = this.PartName, Source = this.Source,
PartInterface = this.PartInterface,
Features = this.Features,
AreaName = this.AreaName,
AreaSize = this.AreaSize,
MachineName = this.MachineName, Description = this.Description,
Comment = this.Comment, Default = this.Default,
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, #endregion
System = this.System,
SourceID = this.SourceID,
Source = this.Source,
Description = this.Description, #region Comparision Methods
Default = this.Default,
};
}
#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 the archive information matches
{ return (this.Name == newOther.Name && this.Description == newOther.Description && this.Default == newOther.Default);
// If we don't have a biosset, return false }
if (_itemType != other.ItemType)
{
return false;
}
// Otherwise, treat it as a biosset #endregion
BiosSet newOther = (BiosSet)other; }
// If the archive information matches
return (_name == newOther.Name && _description == newOther.Description && _default == newOther.Default);
}
#endregion
}
} }

View File

@@ -2,84 +2,84 @@
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents a blank set from an input DAT /// Represents a blank set from an input DAT
/// </summary> /// </summary>
public class Blank : DatItem public class Blank : DatItem
{ {
#region Constructors #region Constructors
/// <summary> /// <summary>
/// Create a default, empty Archive object /// Create a default, empty Archive object
/// </summary> /// </summary>
public Blank() public Blank()
{ {
_name = ""; this.Name = "";
_itemType = ItemType.Blank; this.ItemType = ItemType.Blank;
} }
#endregion #endregion
#region Cloning Methods #region Cloning Methods
public override object Clone() public override object Clone()
{ {
return new Blank() return new Blank()
{ {
Name = this.Name, Name = this.Name,
ItemType = this.ItemType, ItemType = this.ItemType,
DupeType = this.DupeType, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
Infos = this.Infos, Infos = this.Infos,
PartName = this.PartName, PartName = this.PartName,
PartInterface = this.PartInterface, PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,
MachineName = this.MachineName, MachineName = this.MachineName,
Comment = this.Comment, Comment = this.Comment,
MachineDescription = this.MachineDescription, MachineDescription = this.MachineDescription,
Year = this.Year, Year = this.Year,
Manufacturer = this.Manufacturer, Manufacturer = this.Manufacturer,
RomOf = this.RomOf, RomOf = this.RomOf,
CloneOf = this.CloneOf, CloneOf = this.CloneOf,
SampleOf = this.SampleOf, SampleOf = this.SampleOf,
SourceFile = this.SourceFile, SourceFile = this.SourceFile,
Runnable = this.Runnable, Runnable = this.Runnable,
Board = this.Board, Board = this.Board,
RebuildTo = this.RebuildTo, RebuildTo = this.RebuildTo,
Devices = this.Devices, Devices = this.Devices,
MachineType = this.MachineType, MachineType = this.MachineType,
SystemID = this.SystemID, SystemID = this.SystemID,
System = this.System, System = this.System,
SourceID = this.SourceID, SourceID = this.SourceID,
Source = this.Source, Source = this.Source,
}; };
} }
#endregion #endregion
#region Comparision Methods #region Comparision Methods
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a blank, return false // If we don't have a blank, return false
if (_itemType != other.ItemType) if (this.ItemType != other.ItemType)
{ {
return false; return false;
} }
// Otherwise, treat it as a // Otherwise, treat it as a
Blank newOther = (Blank)other; Blank newOther = (Blank)other;
// If the archive information matches // If the archive information matches
return (_machine == newOther._machine); return (_machine == newOther._machine);
} }
#endregion #endregion
} }
} }

View File

@@ -1,227 +1,237 @@
using System.Linq; using System.Linq;
using SabreTools.Library.Data; using SabreTools.Library.Data;
using SabreTools.Library.FileTypes; using SabreTools.Library.FileTypes;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents Compressed Hunks of Data (CHD) formatted disks which use internal hashes /// Represents Compressed Hunks of Data (CHD) formatted disks which use internal hashes
/// </summary> /// </summary>
public class Disk : DatItem public class Disk : DatItem
{ {
#region Private instance variables #region Private instance variables
// Disk information private byte[] _md5; // 16 bytes
private byte[] _md5; // 16 bytes private byte[] _sha1; // 20 bytes
private byte[] _sha1; // 20 bytes private byte[] _sha256; // 32 bytes
private byte[] _sha256; // 32 bytes private byte[] _sha384; // 48 bytes
private byte[] _sha384; // 48 bytes private byte[] _sha512; // 64 bytes
private byte[] _sha512; // 64 bytes
private string _merge;
private string _region;
private string _index;
private bool? _writable;
private ItemStatus _itemStatus;
private bool? _optional;
#endregion #endregion
#region Publicly facing variables #region Publicly facing variables
// Disk information /// <summary>
public string MD5 /// Data MD5 hash
{ /// </summary>
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); } public string MD5
set { _md5 = Utilities.StringToByteArray(value); } {
} get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
public string SHA1 set { _md5 = Utilities.StringToByteArray(value); }
{ }
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; }
}
#endregion /// <summary>
/// Data SHA-1 hash
/// </summary>
public string SHA1
{
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
set { _sha1 = Utilities.StringToByteArray(value); }
}
#region Constructors /// <summary>
/// Data SHA-256 hash
/// </summary>
public string SHA256
{
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
set { _sha256 = Utilities.StringToByteArray(value); }
}
/// <summary> /// <summary>
/// Create a default, empty Disk object /// Data SHA-384 hash
/// </summary> /// </summary>
public Disk() public string SHA384
{ {
_name = ""; get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
_itemType = ItemType.Disk; set { _sha384 = Utilities.StringToByteArray(value); }
_dupeType = 0x00; }
_itemStatus = ItemStatus.None;
}
/// <summary> /// <summary>
/// Create a Rom object from a BaseFile /// Data SHA-512 hash
/// </summary> /// </summary>
/// <param name="baseFile"></param> public string SHA512
public Disk(BaseFile baseFile) {
{ get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
_name = baseFile.Filename; set { _sha512 = Utilities.StringToByteArray(value); }
_md5 = baseFile.MD5; }
_sha1 = baseFile.SHA1;
_sha256 = baseFile.SHA256;
_sha384 = baseFile.SHA384;
_sha512 = baseFile.SHA512;
_itemType = ItemType.Disk; /// <summary>
_dupeType = 0x00; /// Disk name to merge from parent
_itemStatus = ItemStatus.None; /// </summary>
} public string MergeTag { get; set; }
#endregion /// <summary>
/// Disk region
/// </summary>
public string Region { get; set; }
#region Cloning Methods /// <summary>
/// Disk index
/// </summary>
public string Index { get; set; }
public override object Clone() /// <summary>
{ /// Disk writable flag
return new Disk() /// </summary>
{ public bool? Writable { get; set; }
Name = this.Name,
ItemType = this.ItemType,
DupeType = this.DupeType,
Supported = this.Supported, /// <summary>
Publisher = this.Publisher, /// Disk dump status
Infos = this.Infos, /// </summary>
PartName = this.PartName, public ItemStatus ItemStatus { get; set; }
PartInterface = this.PartInterface,
Features = this.Features,
AreaName = this.AreaName,
AreaSize = this.AreaSize,
MachineName = this.MachineName, /// <summary>
Comment = this.Comment, /// Determine if the disk is optional in the set
MachineDescription = this.MachineDescription, /// </summary>
Year = this.Year, public bool? Optional { get; set; }
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, #endregion
System = this.System,
SourceID = this.SourceID,
Source = this.Source,
_md5 = this._md5, #region Constructors
_sha1 = this._sha1,
_sha256 = this._sha256,
_sha384 = this._sha384,
_sha512 = this._sha512,
ItemStatus = this.ItemStatus,
};
}
#endregion /// <summary>
/// Create a default, empty Disk object
/// </summary>
public Disk()
{
this.Name = "";
this.ItemType = ItemType.Disk;
this.DupeType = 0x00;
this.ItemStatus = ItemStatus.None;
}
#region Comparision Methods /// <summary>
/// Create a Rom object from a BaseFile
/// </summary>
/// <param name="baseFile"></param>
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) this.ItemType = ItemType.Disk;
{ this.DupeType = 0x00;
bool dupefound = false; this.ItemStatus = ItemStatus.None;
}
// If we don't have a rom, return false #endregion
if (_itemType != other.ItemType)
{
return dupefound;
}
// Otherwise, treat it as a rom #region Cloning Methods
Disk newOther = (Disk)other;
// If all hashes are empty but they're both nodump and the names match, then they're dupes public override object Clone()
if ((this._itemStatus == ItemStatus.Nodump && newOther._itemStatus == ItemStatus.Nodump) {
&& (this._name == newOther._name) return new Disk()
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace()) {
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace()) Name = this.Name,
&& (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace()) ItemType = this.ItemType,
&& (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace()) DupeType = this.DupeType,
&& (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 Supported = this.Supported,
else if ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) Publisher = this.Publisher,
&& (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) Infos = this.Infos,
&& (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) PartName = this.PartName,
&& (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) PartInterface = this.PartInterface,
&& (this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace())) Features = this.Features,
{ AreaName = this.AreaName,
dupefound = false; AreaSize = this.AreaSize,
}
// Otherwise if we get a partial match MachineName = this.MachineName,
else if (((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) Comment = this.Comment,
&& ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) MachineDescription = this.MachineDescription,
&& ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) Year = this.Year,
&& ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) Manufacturer = this.Manufacturer,
&& ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) RomOf = this.RomOf,
{ CloneOf = this.CloneOf,
dupefound = true; 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
}
} }

View File

@@ -2,131 +2,121 @@
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents release information about a set /// Represents release information about a set
/// </summary> /// </summary>
public class Release : DatItem public class Release : DatItem
{ {
#region Private instance variables #region Publicly facing variables
private string _region; /// <summary>
private string _language; /// Release region(s)
private string _date; /// </summary>
private bool? _default; public string Region { get; set; }
#endregion /// <summary>
/// Release language(s)
/// </summary>
public string Language { get; set; }
#region Publicly facing variables /// <summary>
/// Date of release
/// </summary>
public string Date { get; set; }
public string Region /// <summary>
{ /// Default release, if applicable
get { return _region; } /// </summary>
set { _region = value; } public bool? Default { get; set; }
}
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; }
}
#endregion #endregion
#region Constructors #region Constructors
/// <summary> /// <summary>
/// Create a default, empty Release object /// Create a default, empty Release object
/// </summary> /// </summary>
public Release() public Release()
{ {
_name = ""; this.Name = "";
_itemType = ItemType.Release; this.ItemType = ItemType.Release;
_region = ""; this.Region = "";
_language = ""; this.Language = "";
_date = ""; this.Date = "";
_default = null; this.Default = null;
} }
#endregion #endregion
#region Cloning Methods #region Cloning Methods
public override object Clone() public override object Clone()
{ {
return new Release() return new Release()
{ {
Name = this.Name, Name = this.Name,
ItemType = this.ItemType, ItemType = this.ItemType,
DupeType = this.DupeType, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
Infos = this.Infos, Infos = this.Infos,
PartName = this.PartName, PartName = this.PartName,
PartInterface = this.PartInterface, PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,
MachineName = this.MachineName, MachineName = this.MachineName,
Comment = this.Comment, Comment = this.Comment,
MachineDescription = this.MachineDescription, MachineDescription = this.MachineDescription,
Year = this.Year, Year = this.Year,
Manufacturer = this.Manufacturer, Manufacturer = this.Manufacturer,
RomOf = this.RomOf, RomOf = this.RomOf,
CloneOf = this.CloneOf, CloneOf = this.CloneOf,
SampleOf = this.SampleOf, SampleOf = this.SampleOf,
SourceFile = this.SourceFile, SourceFile = this.SourceFile,
Runnable = this.Runnable, Runnable = this.Runnable,
Board = this.Board, Board = this.Board,
RebuildTo = this.RebuildTo, RebuildTo = this.RebuildTo,
Devices = this.Devices, Devices = this.Devices,
MachineType = this.MachineType, MachineType = this.MachineType,
SystemID = this.SystemID, SystemID = this.SystemID,
System = this.System, System = this.System,
SourceID = this.SourceID, SourceID = this.SourceID,
Source = this.Source, Source = this.Source,
Region = this.Region, Region = this.Region,
Language = this.Language, Language = this.Language,
Date = this.Date, Date = this.Date,
Default = this.Default, Default = this.Default,
}; };
} }
#endregion #endregion
#region Comparision Methods #region Comparision Methods
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a release return false // If we don't have a release return false
if (_itemType != other.ItemType) if (this.ItemType != other.ItemType)
{ {
return false; return false;
} }
// Otherwise, treat it as a reease // Otherwise, treat it as a reease
Release newOther = (Release)other; Release newOther = (Release)other;
// If the archive information matches // If the archive information matches
return (_name == newOther.Name return (this.Name == newOther.Name
&& _region == newOther.Region && this.Region == newOther.Region
&& _language == newOther.Language && this.Language == newOther.Language
&& _date == newOther.Date && this.Date == newOther.Date
&& _default == newOther.Default); && this.Default == newOther.Default);
} }
#endregion #endregion
} }
} }

View File

@@ -1,301 +1,313 @@
using System.Linq; using System.Linq;
using SabreTools.Library.Data; using SabreTools.Library.Data;
using SabreTools.Library.FileTypes; using SabreTools.Library.FileTypes;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents a generic file within a set /// Represents a generic file within a set
/// </summary> /// </summary>
public class Rom : DatItem public class Rom : DatItem
{ {
#region Private instance variables #region Private instance variables
// Rom information private byte[] _crc; // 8 bytes
private string _bios; private byte[] _md5; // 16 bytes
private long _size; private byte[] _sha1; // 20 bytes
private byte[] _crc; // 8 bytes private byte[] _sha256; // 32 bytes
private byte[] _md5; // 16 bytes private byte[] _sha384; // 48 bytes
private byte[] _sha1; // 20 bytes private byte[] _sha512; // 64 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;
#endregion #endregion
#region Publicly facing variables #region Publicly facing variables
// Rom information /// <summary>
public string Bios /// What BIOS is required for this rom
{ /// </summary>
get { return _bios; } public string Bios { get; set; }
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; }
}
#endregion /// <summary>
/// Byte size of the rom
/// </summary>
public long Size { get; set; }
#region Constructors /// <summary>
/// File CRC32 hash
/// </summary>
public string CRC
{
get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); }
set { _crc = (value == "null" ? Constants.CRCZeroBytes : Utilities.StringToByteArray(value)); }
}
/// <summary> /// <summary>
/// Create a default, empty Rom object /// File MD5 hash
/// </summary> /// </summary>
public Rom() public string MD5
{ {
_name = ""; get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
_itemType = ItemType.Rom; set { _md5 = Utilities.StringToByteArray(value); }
_dupeType = 0x00; }
_itemStatus = ItemStatus.None;
_date = "";
}
/// <summary> /// <summary>
/// Create a "blank" Rom object /// File SHA-1 hash
/// </summary> /// </summary>
/// <param name="name"></param> public string SHA1
/// <param name="machineName"></param> {
/// <param name="omitFromScan"></param> get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks> set { _sha1 = Utilities.StringToByteArray(value); }
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;
_machine = new Machine /// <summary>
{ /// File SHA-256 hash
Name = machineName, /// </summary>
Description = machineName, public string SHA256
}; {
} get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
set { _sha256 = Utilities.StringToByteArray(value); }
}
/// <summary> /// <summary>
/// Create a Rom object from a BaseFile /// File SHA-384 hash
/// </summary> /// </summary>
/// <param name="baseFile"></param> public string SHA384
public Rom(BaseFile baseFile) {
{ get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
_name = baseFile.Filename; set { _sha384 = Utilities.StringToByteArray(value); }
_size = baseFile.Size ?? -1; }
_crc = baseFile.CRC;
_md5 = baseFile.MD5;
_sha1 = baseFile.SHA1;
_sha256 = baseFile.SHA256;
_sha384 = baseFile.SHA384;
_sha512 = baseFile.SHA512;
_itemType = ItemType.Rom; /// <summary>
_dupeType = 0x00; /// File SHA-512 hash
_itemStatus = ItemStatus.None; /// </summary>
_date = baseFile.Date; public string SHA512
} {
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
set { _sha512 = Utilities.StringToByteArray(value); }
}
#endregion /// <summary>
/// Rom name to merge from parent
/// </summary>
public string MergeTag { get; set; }
#region Cloning Methods /// <summary>
/// Rom region
/// </summary>
public string Region { get; set; }
public override object Clone() /// <summary>
{ /// Data offset within rom
return new Rom() /// </summary>
{ public string Offset { get; set; }
Name = this.Name,
ItemType = this.ItemType,
DupeType = this.DupeType,
Supported = this.Supported, /// <summary>
Publisher = this.Publisher, /// File created date
Infos = this.Infos, /// </summary>
PartName = this.PartName, public string Date { get; set; }
PartInterface = this.PartInterface,
Features = this.Features,
AreaName = this.AreaName,
AreaSize = this.AreaSize,
MachineName = this.MachineName, /// <summary>
Comment = this.Comment, /// Rom dump status
MachineDescription = this.MachineDescription, /// </summary>
Year = this.Year, public ItemStatus ItemStatus { get; set; }
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, /// <summary>
System = this.System, /// Determine if the rom is optional in the set
SourceID = this.SourceID, /// </summary>
Source = this.Source, public bool? Optional { get; set; }
Size = this.Size, #endregion
_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 Constructors
#region Comparision Methods /// <summary>
/// Create a default, empty Rom object
/// </summary>
public Rom()
{
this.Name = "";
this.ItemType = ItemType.Rom;
this.DupeType = 0x00;
this.ItemStatus = ItemStatus.None;
this.Date = "";
}
public override bool Equals(DatItem other) /// <summary>
{ /// Create a "blank" Rom object
bool dupefound = false; /// </summary>
/// <param name="name"></param>
/// <param name="machineName"></param>
/// <param name="omitFromScan"></param>
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
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 _machine = new Machine
if (_itemType != other.ItemType) {
{ Name = machineName,
return dupefound; Description = machineName,
} };
}
// Otherwise, treat it as a rom /// <summary>
Rom newOther = (Rom)other; /// Create a Rom object from a BaseFile
/// </summary>
/// <param name="baseFile"></param>
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 this.ItemType = ItemType.Rom;
if ((this._itemStatus == ItemStatus.Nodump && newOther._itemStatus == ItemStatus.Nodump) this.DupeType = 0x00;
&& (this._name == newOther._name) this.ItemStatus = ItemStatus.None;
&& (this._crc.IsNullOrWhiteSpace() && newOther._crc.IsNullOrWhiteSpace()) this.Date = baseFile.Date;
&& (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 #endregion
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 #region Cloning Methods
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; 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
}
} }

View File

@@ -2,84 +2,84 @@
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents a (usually WAV-formatted) sample to be included for use in the set /// Represents a (usually WAV-formatted) sample to be included for use in the set
/// </summary> /// </summary>
public class Sample : DatItem public class Sample : DatItem
{ {
#region Constructors #region Constructors
/// <summary> /// <summary>
/// Create a default, empty Sample object /// Create a default, empty Sample object
/// </summary> /// </summary>
public Sample() public Sample()
{ {
_name = ""; this.Name = "";
_itemType = ItemType.Sample; this.ItemType = ItemType.Sample;
} }
#endregion #endregion
#region Cloning Methods #region Cloning Methods
public override object Clone() public override object Clone()
{ {
return new Sample() return new Sample()
{ {
Name = this.Name, Name = this.Name,
ItemType = this.ItemType, ItemType = this.ItemType,
DupeType = this.DupeType, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
Infos = this.Infos, Infos = this.Infos,
PartName = this.PartName, PartName = this.PartName,
PartInterface = this.PartInterface, PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,
MachineName = this.MachineName, MachineName = this.MachineName,
Comment = this.Comment, Comment = this.Comment,
MachineDescription = this.MachineDescription, MachineDescription = this.MachineDescription,
Year = this.Year, Year = this.Year,
Manufacturer = this.Manufacturer, Manufacturer = this.Manufacturer,
RomOf = this.RomOf, RomOf = this.RomOf,
CloneOf = this.CloneOf, CloneOf = this.CloneOf,
SampleOf = this.SampleOf, SampleOf = this.SampleOf,
SourceFile = this.SourceFile, SourceFile = this.SourceFile,
Runnable = this.Runnable, Runnable = this.Runnable,
Board = this.Board, Board = this.Board,
RebuildTo = this.RebuildTo, RebuildTo = this.RebuildTo,
Devices = this.Devices, Devices = this.Devices,
MachineType = this.MachineType, MachineType = this.MachineType,
SystemID = this.SystemID, SystemID = this.SystemID,
System = this.System, System = this.System,
SourceID = this.SourceID, SourceID = this.SourceID,
Source = this.Source, Source = this.Source,
}; };
} }
#endregion #endregion
#region Comparision Methods #region Comparision Methods
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a sample, return false // If we don't have a sample, return false
if (_itemType != other.ItemType) if (this.ItemType != other.ItemType)
{ {
return false; return false;
} }
// Otherwise, treat it as a sample // Otherwise, treat it as a sample
Sample newOther = (Sample)other; Sample newOther = (Sample)other;
// If the archive information matches // If the archive information matches
return (_name == newOther.Name); return (this.Name == newOther.Name);
} }
#endregion #endregion
} }
} }