mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatItems/] Clean these up a bit
This commit is contained in:
@@ -14,8 +14,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Archive()
|
public Archive()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.Archive;
|
this.ItemType = ItemType.Archive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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
|
||||||
|
|||||||
@@ -7,25 +7,17 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BiosSet : DatItem
|
public class BiosSet : DatItem
|
||||||
{
|
{
|
||||||
#region Private instance variables
|
|
||||||
|
|
||||||
private string _description;
|
|
||||||
private bool? _default;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
public string Description
|
/// <summary>
|
||||||
{
|
/// Description of the BIOS
|
||||||
get { return _description; }
|
/// </summary>
|
||||||
set { _description = value; }
|
public string Description { get; set; }
|
||||||
}
|
|
||||||
public bool? Default
|
/// <summary>
|
||||||
{
|
/// Determine whether the BIOS is default
|
||||||
get { return _default; }
|
/// </summary>
|
||||||
set { _default = value; }
|
public bool? Default { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -36,8 +28,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BiosSet()
|
public BiosSet()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.BiosSet;
|
this.ItemType = ItemType.BiosSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -93,7 +85,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
public override bool Equals(DatItem other)
|
public override bool Equals(DatItem other)
|
||||||
{
|
{
|
||||||
// If we don't have a biosset, return false
|
// If we don't have a biosset, return false
|
||||||
if (_itemType != other.ItemType)
|
if (this.ItemType != other.ItemType)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -102,7 +94,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
BiosSet newOther = (BiosSet)other;
|
BiosSet newOther = (BiosSet)other;
|
||||||
|
|
||||||
// If the archive information matches
|
// If the archive information matches
|
||||||
return (_name == newOther.Name && _description == newOther.Description && _default == newOther.Default);
|
return (this.Name == newOther.Name && this.Description == newOther.Description && this.Default == newOther.Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Blank()
|
public Blank()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.Blank;
|
this.ItemType = ItemType.Blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
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;
|
||||||
@@ -13,79 +12,90 @@ namespace SabreTools.Library.DatItems
|
|||||||
{
|
{
|
||||||
#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>
|
||||||
|
/// Data MD5 hash
|
||||||
|
/// </summary>
|
||||||
public string MD5
|
public string MD5
|
||||||
{
|
{
|
||||||
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
||||||
set { _md5 = Utilities.StringToByteArray(value); }
|
set { _md5 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data SHA-1 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA1
|
public string SHA1
|
||||||
{
|
{
|
||||||
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||||
set { _sha1 = Utilities.StringToByteArray(value); }
|
set { _sha1 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data SHA-256 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA256
|
public string SHA256
|
||||||
{
|
{
|
||||||
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||||
set { _sha256 = Utilities.StringToByteArray(value); }
|
set { _sha256 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data SHA-384 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA384
|
public string SHA384
|
||||||
{
|
{
|
||||||
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||||
set { _sha384 = Utilities.StringToByteArray(value); }
|
set { _sha384 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data SHA-512 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA512
|
public string SHA512
|
||||||
{
|
{
|
||||||
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||||
set { _sha512 = Utilities.StringToByteArray(value); }
|
set { _sha512 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
public string MergeTag
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _merge; }
|
/// Disk name to merge from parent
|
||||||
set { _merge = value; }
|
/// </summary>
|
||||||
}
|
public string MergeTag { get; set; }
|
||||||
public string Region
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _region; }
|
/// Disk region
|
||||||
set { _region = value; }
|
/// </summary>
|
||||||
}
|
public string Region { get; set; }
|
||||||
public string Index
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _index; }
|
/// Disk index
|
||||||
set { _index = value; }
|
/// </summary>
|
||||||
}
|
public string Index { get; set; }
|
||||||
public bool? Writable
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _writable; }
|
/// Disk writable flag
|
||||||
set { _writable = value; }
|
/// </summary>
|
||||||
}
|
public bool? Writable { get; set; }
|
||||||
public ItemStatus ItemStatus
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _itemStatus; }
|
/// Disk dump status
|
||||||
set { _itemStatus = value; }
|
/// </summary>
|
||||||
}
|
public ItemStatus ItemStatus { get; set; }
|
||||||
public bool? Optional
|
|
||||||
{
|
/// <summary>
|
||||||
get { return _optional; }
|
/// Determine if the disk is optional in the set
|
||||||
set { _optional = value; }
|
/// </summary>
|
||||||
}
|
public bool? Optional { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -96,10 +106,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Disk()
|
public Disk()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.Disk;
|
this.ItemType = ItemType.Disk;
|
||||||
_dupeType = 0x00;
|
this.DupeType = 0x00;
|
||||||
_itemStatus = ItemStatus.None;
|
this.ItemStatus = ItemStatus.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -108,16 +118,16 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <param name="baseFile"></param>
|
/// <param name="baseFile"></param>
|
||||||
public Disk(BaseFile baseFile)
|
public Disk(BaseFile baseFile)
|
||||||
{
|
{
|
||||||
_name = baseFile.Filename;
|
this.Name = baseFile.Filename;
|
||||||
_md5 = baseFile.MD5;
|
_md5 = baseFile.MD5;
|
||||||
_sha1 = baseFile.SHA1;
|
_sha1 = baseFile.SHA1;
|
||||||
_sha256 = baseFile.SHA256;
|
_sha256 = baseFile.SHA256;
|
||||||
_sha384 = baseFile.SHA384;
|
_sha384 = baseFile.SHA384;
|
||||||
_sha512 = baseFile.SHA512;
|
_sha512 = baseFile.SHA512;
|
||||||
|
|
||||||
_itemType = ItemType.Disk;
|
this.ItemType = ItemType.Disk;
|
||||||
_dupeType = 0x00;
|
this.DupeType = 0x00;
|
||||||
_itemStatus = ItemStatus.None;
|
this.ItemStatus = ItemStatus.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -179,7 +189,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
bool dupefound = false;
|
bool dupefound = false;
|
||||||
|
|
||||||
// If we don't have a rom, return false
|
// If we don't have a rom, return false
|
||||||
if (_itemType != other.ItemType)
|
if (this.ItemType != other.ItemType)
|
||||||
{
|
{
|
||||||
return dupefound;
|
return dupefound;
|
||||||
}
|
}
|
||||||
@@ -188,8 +198,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
Disk newOther = (Disk)other;
|
Disk newOther = (Disk)other;
|
||||||
|
|
||||||
// If all hashes are empty but they're both nodump and the names match, then they're dupes
|
// 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)
|
if ((this.ItemStatus == ItemStatus.Nodump && newOther.ItemStatus == ItemStatus.Nodump)
|
||||||
&& (this._name == newOther._name)
|
&& (this.Name == newOther.Name)
|
||||||
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace())
|
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace())
|
||||||
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace())
|
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace())
|
||||||
&& (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace())
|
&& (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace())
|
||||||
|
|||||||
@@ -7,37 +7,27 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Release : DatItem
|
public class Release : DatItem
|
||||||
{
|
{
|
||||||
#region Private instance variables
|
|
||||||
|
|
||||||
private string _region;
|
|
||||||
private string _language;
|
|
||||||
private string _date;
|
|
||||||
private bool? _default;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Publicly facing variables
|
#region Publicly facing variables
|
||||||
|
|
||||||
public string Region
|
/// <summary>
|
||||||
{
|
/// Release region(s)
|
||||||
get { return _region; }
|
/// </summary>
|
||||||
set { _region = value; }
|
public string Region { get; set; }
|
||||||
}
|
|
||||||
public string Language
|
/// <summary>
|
||||||
{
|
/// Release language(s)
|
||||||
get { return _language; }
|
/// </summary>
|
||||||
set { _language = value; }
|
public string Language { get; set; }
|
||||||
}
|
|
||||||
public string Date
|
/// <summary>
|
||||||
{
|
/// Date of release
|
||||||
get { return _date; }
|
/// </summary>
|
||||||
set { _date = value; }
|
public string Date { get; set; }
|
||||||
}
|
|
||||||
public bool? Default
|
/// <summary>
|
||||||
{
|
/// Default release, if applicable
|
||||||
get { return _default; }
|
/// </summary>
|
||||||
set { _default = value; }
|
public bool? Default { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -48,12 +38,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </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
|
||||||
@@ -111,7 +101,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -120,11 +110,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
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
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
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;
|
||||||
@@ -13,98 +12,111 @@ namespace SabreTools.Library.DatItems
|
|||||||
{
|
{
|
||||||
#region Private instance variables
|
#region Private instance variables
|
||||||
|
|
||||||
// Rom information
|
|
||||||
private string _bios;
|
|
||||||
private long _size;
|
|
||||||
private byte[] _crc; // 8 bytes
|
private byte[] _crc; // 8 bytes
|
||||||
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 _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; }
|
|
||||||
}
|
/// <summary>
|
||||||
public long Size
|
/// Byte size of the rom
|
||||||
{
|
/// </summary>
|
||||||
get { return _size; }
|
public long Size { get; set; }
|
||||||
set { _size = value; }
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// File CRC32 hash
|
||||||
|
/// </summary>
|
||||||
public string CRC
|
public string CRC
|
||||||
{
|
{
|
||||||
get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); }
|
get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); }
|
||||||
set { _crc = (value == "null" ? Constants.CRCZeroBytes : Utilities.StringToByteArray(value)); }
|
set { _crc = (value == "null" ? Constants.CRCZeroBytes : Utilities.StringToByteArray(value)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File MD5 hash
|
||||||
|
/// </summary>
|
||||||
public string MD5
|
public string MD5
|
||||||
{
|
{
|
||||||
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
||||||
set { _md5 = (value == "null" ? Constants.MD5ZeroBytes : Utilities.StringToByteArray(value)); }
|
set { _md5 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File SHA-1 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA1
|
public string SHA1
|
||||||
{
|
{
|
||||||
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||||
set { _sha1 = (value == "null" ? Constants.SHA1ZeroBytes : Utilities.StringToByteArray(value)); }
|
set { _sha1 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File SHA-256 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA256
|
public string SHA256
|
||||||
{
|
{
|
||||||
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||||
set { _sha256 = (value == "null" ? Constants.SHA256ZeroBytes : Utilities.StringToByteArray(value)); }
|
set { _sha256 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File SHA-384 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA384
|
public string SHA384
|
||||||
{
|
{
|
||||||
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||||
set { _sha384 = (value == "null" ? Constants.SHA384ZeroBytes : Utilities.StringToByteArray(value)); }
|
set { _sha384 = Utilities.StringToByteArray(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File SHA-512 hash
|
||||||
|
/// </summary>
|
||||||
public string SHA512
|
public string SHA512
|
||||||
{
|
{
|
||||||
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||||
set { _sha512 = (value == "null" ? Constants.SHA512ZeroBytes : Utilities.StringToByteArray(value)); }
|
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 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; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rom name to merge from parent
|
||||||
|
/// </summary>
|
||||||
|
public string MergeTag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rom region
|
||||||
|
/// </summary>
|
||||||
|
public string Region { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data offset within rom
|
||||||
|
/// </summary>
|
||||||
|
public string Offset { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// File created date
|
||||||
|
/// </summary>
|
||||||
|
public string Date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rom dump status
|
||||||
|
/// </summary>
|
||||||
|
public ItemStatus ItemStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if the rom is optional in the set
|
||||||
|
/// </summary>
|
||||||
|
public bool? Optional { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -114,11 +126,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Rom()
|
public Rom()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.Rom;
|
this.ItemType = ItemType.Rom;
|
||||||
_dupeType = 0x00;
|
this.DupeType = 0x00;
|
||||||
_itemStatus = ItemStatus.None;
|
this.ItemStatus = ItemStatus.None;
|
||||||
_date = "";
|
this.Date = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -130,9 +142,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
||||||
public Rom(string name, string machineName, Hash omitFromScan = Hash.DeepHashes)
|
public Rom(string name, string machineName, Hash omitFromScan = Hash.DeepHashes)
|
||||||
{
|
{
|
||||||
_name = name;
|
this.Name = name;
|
||||||
_itemType = ItemType.Rom;
|
this.ItemType = ItemType.Rom;
|
||||||
_size = -1;
|
this.Size = -1;
|
||||||
if ((omitFromScan & Hash.CRC) == 0)
|
if ((omitFromScan & Hash.CRC) == 0)
|
||||||
{
|
{
|
||||||
_crc = null;
|
_crc = null;
|
||||||
@@ -157,7 +169,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
{
|
{
|
||||||
_sha512 = null;
|
_sha512 = null;
|
||||||
}
|
}
|
||||||
_itemStatus = ItemStatus.None;
|
this.ItemStatus = ItemStatus.None;
|
||||||
|
|
||||||
_machine = new Machine
|
_machine = new Machine
|
||||||
{
|
{
|
||||||
@@ -172,8 +184,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <param name="baseFile"></param>
|
/// <param name="baseFile"></param>
|
||||||
public Rom(BaseFile baseFile)
|
public Rom(BaseFile baseFile)
|
||||||
{
|
{
|
||||||
_name = baseFile.Filename;
|
this.Name = baseFile.Filename;
|
||||||
_size = baseFile.Size ?? -1;
|
this.Size = baseFile.Size ?? -1;
|
||||||
_crc = baseFile.CRC;
|
_crc = baseFile.CRC;
|
||||||
_md5 = baseFile.MD5;
|
_md5 = baseFile.MD5;
|
||||||
_sha1 = baseFile.SHA1;
|
_sha1 = baseFile.SHA1;
|
||||||
@@ -181,10 +193,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
_sha384 = baseFile.SHA384;
|
_sha384 = baseFile.SHA384;
|
||||||
_sha512 = baseFile.SHA512;
|
_sha512 = baseFile.SHA512;
|
||||||
|
|
||||||
_itemType = ItemType.Rom;
|
this.ItemType = ItemType.Rom;
|
||||||
_dupeType = 0x00;
|
this.DupeType = 0x00;
|
||||||
_itemStatus = ItemStatus.None;
|
this.ItemStatus = ItemStatus.None;
|
||||||
_date = baseFile.Date;
|
this.Date = baseFile.Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -249,7 +261,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
bool dupefound = false;
|
bool dupefound = false;
|
||||||
|
|
||||||
// If we don't have a rom, return false
|
// If we don't have a rom, return false
|
||||||
if (_itemType != other.ItemType)
|
if (this.ItemType != other.ItemType)
|
||||||
{
|
{
|
||||||
return dupefound;
|
return dupefound;
|
||||||
}
|
}
|
||||||
@@ -258,8 +270,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
Rom newOther = (Rom)other;
|
Rom newOther = (Rom)other;
|
||||||
|
|
||||||
// If all hashes are empty but they're both nodump and the names match, then they're dupes
|
// 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)
|
if ((this.ItemStatus == ItemStatus.Nodump && newOther.ItemStatus == ItemStatus.Nodump)
|
||||||
&& (this._name == newOther._name)
|
&& (this.Name == newOther.Name)
|
||||||
&& (this._crc.IsNullOrWhiteSpace() && newOther._crc.IsNullOrWhiteSpace())
|
&& (this._crc.IsNullOrWhiteSpace() && newOther._crc.IsNullOrWhiteSpace())
|
||||||
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace())
|
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace())
|
||||||
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace())
|
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace())
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Sample()
|
public Sample()
|
||||||
{
|
{
|
||||||
_name = "";
|
this.Name = "";
|
||||||
_itemType = ItemType.Sample;
|
this.ItemType = ItemType.Sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user