mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move more to the DatItem base class
This commit is contained in:
@@ -70,10 +70,27 @@ namespace SabreTools.Core
|
|||||||
|
|
||||||
#region Conversion
|
#region Conversion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a DatItem to a Rom
|
||||||
|
/// </summary>
|
||||||
|
public static Rom? ConvertToRom(this DatItem? self)
|
||||||
|
{
|
||||||
|
// If the DatItem is missing, we can't do anything
|
||||||
|
if (self == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return self switch
|
||||||
|
{
|
||||||
|
Disk diskSelf => ConvertToRom(diskSelf),
|
||||||
|
Media mediaSelf => ConvertToRom(mediaSelf),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a Disk to a Rom
|
/// Convert a Disk to a Rom
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Rom? ConvertToRom(this Disk? disk)
|
private static Rom? ConvertToRom(this Disk? disk)
|
||||||
{
|
{
|
||||||
// If the Disk is missing, we can't do anything
|
// If the Disk is missing, we can't do anything
|
||||||
if (disk == null)
|
if (disk == null)
|
||||||
@@ -94,7 +111,7 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a Media to a Rom
|
/// Convert a Media to a Rom
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Rom? ConvertToRom(this Media? media)
|
private static Rom? ConvertToRom(this Media? media)
|
||||||
{
|
{
|
||||||
// If the Media is missing, we can't do anything
|
// If the Media is missing, we can't do anything
|
||||||
if (media == null)
|
if (media == null)
|
||||||
@@ -338,104 +355,29 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if any hashes exist
|
/// Returns if any hashes exist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool HasHashes(this Disk disk)
|
public static bool HasHashes(this DatItem self)
|
||||||
{
|
{
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(disk.ReadString(Disk.MD5Key));
|
return self switch
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(disk.ReadString(Disk.SHA1Key));
|
{
|
||||||
|
Disk diskSelf => diskSelf.HasHashes(),
|
||||||
return !md5Null || !sha1Null;
|
Media mediaSelf => mediaSelf.HasHashes(),
|
||||||
}
|
Rom romSelf => romSelf.HasHashes(),
|
||||||
|
_ => false,
|
||||||
/// <summary>
|
};
|
||||||
/// Returns if any hashes exist
|
|
||||||
/// </summary>
|
|
||||||
public static bool HasHashes(this Media media)
|
|
||||||
{
|
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(media.ReadString(Media.MD5Key));
|
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(media.ReadString(Media.SHA1Key));
|
|
||||||
bool sha256Null = string.IsNullOrWhiteSpace(media.ReadString(Media.SHA256Key));
|
|
||||||
bool spamsumNull = string.IsNullOrWhiteSpace(media.ReadString(Media.SpamSumKey));
|
|
||||||
|
|
||||||
return !md5Null || !sha1Null || !sha256Null || !spamsumNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns if any hashes exist
|
|
||||||
/// </summary>
|
|
||||||
public static bool HasHashes(this Rom rom)
|
|
||||||
{
|
|
||||||
bool crcNull = string.IsNullOrWhiteSpace(rom.ReadString(Rom.CRCKey));
|
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.MD5Key));
|
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA1Key));
|
|
||||||
bool sha256Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA256Key));
|
|
||||||
bool sha384Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA384Key));
|
|
||||||
bool sha512Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA512Key));
|
|
||||||
bool spamsumNull = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SpamSumKey));
|
|
||||||
|
|
||||||
return !crcNull || !md5Null || !sha1Null || !sha256Null || !sha384Null || !sha512Null || !spamsumNull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if all of the hashes are set to their 0-byte values or null
|
/// Returns if all of the hashes are set to their 0-byte values or null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool HasZeroHash(this Disk disk)
|
public static bool HasZeroHash(this DatItem self)
|
||||||
{
|
{
|
||||||
string? md5 = disk.ReadString(Disk.MD5Key);
|
return self switch
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
{
|
||||||
|
Disk diskSelf => diskSelf.HasZeroHash(),
|
||||||
string? sha1 = disk.ReadString(Disk.SHA1Key);
|
Media mediaSelf => mediaSelf.HasZeroHash(),
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
Rom romSelf => romSelf.HasZeroHash(),
|
||||||
|
_ => false,
|
||||||
return md5Null && sha1Null;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns if all of the hashes are set to their 0-byte values or null
|
|
||||||
/// </summary>
|
|
||||||
public static bool HasZeroHash(this Media media)
|
|
||||||
{
|
|
||||||
string? md5 = media.ReadString(Media.MD5Key);
|
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha1 = media.ReadString(Media.SHA1Key);
|
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha256 = media.ReadString(Media.SHA256Key);
|
|
||||||
bool sha256Null = string.IsNullOrWhiteSpace(sha256) || string.Equals(sha256, Constants.SHA256Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? spamsum = media.ReadString(Media.SpamSumKey);
|
|
||||||
bool spamsumNull = string.IsNullOrWhiteSpace(spamsum) || string.Equals(spamsum, Constants.SpamSumZero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
return md5Null && sha1Null && sha256Null && spamsumNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns if all of the hashes are set to their 0-byte values or null
|
|
||||||
/// </summary>
|
|
||||||
public static bool HasZeroHash(this Rom rom)
|
|
||||||
{
|
|
||||||
string? crc = rom.ReadString(Rom.CRCKey);
|
|
||||||
bool crcNull = string.IsNullOrWhiteSpace(crc) || string.Equals(crc, Constants.CRCZero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? md5 = rom.ReadString(Rom.MD5Key);
|
|
||||||
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha1 = rom.ReadString(Rom.SHA1Key);
|
|
||||||
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha256 = rom.ReadString(Rom.SHA256Key);
|
|
||||||
bool sha256Null = string.IsNullOrWhiteSpace(sha256) || string.Equals(sha256, Constants.SHA256Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha384 = rom.ReadString(Rom.SHA384Key);
|
|
||||||
bool sha384Null = string.IsNullOrWhiteSpace(sha384) || string.Equals(sha384, Constants.SHA384Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? sha512 = rom.ReadString(Rom.SHA512Key);
|
|
||||||
bool sha512Null = string.IsNullOrWhiteSpace(sha512) || string.Equals(sha512, Constants.SHA512Zero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
string? spamsum = rom.ReadString(Rom.SpamSumKey);
|
|
||||||
bool spamsumNull = string.IsNullOrWhiteSpace(spamsum) || string.Equals(spamsum, Constants.SpamSumZero, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
return crcNull && md5Null && sha1Null && sha256Null && sha384Null && sha512Null && spamsumNull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -501,14 +443,139 @@ namespace SabreTools.Core
|
|||||||
return !crcNull || !md5Null || !sha1Null || !sha256Null || !sha384Null || !sha512Null || !spamsumNull;
|
return !crcNull || !md5Null || !sha1Null || !sha256Null || !sha384Null || !sha512Null || !spamsumNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if any hashes exist
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasHashes(this Disk disk)
|
||||||
|
{
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(disk.ReadString(Disk.MD5Key));
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(disk.ReadString(Disk.SHA1Key));
|
||||||
|
|
||||||
|
return !md5Null || !sha1Null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if any hashes exist
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasHashes(this Media media)
|
||||||
|
{
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(media.ReadString(Media.MD5Key));
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(media.ReadString(Media.SHA1Key));
|
||||||
|
bool sha256Null = string.IsNullOrWhiteSpace(media.ReadString(Media.SHA256Key));
|
||||||
|
bool spamsumNull = string.IsNullOrWhiteSpace(media.ReadString(Media.SpamSumKey));
|
||||||
|
|
||||||
|
return !md5Null || !sha1Null || !sha256Null || !spamsumNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if any hashes exist
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasHashes(this Rom rom)
|
||||||
|
{
|
||||||
|
bool crcNull = string.IsNullOrWhiteSpace(rom.ReadString(Rom.CRCKey));
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.MD5Key));
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA1Key));
|
||||||
|
bool sha256Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA256Key));
|
||||||
|
bool sha384Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA384Key));
|
||||||
|
bool sha512Null = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SHA512Key));
|
||||||
|
bool spamsumNull = string.IsNullOrWhiteSpace(rom.ReadString(Rom.SpamSumKey));
|
||||||
|
|
||||||
|
return !crcNull || !md5Null || !sha1Null || !sha256Null || !sha384Null || !sha512Null || !spamsumNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if all of the hashes are set to their 0-byte values or null
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasZeroHash(this Disk disk)
|
||||||
|
{
|
||||||
|
string? md5 = disk.ReadString(Disk.MD5Key);
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha1 = disk.ReadString(Disk.SHA1Key);
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
return md5Null && sha1Null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if all of the hashes are set to their 0-byte values or null
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasZeroHash(this Media media)
|
||||||
|
{
|
||||||
|
string? md5 = media.ReadString(Media.MD5Key);
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha1 = media.ReadString(Media.SHA1Key);
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha256 = media.ReadString(Media.SHA256Key);
|
||||||
|
bool sha256Null = string.IsNullOrWhiteSpace(sha256) || string.Equals(sha256, Constants.SHA256Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? spamsum = media.ReadString(Media.SpamSumKey);
|
||||||
|
bool spamsumNull = string.IsNullOrWhiteSpace(spamsum) || string.Equals(spamsum, Constants.SpamSumZero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
return md5Null && sha1Null && sha256Null && spamsumNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns if all of the hashes are set to their 0-byte values or null
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasZeroHash(this Rom rom)
|
||||||
|
{
|
||||||
|
string? crc = rom.ReadString(Rom.CRCKey);
|
||||||
|
bool crcNull = string.IsNullOrWhiteSpace(crc) || string.Equals(crc, Constants.CRCZero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? md5 = rom.ReadString(Rom.MD5Key);
|
||||||
|
bool md5Null = string.IsNullOrWhiteSpace(md5) || string.Equals(md5, Constants.MD5Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha1 = rom.ReadString(Rom.SHA1Key);
|
||||||
|
bool sha1Null = string.IsNullOrWhiteSpace(sha1) || string.Equals(sha1, Constants.SHA1Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha256 = rom.ReadString(Rom.SHA256Key);
|
||||||
|
bool sha256Null = string.IsNullOrWhiteSpace(sha256) || string.Equals(sha256, Constants.SHA256Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha384 = rom.ReadString(Rom.SHA384Key);
|
||||||
|
bool sha384Null = string.IsNullOrWhiteSpace(sha384) || string.Equals(sha384, Constants.SHA384Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? sha512 = rom.ReadString(Rom.SHA512Key);
|
||||||
|
bool sha512Null = string.IsNullOrWhiteSpace(sha512) || string.Equals(sha512, Constants.SHA512Zero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
string? spamsum = rom.ReadString(Rom.SpamSumKey);
|
||||||
|
bool spamsumNull = string.IsNullOrWhiteSpace(spamsum) || string.Equals(spamsum, Constants.SpamSumZero, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
return crcNull && md5Null && sha1Null && sha256Null && sha384Null && sha512Null && spamsumNull;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Information Filling
|
#region Information Filling
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fill any missing size and hash information from another DatItem
|
||||||
|
/// </summary>
|
||||||
|
public static void FillMissingHashes(this DatItem? self, DatItem? other)
|
||||||
|
{
|
||||||
|
if (self == null || other == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (self, other)
|
||||||
|
{
|
||||||
|
case (Disk diskSelf, Disk diskOther):
|
||||||
|
FillMissingHashes(diskSelf, diskOther);
|
||||||
|
break;
|
||||||
|
case (Media mediaSelf, Media mediaOther):
|
||||||
|
FillMissingHashes(mediaSelf, mediaOther);
|
||||||
|
break;
|
||||||
|
case (Rom romSelf, Rom romOther):
|
||||||
|
FillMissingHashes(romSelf, romOther);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Disk
|
/// Fill any missing size and hash information from another Disk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void FillMissingHashes(this Disk? self, Disk? other)
|
private static void FillMissingHashes(this Disk? self, Disk? other)
|
||||||
{
|
{
|
||||||
if (self == null || other == null)
|
if (self == null || other == null)
|
||||||
return;
|
return;
|
||||||
@@ -527,7 +594,7 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Media
|
/// Fill any missing size and hash information from another Media
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void FillMissingHashes(this Media? self, Media? other)
|
private static void FillMissingHashes(this Media? self, Media? other)
|
||||||
{
|
{
|
||||||
if (self == null || other == null)
|
if (self == null || other == null)
|
||||||
return;
|
return;
|
||||||
@@ -556,7 +623,7 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Rom
|
/// Fill any missing size and hash information from another Rom
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void FillMissingHashes(this Rom? self, Rom? other)
|
private static void FillMissingHashes(this Rom? self, Rom? other)
|
||||||
{
|
{
|
||||||
if (self == null || other == null)
|
if (self == null || other == null)
|
||||||
return;
|
return;
|
||||||
@@ -609,7 +676,24 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetDuplicateSuffix(this Disk? self)
|
public static string GetDuplicateSuffix(this DatItem? self)
|
||||||
|
{
|
||||||
|
if (self == null)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
return self switch
|
||||||
|
{
|
||||||
|
Disk diskSelf => GetDuplicateSuffix(diskSelf),
|
||||||
|
Media mediaSelf => GetDuplicateSuffix(mediaSelf),
|
||||||
|
Rom romSelf => GetDuplicateSuffix(romSelf),
|
||||||
|
_ => "_1",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get unique duplicate suffix on name collision
|
||||||
|
/// </summary>
|
||||||
|
private static string GetDuplicateSuffix(this Disk? self)
|
||||||
{
|
{
|
||||||
if (self == null)
|
if (self == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -628,7 +712,7 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetDuplicateSuffix(this Media? self)
|
private static string GetDuplicateSuffix(this Media? self)
|
||||||
{
|
{
|
||||||
if (self == null)
|
if (self == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -655,7 +739,7 @@ namespace SabreTools.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetDuplicateSuffix(this Rom? self)
|
private static string GetDuplicateSuffix(this Rom? self)
|
||||||
{
|
{
|
||||||
if (self == null)
|
if (self == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|||||||
@@ -70,13 +70,28 @@ namespace SabreTools.DatItems
|
|||||||
[JsonProperty("itemtype")]
|
[JsonProperty("itemtype")]
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
[XmlElement("itemtype")]
|
[XmlElement("itemtype")]
|
||||||
public ItemType ItemType { get; set; }
|
public ItemType ItemType
|
||||||
|
{
|
||||||
|
get => _internal.ReadString(Models.Internal.DatItem.TypeKey).AsItemType();
|
||||||
|
set => _internal[Models.Internal.DatItem.TypeKey] = value.FromItemType();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Duplicate type when compared to another item
|
/// Duplicate type when compared to another item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
public DupeType DupeType { get; set; }
|
public DupeType DupeType
|
||||||
|
{
|
||||||
|
get => _internal.Read<DupeType?>("DUPETYPE") ?? 0;
|
||||||
|
set => _internal["DUPETYPE"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal model wrapped by this DatItem
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore, XmlIgnore]
|
||||||
|
protected Models.Internal.DatItem _internal;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -85,8 +100,13 @@ namespace SabreTools.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Machine values
|
/// Machine values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
public Machine? Machine { get; set; } = new Machine();
|
public Machine? Machine
|
||||||
|
{
|
||||||
|
get => _internal.Read<Machine>("MACHINE") ?? new Machine();
|
||||||
|
set => _internal["MACHINE"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -95,14 +115,24 @@ namespace SabreTools.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Source information
|
/// Source information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
public Source? Source { get; set; } = new Source();
|
public Source? Source
|
||||||
|
{
|
||||||
|
get => _internal.Read<Source>("SOURCE") ?? new Source();
|
||||||
|
set => _internal["SOURCE"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag if item should be removed
|
/// Flag if item should be removed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
public bool Remove { get; set; }
|
public bool Remove
|
||||||
|
{
|
||||||
|
get => _internal.ReadBool("REMOVE") ?? false;
|
||||||
|
set => _internal["REMOVE"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion // Metadata information
|
#endregion // Metadata information
|
||||||
|
|
||||||
@@ -149,6 +179,7 @@ namespace SabreTools.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DatItem()
|
public DatItem()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Blank();
|
||||||
logger = new Logger(this);
|
logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +317,15 @@ namespace SabreTools.DatItems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">DatItem to use as a baseline</param>
|
/// <param name="other">DatItem to use as a baseline</param>
|
||||||
/// <returns>True if the items are duplicates, false otherwise</returns>
|
/// <returns>True if the items are duplicates, false otherwise</returns>
|
||||||
public abstract bool Equals(DatItem? other);
|
public virtual bool Equals(DatItem? other)
|
||||||
|
{
|
||||||
|
// If we don't have a matched type, return false
|
||||||
|
if (ItemType != other?.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Compare the internal models
|
||||||
|
return _internal.EqualTo(other._internal);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the duplicate status of two items
|
/// Return the duplicate status of two items
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _adjuster.ReadString(Models.Internal.Adjuster.NameKey);
|
get => _internal.ReadString(Models.Internal.Adjuster.NameKey);
|
||||||
set => _adjuster[Models.Internal.Adjuster.NameKey] = value;
|
set => _internal[Models.Internal.Adjuster.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _adjuster.ReadBool(Models.Internal.Adjuster.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.Adjuster.DefaultKey);
|
||||||
set => _adjuster[Models.Internal.Adjuster.DefaultKey] = value;
|
set => _internal[Models.Internal.Adjuster.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -43,19 +43,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
||||||
public List<Condition>? Conditions
|
public List<Condition>? Conditions
|
||||||
{
|
{
|
||||||
get => _adjuster.Read<Condition[]>(Models.Internal.Adjuster.ConditionKey)?.ToList();
|
get => _internal.Read<Condition[]>(Models.Internal.Adjuster.ConditionKey)?.ToList();
|
||||||
set => _adjuster[Models.Internal.Adjuster.ConditionKey] = value?.ToArray();
|
set => _internal[Models.Internal.Adjuster.ConditionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Adjuster model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Adjuster _adjuster = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -75,6 +69,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Adjuster()
|
public Adjuster()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Adjuster();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Adjuster;
|
ItemType = ItemType.Adjuster;
|
||||||
}
|
}
|
||||||
@@ -95,25 +90,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_adjuster = this._adjuster?.Clone() as Models.Internal.Adjuster ?? new Models.Internal.Adjuster(),
|
_internal = this._internal?.Clone() as Models.Internal.Adjuster ?? new Models.Internal.Adjuster(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Adjuster otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _adjuster.EqualTo(otherInternal._adjuster);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,16 +18,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
||||||
public string? Mask
|
public string? Mask
|
||||||
{
|
{
|
||||||
get => _analog.ReadString(Models.Internal.Analog.MaskKey);
|
get => _internal.ReadString(Models.Internal.Analog.MaskKey);
|
||||||
set => _analog[Models.Internal.Analog.MaskKey] = value;
|
set => _internal[Models.Internal.Analog.MaskKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Analog model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Analog _analog = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -37,6 +31,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Analog()
|
public Analog()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Analog();
|
||||||
ItemType = ItemType.Analog;
|
ItemType = ItemType.Analog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,25 +51,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_analog = this._analog?.Clone() as Models.Internal.Analog ?? new Models.Internal.Analog(),
|
_internal = this._internal?.Clone() as Models.Internal.Analog ?? new Models.Internal.Analog(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Analog, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Analog otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _analog.EqualTo(otherInternal._analog);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _archive.ReadString(Models.Internal.Archive.NameKey);
|
get => _internal.ReadString(Models.Internal.Archive.NameKey);
|
||||||
set => _archive[Models.Internal.Archive.NameKey] = value;
|
set => _internal[Models.Internal.Archive.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,12 +87,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("categories"), XmlElement("categories")]
|
[JsonProperty("categories"), XmlElement("categories")]
|
||||||
public string? Categories { get; set; }
|
public string? Categories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Archive model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Archive _archive = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -112,6 +106,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Archive()
|
public Archive()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Archive();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Archive;
|
ItemType = ItemType.Archive;
|
||||||
}
|
}
|
||||||
@@ -132,25 +127,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_archive = this._archive?.Clone() as Models.Internal.Archive ?? new Models.Internal.Archive(),
|
_internal = this._internal?.Clone() as Models.Internal.Archive ?? new Models.Internal.Archive(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Archive, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Archive otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _archive.EqualTo(otherInternal._archive);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,22 +19,22 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value"), XmlElement("value")]
|
[JsonProperty("value"), XmlElement("value")]
|
||||||
public bool? Value
|
public bool? Value
|
||||||
{
|
{
|
||||||
get => _original.ReadBool(Models.Internal.Original.ValueKey);
|
get => _internal.ReadBool(Models.Internal.Original.ValueKey);
|
||||||
set => _original[Models.Internal.Original.ValueKey] = value;
|
set => _internal[Models.Internal.Original.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("content"), XmlElement("content")]
|
[JsonProperty("content"), XmlElement("content")]
|
||||||
public string? Content
|
public string? Content
|
||||||
{
|
{
|
||||||
get => _original.ReadString(Models.Internal.Original.ContentKey);
|
get => _internal.ReadString(Models.Internal.Original.ContentKey);
|
||||||
set => _original[Models.Internal.Original.ContentKey] = value;
|
set => _internal[Models.Internal.Original.ContentKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal Original model
|
/// Internal Original model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private readonly Models.Internal.Original _original = new();
|
private readonly Models.Internal.Original _internal = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _biosSet.ReadString(Models.Internal.BiosSet.NameKey);
|
get => _internal.ReadString(Models.Internal.BiosSet.NameKey);
|
||||||
set => _biosSet[Models.Internal.BiosSet.NameKey] = value;
|
set => _internal[Models.Internal.BiosSet.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("description")]
|
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("description")]
|
||||||
public string? Description
|
public string? Description
|
||||||
{
|
{
|
||||||
get => _biosSet.ReadString(Models.Internal.BiosSet.DescriptionKey);
|
get => _internal.ReadString(Models.Internal.BiosSet.DescriptionKey);
|
||||||
set => _biosSet[Models.Internal.BiosSet.DescriptionKey] = value;
|
set => _internal[Models.Internal.BiosSet.DescriptionKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,19 +38,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _biosSet.ReadBool(Models.Internal.BiosSet.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.BiosSet.DefaultKey);
|
||||||
set => _biosSet[Models.Internal.BiosSet.DefaultKey] = value;
|
set => _internal[Models.Internal.BiosSet.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DefaultSpecified { get { return Default != null; } }
|
public bool DefaultSpecified { get { return Default != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal BiosSet model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.BiosSet _biosSet = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -70,6 +64,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BiosSet()
|
public BiosSet()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.BiosSet();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.BiosSet;
|
ItemType = ItemType.BiosSet;
|
||||||
}
|
}
|
||||||
@@ -90,25 +85,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_biosSet = this._biosSet?.Clone() as Models.Internal.BiosSet ?? new Models.Internal.BiosSet(),
|
_internal = this._internal?.Clone() as Models.Internal.BiosSet ?? new Models.Internal.BiosSet(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a BiosSet, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not BiosSet otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _biosSet.EqualTo(otherInternal._biosSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _chip.ReadString(Models.Internal.Chip.NameKey);
|
get => _internal.ReadString(Models.Internal.Chip.NameKey);
|
||||||
set => _chip[Models.Internal.Chip.NameKey] = value;
|
set => _internal[Models.Internal.Chip.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _chip.ReadString(Models.Internal.Chip.TagKey);
|
get => _internal.ReadString(Models.Internal.Chip.TagKey);
|
||||||
set => _chip[Models.Internal.Chip.TagKey] = value;
|
set => _internal[Models.Internal.Chip.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,8 +41,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public ChipType ChipType
|
public ChipType ChipType
|
||||||
{
|
{
|
||||||
get => _chip.ReadString(Models.Internal.Chip.ChipTypeKey).AsChipType();
|
get => _internal.ReadString(Models.Internal.Chip.ChipTypeKey).AsChipType();
|
||||||
set => _chip[Models.Internal.Chip.ChipTypeKey] = value.FromChipType();
|
set => _internal[Models.Internal.Chip.ChipTypeKey] = value.FromChipType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -54,19 +54,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("clock")]
|
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("clock")]
|
||||||
public long? Clock
|
public long? Clock
|
||||||
{
|
{
|
||||||
get => _chip.ReadLong(Models.Internal.Chip.ClockKey);
|
get => _internal.ReadLong(Models.Internal.Chip.ClockKey);
|
||||||
set => _chip[Models.Internal.Chip.ClockKey] = value;
|
set => _internal[Models.Internal.Chip.ClockKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ClockSpecified { get { return Clock != null; } }
|
public bool ClockSpecified { get { return Clock != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Chip model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Chip _chip = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -86,6 +80,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Chip()
|
public Chip()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Chip();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Chip;
|
ItemType = ItemType.Chip;
|
||||||
}
|
}
|
||||||
@@ -106,25 +101,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_chip = this._chip?.Clone() as Models.Internal.Chip ?? new Models.Internal.Chip(),
|
_internal = this._internal?.Clone() as Models.Internal.Chip ?? new Models.Internal.Chip(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Chip, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Chip otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _chip.EqualTo(otherInternal._chip);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _condition.ReadString(Models.Internal.Condition.TagKey);
|
get => _internal.ReadString(Models.Internal.Condition.TagKey);
|
||||||
set => _condition[Models.Internal.Condition.TagKey] = value;
|
set => _internal[Models.Internal.Condition.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
||||||
public string? Mask
|
public string? Mask
|
||||||
{
|
{
|
||||||
get => _condition.ReadString(Models.Internal.Condition.MaskKey);
|
get => _internal.ReadString(Models.Internal.Condition.MaskKey);
|
||||||
set => _condition[Models.Internal.Condition.MaskKey] = value;
|
set => _internal[Models.Internal.Condition.MaskKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,8 +41,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public Relation Relation
|
public Relation Relation
|
||||||
{
|
{
|
||||||
get => _condition.ReadString(Models.Internal.Condition.RelationKey).AsRelation();
|
get => _internal.ReadString(Models.Internal.Condition.RelationKey).AsRelation();
|
||||||
set => _condition[Models.Internal.Condition.RelationKey] = value.FromRelation();
|
set => _internal[Models.Internal.Condition.RelationKey] = value.FromRelation();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -54,16 +54,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _condition.ReadString(Models.Internal.Condition.ValueKey);
|
get => _internal.ReadString(Models.Internal.Condition.ValueKey);
|
||||||
set => _condition[Models.Internal.Condition.ValueKey] = value;
|
set => _internal[Models.Internal.Condition.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Condition model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Condition _condition = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -73,6 +67,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Condition()
|
public Condition()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Condition();
|
||||||
ItemType = ItemType.Condition;
|
ItemType = ItemType.Condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,25 +87,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_condition = this._condition?.Clone() as Models.Internal.Condition ?? new Models.Internal.Condition(),
|
_internal = this._internal?.Clone() as Models.Internal.Condition ?? new Models.Internal.Condition(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Condition, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Condition otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _condition.EqualTo(otherInternal._condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _confLocation.ReadString(Models.Internal.ConfLocation.NameKey);
|
get => _internal.ReadString(Models.Internal.ConfLocation.NameKey);
|
||||||
set => _confLocation[Models.Internal.ConfLocation.NameKey] = value;
|
set => _internal[Models.Internal.ConfLocation.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")]
|
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")]
|
||||||
public long? Number
|
public long? Number
|
||||||
{
|
{
|
||||||
get => _confLocation.ReadLong(Models.Internal.ConfLocation.NumberKey);
|
get => _internal.ReadLong(Models.Internal.ConfLocation.NumberKey);
|
||||||
set => _confLocation[Models.Internal.ConfLocation.NumberKey] = value;
|
set => _internal[Models.Internal.ConfLocation.NumberKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -41,19 +41,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
||||||
public bool? Inverted
|
public bool? Inverted
|
||||||
{
|
{
|
||||||
get => _confLocation.ReadBool(Models.Internal.ConfLocation.InvertedKey);
|
get => _internal.ReadBool(Models.Internal.ConfLocation.InvertedKey);
|
||||||
set => _confLocation[Models.Internal.ConfLocation.InvertedKey] = value;
|
set => _internal[Models.Internal.ConfLocation.InvertedKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool InvertedSpecified { get { return Inverted != null; } }
|
public bool InvertedSpecified { get { return Inverted != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal ConfLocation model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.ConfLocation _confLocation = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -73,6 +67,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ConfLocation()
|
public ConfLocation()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.ConfLocation();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.ConfLocation;
|
ItemType = ItemType.ConfLocation;
|
||||||
}
|
}
|
||||||
@@ -93,25 +88,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_confLocation = this._confLocation?.Clone() as Models.Internal.ConfLocation ?? new Models.Internal.ConfLocation(),
|
_internal = this._internal?.Clone() as Models.Internal.ConfLocation ?? new Models.Internal.ConfLocation(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a v, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not ConfLocation otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _confLocation.EqualTo(otherInternal._confLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _confSetting.ReadString(Models.Internal.ConfSetting.NameKey);
|
get => _internal.ReadString(Models.Internal.ConfSetting.NameKey);
|
||||||
set => _confSetting[Models.Internal.ConfSetting.NameKey] = value;
|
set => _internal[Models.Internal.ConfSetting.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _confSetting.ReadString(Models.Internal.ConfSetting.ValueKey);
|
get => _internal.ReadString(Models.Internal.ConfSetting.ValueKey);
|
||||||
set => _confSetting[Models.Internal.ConfSetting.ValueKey] = value;
|
set => _internal[Models.Internal.ConfSetting.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,8 +40,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _confSetting.ReadBool(Models.Internal.ConfSetting.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.ConfSetting.DefaultKey);
|
||||||
set => _confSetting[Models.Internal.ConfSetting.DefaultKey] = value;
|
set => _internal[Models.Internal.ConfSetting.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -53,19 +53,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
||||||
public List<Condition>? Conditions
|
public List<Condition>? Conditions
|
||||||
{
|
{
|
||||||
get => _confSetting.Read<Condition[]>(Models.Internal.ConfSetting.ConditionKey)?.ToList();
|
get => _internal.Read<Condition[]>(Models.Internal.ConfSetting.ConditionKey)?.ToList();
|
||||||
set => _confSetting[Models.Internal.ConfSetting.ConditionKey] = value?.ToArray();
|
set => _internal[Models.Internal.ConfSetting.ConditionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal ConfSetting model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.ConfSetting _confSetting = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -85,6 +79,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ConfSetting()
|
public ConfSetting()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.ConfSetting();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.ConfSetting;
|
ItemType = ItemType.ConfSetting;
|
||||||
}
|
}
|
||||||
@@ -105,25 +100,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_confSetting = this._confSetting?.Clone() as Models.Internal.ConfSetting ?? new Models.Internal.ConfSetting(),
|
_internal = this._internal?.Clone() as Models.Internal.ConfSetting ?? new Models.Internal.ConfSetting(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a ConfSetting, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not ConfSetting otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _confSetting.EqualTo(otherInternal._confSetting);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _configuration.ReadString(Models.Internal.Configuration.NameKey);
|
get => _internal.ReadString(Models.Internal.Configuration.NameKey);
|
||||||
set => _configuration[Models.Internal.Configuration.NameKey] = value;
|
set => _internal[Models.Internal.Configuration.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _configuration.ReadString(Models.Internal.Configuration.TagKey);
|
get => _internal.ReadString(Models.Internal.Configuration.TagKey);
|
||||||
set => _configuration[Models.Internal.Configuration.TagKey] = value;
|
set => _internal[Models.Internal.Configuration.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,8 +40,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
||||||
public string? Mask
|
public string? Mask
|
||||||
{
|
{
|
||||||
get => _configuration.ReadString(Models.Internal.Configuration.MaskKey);
|
get => _internal.ReadString(Models.Internal.Configuration.MaskKey);
|
||||||
set => _configuration[Models.Internal.Configuration.MaskKey] = value;
|
set => _internal[Models.Internal.Configuration.MaskKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -50,8 +50,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
||||||
public List<Condition>? Conditions
|
public List<Condition>? Conditions
|
||||||
{
|
{
|
||||||
get => _configuration.Read<Condition[]>(Models.Internal.Configuration.ConditionKey)?.ToList();
|
get => _internal.Read<Condition[]>(Models.Internal.Configuration.ConditionKey)?.ToList();
|
||||||
set => _configuration[Models.Internal.Configuration.ConditionKey] = value?.ToArray();
|
set => _internal[Models.Internal.Configuration.ConditionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -63,8 +63,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("locations")]
|
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("locations")]
|
||||||
public List<ConfLocation>? Locations
|
public List<ConfLocation>? Locations
|
||||||
{
|
{
|
||||||
get => _configuration.Read<ConfLocation[]>(Models.Internal.Configuration.ConfLocationKey)?.ToList();
|
get => _internal.Read<ConfLocation[]>(Models.Internal.Configuration.ConfLocationKey)?.ToList();
|
||||||
set => _configuration[Models.Internal.Configuration.ConfLocationKey] = value?.ToArray();
|
set => _internal[Models.Internal.Configuration.ConfLocationKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -76,19 +76,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("settings", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("settings")]
|
[JsonProperty("settings", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("settings")]
|
||||||
public List<ConfSetting>? Settings
|
public List<ConfSetting>? Settings
|
||||||
{
|
{
|
||||||
get => _configuration.Read<List<ConfSetting>>(Models.Internal.Configuration.ConfSettingKey);
|
get => _internal.Read<List<ConfSetting>>(Models.Internal.Configuration.ConfSettingKey);
|
||||||
set => _configuration[Models.Internal.Configuration.ConfSettingKey] = value;
|
set => _internal[Models.Internal.Configuration.ConfSettingKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool SettingsSpecified { get { return Settings != null && Settings.Count > 0; } }
|
public bool SettingsSpecified { get { return Settings != null && Settings.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Configuration model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Configuration _configuration = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -108,6 +102,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Configuration()
|
public Configuration()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Configuration();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Configuration;
|
ItemType = ItemType.Configuration;
|
||||||
}
|
}
|
||||||
@@ -128,25 +123,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_configuration = this._configuration?.Clone() as Models.Internal.Configuration ?? new Models.Internal.Configuration(),
|
_internal = this._internal?.Clone() as Models.Internal.Configuration ?? new Models.Internal.Configuration(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Configuration, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Configuration otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _configuration.EqualTo(otherInternal._configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public ControlType ControlType
|
public ControlType ControlType
|
||||||
{
|
{
|
||||||
get => _control.ReadString(Models.Internal.Control.ControlTypeKey).AsControlType();
|
get => _internal.ReadString(Models.Internal.Control.ControlTypeKey).AsControlType();
|
||||||
set => _control[Models.Internal.Control.ControlTypeKey] = value.FromControlType();
|
set => _internal[Models.Internal.Control.ControlTypeKey] = value.FromControlType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -34,8 +34,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("player", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("player")]
|
[JsonProperty("player", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("player")]
|
||||||
public long? Player
|
public long? Player
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.PlayerKey);
|
get => _internal.ReadLong(Models.Internal.Control.PlayerKey);
|
||||||
set => _control[Models.Internal.Control.PlayerKey] = value;
|
set => _internal[Models.Internal.Control.PlayerKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -47,8 +47,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("buttons", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("buttons")]
|
[JsonProperty("buttons", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("buttons")]
|
||||||
public long? Buttons
|
public long? Buttons
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.ButtonsKey);
|
get => _internal.ReadLong(Models.Internal.Control.ButtonsKey);
|
||||||
set => _control[Models.Internal.Control.ButtonsKey] = value;
|
set => _internal[Models.Internal.Control.ButtonsKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -60,8 +60,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("reqbuttons", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("reqbuttons")]
|
[JsonProperty("reqbuttons", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("reqbuttons")]
|
||||||
public long? RequiredButtons
|
public long? RequiredButtons
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.ReqButtonsKey);
|
get => _internal.ReadLong(Models.Internal.Control.ReqButtonsKey);
|
||||||
set => _control[Models.Internal.Control.ReqButtonsKey] = value;
|
set => _internal[Models.Internal.Control.ReqButtonsKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -73,8 +73,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("minimum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("minimum")]
|
[JsonProperty("minimum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("minimum")]
|
||||||
public long? Minimum
|
public long? Minimum
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.MinimumKey);
|
get => _internal.ReadLong(Models.Internal.Control.MinimumKey);
|
||||||
set => _control[Models.Internal.Control.MinimumKey] = value;
|
set => _internal[Models.Internal.Control.MinimumKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -86,8 +86,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("maximum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("maximum")]
|
[JsonProperty("maximum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("maximum")]
|
||||||
public long? Maximum
|
public long? Maximum
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.MaximumKey);
|
get => _internal.ReadLong(Models.Internal.Control.MaximumKey);
|
||||||
set => _control[Models.Internal.Control.MaximumKey] = value;
|
set => _internal[Models.Internal.Control.MaximumKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -99,8 +99,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sensitivity", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sensitivity")]
|
[JsonProperty("sensitivity", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sensitivity")]
|
||||||
public long? Sensitivity
|
public long? Sensitivity
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.SensitivityKey);
|
get => _internal.ReadLong(Models.Internal.Control.SensitivityKey);
|
||||||
set => _control[Models.Internal.Control.SensitivityKey] = value;
|
set => _internal[Models.Internal.Control.SensitivityKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -112,8 +112,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("keydelta", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("keydelta")]
|
[JsonProperty("keydelta", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("keydelta")]
|
||||||
public long? KeyDelta
|
public long? KeyDelta
|
||||||
{
|
{
|
||||||
get => _control.ReadLong(Models.Internal.Control.KeyDeltaKey);
|
get => _internal.ReadLong(Models.Internal.Control.KeyDeltaKey);
|
||||||
set => _control[Models.Internal.Control.KeyDeltaKey] = value;
|
set => _internal[Models.Internal.Control.KeyDeltaKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -125,8 +125,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("reverse", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("reverse")]
|
[JsonProperty("reverse", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("reverse")]
|
||||||
public bool? Reverse
|
public bool? Reverse
|
||||||
{
|
{
|
||||||
get => _control.ReadBool(Models.Internal.Control.ReverseKey);
|
get => _internal.ReadBool(Models.Internal.Control.ReverseKey);
|
||||||
set => _control[Models.Internal.Control.ReverseKey] = value;
|
set => _internal[Models.Internal.Control.ReverseKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -138,8 +138,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("ways", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways")]
|
[JsonProperty("ways", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways")]
|
||||||
public string? Ways
|
public string? Ways
|
||||||
{
|
{
|
||||||
get => _control.ReadString(Models.Internal.Control.WaysKey);
|
get => _internal.ReadString(Models.Internal.Control.WaysKey);
|
||||||
set => _control[Models.Internal.Control.WaysKey] = value;
|
set => _internal[Models.Internal.Control.WaysKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -148,8 +148,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("ways2", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways2")]
|
[JsonProperty("ways2", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways2")]
|
||||||
public string? Ways2
|
public string? Ways2
|
||||||
{
|
{
|
||||||
get => _control.ReadString(Models.Internal.Control.Ways2Key);
|
get => _internal.ReadString(Models.Internal.Control.Ways2Key);
|
||||||
set => _control[Models.Internal.Control.Ways2Key] = value;
|
set => _internal[Models.Internal.Control.Ways2Key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -158,16 +158,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("ways3", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways3")]
|
[JsonProperty("ways3", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ways3")]
|
||||||
public string? Ways3
|
public string? Ways3
|
||||||
{
|
{
|
||||||
get => _control.ReadString(Models.Internal.Control.Ways3Key);
|
get => _internal.ReadString(Models.Internal.Control.Ways3Key);
|
||||||
set => _control[Models.Internal.Control.Ways3Key] = value;
|
set => _internal[Models.Internal.Control.Ways3Key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Control model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Control _control = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -177,6 +171,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Control()
|
public Control()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Control();
|
||||||
ItemType = ItemType.Control;
|
ItemType = ItemType.Control;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,25 +191,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_control = this._control?.Clone() as Models.Internal.Control ?? new Models.Internal.Control(),
|
_internal = this._internal?.Clone() as Models.Internal.Control ?? new Models.Internal.Control(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Control, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Control otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _control.EqualTo(otherInternal._control);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("name")]
|
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _dataArea.ReadString(Models.Internal.DataArea.NameKey);
|
get => _internal.ReadString(Models.Internal.DataArea.NameKey);
|
||||||
set => _dataArea[Models.Internal.DataArea.NameKey] = value;
|
set => _internal[Models.Internal.DataArea.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("size")]
|
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("size")]
|
||||||
public long? Size
|
public long? Size
|
||||||
{
|
{
|
||||||
get => _dataArea.ReadLong(Models.Internal.DataArea.SizeKey);
|
get => _internal.ReadLong(Models.Internal.DataArea.SizeKey);
|
||||||
set => _dataArea[Models.Internal.DataArea.SizeKey] = value;
|
set => _internal[Models.Internal.DataArea.SizeKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -43,8 +43,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("width")]
|
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("width")]
|
||||||
public long? Width
|
public long? Width
|
||||||
{
|
{
|
||||||
get => _dataArea.ReadLong(Models.Internal.DataArea.WidthKey);
|
get => _internal.ReadLong(Models.Internal.DataArea.WidthKey);
|
||||||
set => _dataArea[Models.Internal.DataArea.WidthKey] = value;
|
set => _internal[Models.Internal.DataArea.WidthKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -56,19 +56,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("endianness")]
|
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("endianness")]
|
||||||
public Endianness Endianness
|
public Endianness Endianness
|
||||||
{
|
{
|
||||||
get => _dataArea.ReadString(Models.Internal.DataArea.WidthKey).AsEndianness();
|
get => _internal.ReadString(Models.Internal.DataArea.WidthKey).AsEndianness();
|
||||||
set => _dataArea[Models.Internal.DataArea.WidthKey] = value.FromEndianness();
|
set => _internal[Models.Internal.DataArea.WidthKey] = value.FromEndianness();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool EndiannessSpecified { get { return Endianness != Endianness.NULL; } }
|
public bool EndiannessSpecified { get { return Endianness != Endianness.NULL; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DataArea model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DataArea _dataArea = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -88,6 +82,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DataArea()
|
public DataArea()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DataArea();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DataArea;
|
ItemType = ItemType.DataArea;
|
||||||
}
|
}
|
||||||
@@ -108,25 +103,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_dataArea = this._dataArea?.Clone() as Models.Internal.DataArea ?? new Models.Internal.DataArea(),
|
_internal = this._internal?.Clone() as Models.Internal.DataArea ?? new Models.Internal.DataArea(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a DataArea, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DataArea otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _dataArea.EqualTo(otherInternal._dataArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public DeviceType DeviceType
|
public DeviceType DeviceType
|
||||||
{
|
{
|
||||||
get => _device.ReadString(Models.Internal.Device.DeviceTypeKey).AsDeviceType();
|
get => _internal.ReadString(Models.Internal.Device.DeviceTypeKey).AsDeviceType();
|
||||||
set => _device[Models.Internal.Device.DeviceTypeKey] = value.FromDeviceType();
|
set => _internal[Models.Internal.Device.DeviceTypeKey] = value.FromDeviceType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -36,8 +36,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _device.ReadString(Models.Internal.Device.TagKey);
|
get => _internal.ReadString(Models.Internal.Device.TagKey);
|
||||||
set => _device[Models.Internal.Device.TagKey] = value;
|
set => _internal[Models.Internal.Device.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -46,8 +46,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("fixed_image", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("fixed_image")]
|
[JsonProperty("fixed_image", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("fixed_image")]
|
||||||
public string? FixedImage
|
public string? FixedImage
|
||||||
{
|
{
|
||||||
get => _device.ReadString(Models.Internal.Device.FixedImageKey);
|
get => _internal.ReadString(Models.Internal.Device.FixedImageKey);
|
||||||
set => _device[Models.Internal.Device.FixedImageKey] = value;
|
set => _internal[Models.Internal.Device.FixedImageKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -57,8 +57,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mandatory")]
|
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mandatory")]
|
||||||
public long? Mandatory
|
public long? Mandatory
|
||||||
{
|
{
|
||||||
get => _device.ReadLong(Models.Internal.Device.MandatoryKey);
|
get => _internal.ReadLong(Models.Internal.Device.MandatoryKey);
|
||||||
set => _device[Models.Internal.Device.MandatoryKey] = value;
|
set => _internal[Models.Internal.Device.MandatoryKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -70,8 +70,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("interface", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("interface")]
|
[JsonProperty("interface", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("interface")]
|
||||||
public string? Interface
|
public string? Interface
|
||||||
{
|
{
|
||||||
get => _device.ReadString(Models.Internal.Device.InterfaceKey);
|
get => _internal.ReadString(Models.Internal.Device.InterfaceKey);
|
||||||
set => _device[Models.Internal.Device.InterfaceKey] = value;
|
set => _internal[Models.Internal.Device.InterfaceKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,8 +80,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("instances", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("instances")]
|
[JsonProperty("instances", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("instances")]
|
||||||
public List<Instance>? Instances
|
public List<Instance>? Instances
|
||||||
{
|
{
|
||||||
get => _device.Read<Instance[]>(Models.Internal.Device.InstanceKey)?.ToList();
|
get => _internal.Read<Instance[]>(Models.Internal.Device.InstanceKey)?.ToList();
|
||||||
set => _device[Models.Internal.Device.InstanceKey] = value?.ToArray();
|
set => _internal[Models.Internal.Device.InstanceKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -93,19 +93,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("extensions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("extensions")]
|
[JsonProperty("extensions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("extensions")]
|
||||||
public List<Extension>? Extensions
|
public List<Extension>? Extensions
|
||||||
{
|
{
|
||||||
get => _device.Read<Extension[]>(Models.Internal.Device.ExtensionKey)?.ToList();
|
get => _internal.Read<Extension[]>(Models.Internal.Device.ExtensionKey)?.ToList();
|
||||||
set => _device[Models.Internal.Device.ExtensionKey] = value?.ToArray();
|
set => _internal[Models.Internal.Device.ExtensionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ExtensionsSpecified { get { return Extensions != null && Extensions.Count > 0; } }
|
public bool ExtensionsSpecified { get { return Extensions != null && Extensions.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Device model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Device _device = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -115,6 +109,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Device()
|
public Device()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Device();
|
||||||
ItemType = ItemType.Device;
|
ItemType = ItemType.Device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,25 +129,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_device = this._device?.Clone() as Models.Internal.Device ?? new Models.Internal.Device(),
|
_internal = this._internal?.Clone() as Models.Internal.Device ?? new Models.Internal.Device(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Device otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _device.EqualTo(otherInternal._device);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,16 +18,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _deviceRef.ReadString(Models.Internal.DeviceRef.NameKey);
|
get => _internal.ReadString(Models.Internal.DeviceRef.NameKey);
|
||||||
set => _deviceRef[Models.Internal.DeviceRef.NameKey] = value;
|
set => _internal[Models.Internal.DeviceRef.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DeviceRef model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DeviceRef _deviceRef = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -47,6 +41,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DeviceReference()
|
public DeviceReference()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DeviceRef();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DeviceReference;
|
ItemType = ItemType.DeviceReference;
|
||||||
}
|
}
|
||||||
@@ -67,25 +62,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_deviceRef = this._deviceRef?.Clone() as Models.Internal.DeviceRef ?? new Models.Internal.DeviceRef(),
|
_internal = this._internal?.Clone() as Models.Internal.DeviceRef ?? new Models.Internal.DeviceRef(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DeviceReference otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _deviceRef.EqualTo(otherInternal._deviceRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _dipLocation.ReadString(Models.Internal.DipLocation.NameKey);
|
get => _internal.ReadString(Models.Internal.DipLocation.NameKey);
|
||||||
set => _dipLocation[Models.Internal.DipLocation.NameKey] = value;
|
set => _internal[Models.Internal.DipLocation.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")]
|
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")]
|
||||||
public long? Number
|
public long? Number
|
||||||
{
|
{
|
||||||
get => _dipLocation.ReadLong(Models.Internal.DipLocation.NameKey);
|
get => _internal.ReadLong(Models.Internal.DipLocation.NameKey);
|
||||||
set => _dipLocation[Models.Internal.DipLocation.NameKey] = value;
|
set => _internal[Models.Internal.DipLocation.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -41,19 +41,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
||||||
public bool? Inverted
|
public bool? Inverted
|
||||||
{
|
{
|
||||||
get => _dipLocation.ReadBool(Models.Internal.DipLocation.InvertedKey);
|
get => _internal.ReadBool(Models.Internal.DipLocation.InvertedKey);
|
||||||
set => _dipLocation[Models.Internal.DipLocation.InvertedKey] = value;
|
set => _internal[Models.Internal.DipLocation.InvertedKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool InvertedSpecified { get { return Inverted != null; } }
|
public bool InvertedSpecified { get { return Inverted != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DipLocation model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DipLocation _dipLocation = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -73,6 +67,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DipLocation()
|
public DipLocation()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DipLocation();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DipLocation;
|
ItemType = ItemType.DipLocation;
|
||||||
}
|
}
|
||||||
@@ -93,25 +88,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_dipLocation = this._dipLocation?.Clone() as Models.Internal.DipLocation ?? new Models.Internal.DipLocation(),
|
_internal = this._internal?.Clone() as Models.Internal.DipLocation ?? new Models.Internal.DipLocation(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a DipLocation, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DipLocation otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _dipLocation.EqualTo(otherInternal._dipLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _dipSwitch.ReadString(Models.Internal.DipSwitch.NameKey);
|
get => _internal.ReadString(Models.Internal.DipSwitch.NameKey);
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.NameKey] = value;
|
set => _internal[Models.Internal.DipSwitch.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -32,8 +32,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _dipSwitch.ReadString(Models.Internal.DipSwitch.TagKey);
|
get => _internal.ReadString(Models.Internal.DipSwitch.TagKey);
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.TagKey] = value;
|
set => _internal[Models.Internal.DipSwitch.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -42,8 +42,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mask")]
|
||||||
public string? Mask
|
public string? Mask
|
||||||
{
|
{
|
||||||
get => _dipSwitch.ReadString(Models.Internal.DipSwitch.MaskKey);
|
get => _internal.ReadString(Models.Internal.DipSwitch.MaskKey);
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.MaskKey] = value;
|
set => _internal[Models.Internal.DipSwitch.MaskKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,8 +52,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
||||||
public List<Condition>? Conditions
|
public List<Condition>? Conditions
|
||||||
{
|
{
|
||||||
get => _dipSwitch.Read<Condition[]>(Models.Internal.DipSwitch.ConditionKey)?.ToList();
|
get => _internal.Read<Condition[]>(Models.Internal.DipSwitch.ConditionKey)?.ToList();
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.ConditionKey] = value?.ToArray();
|
set => _internal[Models.Internal.DipSwitch.ConditionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -65,8 +65,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("locations")]
|
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("locations")]
|
||||||
public List<DipLocation>? Locations
|
public List<DipLocation>? Locations
|
||||||
{
|
{
|
||||||
get => _dipSwitch.Read<DipLocation[]>(Models.Internal.DipSwitch.DipLocationKey)?.ToList();
|
get => _internal.Read<DipLocation[]>(Models.Internal.DipSwitch.DipLocationKey)?.ToList();
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.DipLocationKey] = value?.ToArray();
|
set => _internal[Models.Internal.DipSwitch.DipLocationKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -78,8 +78,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("values", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("values")]
|
[JsonProperty("values", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("values")]
|
||||||
public List<DipValue>? Values
|
public List<DipValue>? Values
|
||||||
{
|
{
|
||||||
get => _dipSwitch.Read<DipValue[]>(Models.Internal.DipSwitch.DipValueKey)?.ToList();
|
get => _internal.Read<DipValue[]>(Models.Internal.DipSwitch.DipValueKey)?.ToList();
|
||||||
set => _dipSwitch[Models.Internal.DipSwitch.DipValueKey] = value?.ToArray();
|
set => _internal[Models.Internal.DipSwitch.DipValueKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -109,12 +109,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DipSwitch model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DipSwitch _dipSwitch = new();
|
|
||||||
|
|
||||||
#endregion // Fields
|
#endregion // Fields
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -134,6 +128,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DipSwitch()
|
public DipSwitch()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DipSwitch();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DipSwitch;
|
ItemType = ItemType.DipSwitch;
|
||||||
}
|
}
|
||||||
@@ -154,27 +149,12 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_dipSwitch = this._dipSwitch?.Clone() as Models.Internal.DipSwitch ?? new Models.Internal.DipSwitch(),
|
_internal = this._internal?.Clone() as Models.Internal.DipSwitch ?? new Models.Internal.DipSwitch(),
|
||||||
|
|
||||||
Part = this.Part,
|
Part = this.Part,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a DipSwitch, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DipSwitch otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _dipSwitch.EqualTo(otherInternal._dipSwitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _dipValue.ReadString(Models.Internal.DipValue.NameKey);
|
get => _internal.ReadString(Models.Internal.DipValue.NameKey);
|
||||||
set => _dipValue[Models.Internal.DipValue.NameKey] = value;
|
set => _internal[Models.Internal.DipValue.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +30,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _dipValue.ReadString(Models.Internal.DipValue.ValueKey);
|
get => _internal.ReadString(Models.Internal.DipValue.ValueKey);
|
||||||
set => _dipValue[Models.Internal.DipValue.ValueKey] = value;
|
set => _internal[Models.Internal.DipValue.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -40,8 +40,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _dipValue.ReadBool(Models.Internal.DipValue.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.DipValue.DefaultKey);
|
||||||
set => _dipValue[Models.Internal.DipValue.DefaultKey] = value;
|
set => _internal[Models.Internal.DipValue.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -53,19 +53,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
||||||
public List<Condition>? Conditions
|
public List<Condition>? Conditions
|
||||||
{
|
{
|
||||||
get => _dipValue.Read<Condition[]>(Models.Internal.DipValue.ConditionKey)?.ToList();
|
get => _internal.Read<Condition[]>(Models.Internal.DipValue.ConditionKey)?.ToList();
|
||||||
set => _dipValue[Models.Internal.DipValue.ConditionKey] = value?.ToArray();
|
set => _internal[Models.Internal.DipValue.ConditionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DipValue model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DipValue _dipValue = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -85,6 +79,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DipValue()
|
public DipValue()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DipValue();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DipValue;
|
ItemType = ItemType.DipValue;
|
||||||
}
|
}
|
||||||
@@ -105,25 +100,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_dipValue = this._dipValue?.Clone() as Models.Internal.DipValue ?? new Models.Internal.DipValue(),
|
_internal = this._internal?.Clone() as Models.Internal.DipValue ?? new Models.Internal.DipValue(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a DipValue, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DipValue otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _dipValue.EqualTo(otherInternal._dipValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.NameKey);
|
get => _internal.ReadString(Models.Internal.Disk.NameKey);
|
||||||
set => _disk[Models.Internal.Disk.NameKey] = value;
|
set => _internal[Models.Internal.Disk.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,8 +33,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
||||||
public string? MD5
|
public string? MD5
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.MD5Key);
|
get => _internal.ReadString(Models.Internal.Disk.MD5Key);
|
||||||
set => _disk[Models.Internal.Disk.MD5Key] = TextHelper.NormalizeMD5(value);
|
set => _internal[Models.Internal.Disk.MD5Key] = TextHelper.NormalizeMD5(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -43,8 +43,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
||||||
public string? SHA1
|
public string? SHA1
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.SHA1Key);
|
get => _internal.ReadString(Models.Internal.Disk.SHA1Key);
|
||||||
set => _disk[Models.Internal.Disk.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
set => _internal[Models.Internal.Disk.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,8 +53,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("merge")]
|
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("merge")]
|
||||||
public string? MergeTag
|
public string? MergeTag
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.MergeKey);
|
get => _internal.ReadString(Models.Internal.Disk.MergeKey);
|
||||||
set => _disk[Models.Internal.Disk.MergeKey] = value;
|
set => _internal[Models.Internal.Disk.MergeKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -63,8 +63,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
||||||
public string? Region
|
public string? Region
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.RegionKey);
|
get => _internal.ReadString(Models.Internal.Disk.RegionKey);
|
||||||
set => _disk[Models.Internal.Disk.RegionKey] = value;
|
set => _internal[Models.Internal.Disk.RegionKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,8 +73,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("index", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("index")]
|
[JsonProperty("index", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("index")]
|
||||||
public string? Index
|
public string? Index
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.IndexKey);
|
get => _internal.ReadString(Models.Internal.Disk.IndexKey);
|
||||||
set => _disk[Models.Internal.Disk.IndexKey] = value;
|
set => _internal[Models.Internal.Disk.IndexKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -83,8 +83,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("writable", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("writable")]
|
[JsonProperty("writable", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("writable")]
|
||||||
public bool? Writable
|
public bool? Writable
|
||||||
{
|
{
|
||||||
get => _disk.ReadBool(Models.Internal.Disk.WritableKey);
|
get => _internal.ReadBool(Models.Internal.Disk.WritableKey);
|
||||||
set => _disk[Models.Internal.Disk.WritableKey] = value;
|
set => _internal[Models.Internal.Disk.WritableKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -97,8 +97,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public ItemStatus ItemStatus
|
public ItemStatus ItemStatus
|
||||||
{
|
{
|
||||||
get => _disk.ReadString(Models.Internal.Disk.StatusKey).AsItemStatus();
|
get => _internal.ReadString(Models.Internal.Disk.StatusKey).AsItemStatus();
|
||||||
set => _disk[Models.Internal.Disk.StatusKey] = value.FromItemStatus(yesno: false);
|
set => _internal[Models.Internal.Disk.StatusKey] = value.FromItemStatus(yesno: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -110,8 +110,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("optional")]
|
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("optional")]
|
||||||
public bool? Optional
|
public bool? Optional
|
||||||
{
|
{
|
||||||
get => _disk.ReadBool(Models.Internal.Disk.OptionalKey);
|
get => _internal.ReadBool(Models.Internal.Disk.OptionalKey);
|
||||||
set => _disk[Models.Internal.Disk.OptionalKey] = value;
|
set => _internal[Models.Internal.Disk.OptionalKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -124,9 +124,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disk area information
|
/// Disk area information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is inverted from the internal model</remarks>
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonProperty("diskarea", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("diskarea")]
|
[JsonProperty("diskarea", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("diskarea")]
|
||||||
public DiskArea? DiskArea { get; set; }
|
public DiskArea? DiskArea
|
||||||
|
{
|
||||||
|
get => _internal.Read<DiskArea>("DISKAREA");
|
||||||
|
set => _internal["DISKAREA"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DiskAreaSpecified
|
public bool DiskAreaSpecified
|
||||||
@@ -141,9 +145,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Original hardware part associated with the item
|
/// Original hardware part associated with the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is inverted from the internal model</remarks>
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("part")]
|
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("part")]
|
||||||
public Part? Part { get; set; }
|
public Part? Part
|
||||||
|
{
|
||||||
|
get => _internal.Read<Part>("PART");
|
||||||
|
set => _internal["PART"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool PartSpecified
|
public bool PartSpecified
|
||||||
@@ -158,12 +166,6 @@ namespace SabreTools.DatItems.Formats
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Disk model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Disk _disk = new();
|
|
||||||
|
|
||||||
#endregion // Fields
|
#endregion // Fields
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -183,6 +185,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Disk()
|
public Disk()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Disk();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Disk;
|
ItemType = ItemType.Disk;
|
||||||
DupeType = 0x00;
|
DupeType = 0x00;
|
||||||
@@ -194,6 +197,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Disk(BaseFile baseFile)
|
public Disk(BaseFile baseFile)
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Disk();
|
||||||
Name = baseFile.Filename;
|
Name = baseFile.Filename;
|
||||||
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
|
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
|
||||||
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
|
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
|
||||||
@@ -219,10 +223,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_disk = this._disk?.Clone() as Models.Internal.Disk ?? new Models.Internal.Disk(),
|
_internal = this._internal?.Clone() as Models.Internal.Disk ?? new Models.Internal.Disk(),
|
||||||
|
|
||||||
DiskArea = this.DiskArea,
|
|
||||||
Part = this.Part,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Rom ConvertToRom()
|
public Rom ConvertToRom()
|
||||||
{
|
{
|
||||||
var rom = new Rom(_disk.ConvertToRom())
|
var rom = new Rom(_internal.ConvertToRom())
|
||||||
{
|
{
|
||||||
ItemType = ItemType.Rom,
|
ItemType = ItemType.Rom,
|
||||||
DupeType = this.DupeType,
|
DupeType = this.DupeType,
|
||||||
@@ -266,28 +267,17 @@ namespace SabreTools.DatItems.Formats
|
|||||||
|
|
||||||
#region Comparision Methods
|
#region Comparision Methods
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Disk, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Disk otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _disk.EqualTo(otherInternal._disk);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Disk
|
/// Fill any missing size and hash information from another Disk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">Disk to fill information from</param>
|
/// <param name="other">Disk to fill information from</param>
|
||||||
public void FillMissingInformation(Disk other) => _disk.FillMissingHashes(other?._disk);
|
public void FillMissingInformation(Disk other) => _internal.FillMissingHashes(other?._internal);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String representing the suffix</returns>
|
/// <returns>String representing the suffix</returns>
|
||||||
public string GetDuplicateSuffix() => _disk.GetDuplicateSuffix();
|
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -19,16 +19,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("name")]
|
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _diskArea.ReadString(Models.Internal.DiskArea.NameKey);
|
get => _internal.ReadString(Models.Internal.DiskArea.NameKey);
|
||||||
set => _diskArea[Models.Internal.DiskArea.NameKey] = value;
|
set => _internal[Models.Internal.DiskArea.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal DiskArea model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.DiskArea _diskArea = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -48,6 +42,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DiskArea()
|
public DiskArea()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.DiskArea();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.DiskArea;
|
ItemType = ItemType.DiskArea;
|
||||||
}
|
}
|
||||||
@@ -68,25 +63,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_diskArea = this._diskArea?.Clone() as Models.Internal.DiskArea ?? new Models.Internal.DiskArea(),
|
_internal = this._internal?.Clone() as Models.Internal.DiskArea ?? new Models.Internal.DiskArea(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a DiskArea, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not DiskArea otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _diskArea.EqualTo(otherInternal._diskArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _display.ReadString(Models.Internal.Display.TagKey);
|
get => _internal.ReadString(Models.Internal.Display.TagKey);
|
||||||
set => _display[Models.Internal.Display.TagKey] = value;
|
set => _internal[Models.Internal.Display.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,8 +31,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public DisplayType DisplayType
|
public DisplayType DisplayType
|
||||||
{
|
{
|
||||||
get => _display.ReadString(Models.Internal.Display.DisplayTypeKey).AsDisplayType();
|
get => _internal.ReadString(Models.Internal.Display.DisplayTypeKey).AsDisplayType();
|
||||||
set => _display[Models.Internal.Display.DisplayTypeKey] = value.FromDisplayType();
|
set => _internal[Models.Internal.Display.DisplayTypeKey] = value.FromDisplayType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -44,8 +44,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("rotate", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rotate")]
|
[JsonProperty("rotate", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rotate")]
|
||||||
public long? Rotate
|
public long? Rotate
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.RotateKey);
|
get => _internal.ReadLong(Models.Internal.Display.RotateKey);
|
||||||
set => _display[Models.Internal.Display.RotateKey] = value;
|
set => _internal[Models.Internal.Display.RotateKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -57,8 +57,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("flipx", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("flipx")]
|
[JsonProperty("flipx", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("flipx")]
|
||||||
public bool? FlipX
|
public bool? FlipX
|
||||||
{
|
{
|
||||||
get => _display.ReadBool(Models.Internal.Display.FlipXKey);
|
get => _internal.ReadBool(Models.Internal.Display.FlipXKey);
|
||||||
set => _display[Models.Internal.Display.FlipXKey] = value;
|
set => _internal[Models.Internal.Display.FlipXKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -70,8 +70,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("width")]
|
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("width")]
|
||||||
public long? Width
|
public long? Width
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.WidthKey);
|
get => _internal.ReadLong(Models.Internal.Display.WidthKey);
|
||||||
set => _display[Models.Internal.Display.WidthKey] = value;
|
set => _internal[Models.Internal.Display.WidthKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -83,8 +83,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("height")]
|
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("height")]
|
||||||
public long? Height
|
public long? Height
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.HeightKey);
|
get => _internal.ReadLong(Models.Internal.Display.HeightKey);
|
||||||
set => _display[Models.Internal.Display.HeightKey] = value;
|
set => _internal[Models.Internal.Display.HeightKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -96,8 +96,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("refresh")]
|
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("refresh")]
|
||||||
public double? Refresh
|
public double? Refresh
|
||||||
{
|
{
|
||||||
get => _display.ReadDouble(Models.Internal.Display.RefreshKey);
|
get => _internal.ReadDouble(Models.Internal.Display.RefreshKey);
|
||||||
set => _display[Models.Internal.Display.RefreshKey] = value;
|
set => _internal[Models.Internal.Display.RefreshKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -109,8 +109,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("pixclock", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("pixclock")]
|
[JsonProperty("pixclock", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("pixclock")]
|
||||||
public long? PixClock
|
public long? PixClock
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.PixClockKey);
|
get => _internal.ReadLong(Models.Internal.Display.PixClockKey);
|
||||||
set => _display[Models.Internal.Display.PixClockKey] = value;
|
set => _internal[Models.Internal.Display.PixClockKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -122,8 +122,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("htotal")]
|
[JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("htotal")]
|
||||||
public long? HTotal
|
public long? HTotal
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.HTotalKey);
|
get => _internal.ReadLong(Models.Internal.Display.HTotalKey);
|
||||||
set => _display[Models.Internal.Display.HTotalKey] = value;
|
set => _internal[Models.Internal.Display.HTotalKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -135,8 +135,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbend")]
|
[JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbend")]
|
||||||
public long? HBEnd
|
public long? HBEnd
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.HBEndKey);
|
get => _internal.ReadLong(Models.Internal.Display.HBEndKey);
|
||||||
set => _display[Models.Internal.Display.HBEndKey] = value;
|
set => _internal[Models.Internal.Display.HBEndKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -148,8 +148,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbstart")]
|
[JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("hbstart")]
|
||||||
public long? HBStart
|
public long? HBStart
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.HBStartKey);
|
get => _internal.ReadLong(Models.Internal.Display.HBStartKey);
|
||||||
set => _display[Models.Internal.Display.HBStartKey] = value;
|
set => _internal[Models.Internal.Display.HBStartKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -161,8 +161,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vtotal")]
|
[JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vtotal")]
|
||||||
public long? VTotal
|
public long? VTotal
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.VTotalKey);
|
get => _internal.ReadLong(Models.Internal.Display.VTotalKey);
|
||||||
set => _display[Models.Internal.Display.VTotalKey] = value;
|
set => _internal[Models.Internal.Display.VTotalKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -174,8 +174,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbend")]
|
[JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbend")]
|
||||||
public long? VBEnd
|
public long? VBEnd
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.VBEndKey);
|
get => _internal.ReadLong(Models.Internal.Display.VBEndKey);
|
||||||
set => _display[Models.Internal.Display.VBEndKey] = value;
|
set => _internal[Models.Internal.Display.VBEndKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -187,19 +187,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbstart")]
|
[JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("vbstart")]
|
||||||
public long? VBStart
|
public long? VBStart
|
||||||
{
|
{
|
||||||
get => _display.ReadLong(Models.Internal.Display.VBStartKey);
|
get => _internal.ReadLong(Models.Internal.Display.VBStartKey);
|
||||||
set => _display[Models.Internal.Display.VBStartKey] = value;
|
set => _internal[Models.Internal.Display.VBStartKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool VBStartSpecified { get { return VBStart != null; } }
|
public bool VBStartSpecified { get { return VBStart != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Display model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Display _display = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -209,6 +203,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Display()
|
public Display()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Display();
|
||||||
ItemType = ItemType.Display;
|
ItemType = ItemType.Display;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,25 +223,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_display = this._display?.Clone() as Models.Internal.Display ?? new Models.Internal.Display(),
|
_internal = this._internal?.Clone() as Models.Internal.Display ?? new Models.Internal.Display(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Display, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Display otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _display.EqualTo(otherInternal._display);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public SupportStatus Status
|
public SupportStatus Status
|
||||||
{
|
{
|
||||||
get => _driver.ReadString(Models.Internal.Driver.StatusKey).AsSupportStatus();
|
get => _internal.ReadString(Models.Internal.Driver.StatusKey).AsSupportStatus();
|
||||||
set => _driver[Models.Internal.Driver.StatusKey] = value.FromSupportStatus();
|
set => _internal[Models.Internal.Driver.StatusKey] = value.FromSupportStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -38,8 +38,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public SupportStatus Emulation
|
public SupportStatus Emulation
|
||||||
{
|
{
|
||||||
get => _driver.ReadString(Models.Internal.Driver.EmulationKey).AsSupportStatus();
|
get => _internal.ReadString(Models.Internal.Driver.EmulationKey).AsSupportStatus();
|
||||||
set => _driver[Models.Internal.Driver.EmulationKey] = value.FromSupportStatus();
|
set => _internal[Models.Internal.Driver.EmulationKey] = value.FromSupportStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -52,8 +52,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public SupportStatus Cocktail
|
public SupportStatus Cocktail
|
||||||
{
|
{
|
||||||
get => _driver.ReadString(Models.Internal.Driver.CocktailKey).AsSupportStatus();
|
get => _internal.ReadString(Models.Internal.Driver.CocktailKey).AsSupportStatus();
|
||||||
set => _driver[Models.Internal.Driver.CocktailKey] = value.FromSupportStatus();
|
set => _internal[Models.Internal.Driver.CocktailKey] = value.FromSupportStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -66,8 +66,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public Supported SaveState
|
public Supported SaveState
|
||||||
{
|
{
|
||||||
get => _driver.ReadString(Models.Internal.Driver.SaveStateKey).AsSupported();
|
get => _internal.ReadString(Models.Internal.Driver.SaveStateKey).AsSupported();
|
||||||
set => _driver[Models.Internal.Driver.SaveStateKey] = value.FromSupported(verbose: true);
|
set => _internal[Models.Internal.Driver.SaveStateKey] = value.FromSupported(verbose: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -79,8 +79,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("requiresartwork", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("requiresartwork")]
|
[JsonProperty("requiresartwork", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("requiresartwork")]
|
||||||
public bool? RequiresArtwork
|
public bool? RequiresArtwork
|
||||||
{
|
{
|
||||||
get => _driver.ReadBool(Models.Internal.Driver.RequiresArtworkKey);
|
get => _internal.ReadBool(Models.Internal.Driver.RequiresArtworkKey);
|
||||||
set => _driver[Models.Internal.Driver.RequiresArtworkKey] = value;
|
set => _internal[Models.Internal.Driver.RequiresArtworkKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -92,8 +92,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("unofficial", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("unofficial")]
|
[JsonProperty("unofficial", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("unofficial")]
|
||||||
public bool? Unofficial
|
public bool? Unofficial
|
||||||
{
|
{
|
||||||
get => _driver.ReadBool(Models.Internal.Driver.UnofficialKey);
|
get => _internal.ReadBool(Models.Internal.Driver.UnofficialKey);
|
||||||
set => _driver[Models.Internal.Driver.UnofficialKey] = value;
|
set => _internal[Models.Internal.Driver.UnofficialKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -105,8 +105,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("nosoundhardware", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nosoundhardware")]
|
[JsonProperty("nosoundhardware", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nosoundhardware")]
|
||||||
public bool? NoSoundHardware
|
public bool? NoSoundHardware
|
||||||
{
|
{
|
||||||
get => _driver.ReadBool(Models.Internal.Driver.NoSoundHardwareKey);
|
get => _internal.ReadBool(Models.Internal.Driver.NoSoundHardwareKey);
|
||||||
set => _driver[Models.Internal.Driver.NoSoundHardwareKey] = value;
|
set => _internal[Models.Internal.Driver.NoSoundHardwareKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -118,19 +118,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("incomplete", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("incomplete")]
|
[JsonProperty("incomplete", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("incomplete")]
|
||||||
public bool? Incomplete
|
public bool? Incomplete
|
||||||
{
|
{
|
||||||
get => _driver.ReadBool(Models.Internal.Driver.IncompleteKey);
|
get => _internal.ReadBool(Models.Internal.Driver.IncompleteKey);
|
||||||
set => _driver[Models.Internal.Driver.IncompleteKey] = value;
|
set => _internal[Models.Internal.Driver.IncompleteKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IncompleteSpecified { get { return Incomplete != null; } }
|
public bool IncompleteSpecified { get { return Incomplete != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Driver model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Driver _driver = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -140,6 +134,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Driver()
|
public Driver()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Driver();
|
||||||
ItemType = ItemType.Driver;
|
ItemType = ItemType.Driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,25 +154,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_driver = this._driver?.Clone() as Models.Internal.Driver ?? new Models.Internal.Driver(),
|
_internal = this._internal?.Clone() as Models.Internal.Driver ?? new Models.Internal.Driver(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Driver, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Driver otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _driver.EqualTo(otherInternal._driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,16 +18,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _extension.ReadString(Models.Internal.Extension.NameKey);
|
get => _internal.ReadString(Models.Internal.Extension.NameKey);
|
||||||
set => _extension[Models.Internal.Extension.NameKey] = value;
|
set => _internal[Models.Internal.Extension.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Extension model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Extension _extension = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -47,6 +41,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Extension()
|
public Extension()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Extension();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Extension;
|
ItemType = ItemType.Extension;
|
||||||
}
|
}
|
||||||
@@ -67,25 +62,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_extension = this._extension?.Clone() as Models.Internal.Extension ?? new Models.Internal.Extension(),
|
_internal = this._internal?.Clone() as Models.Internal.Extension ?? new Models.Internal.Extension(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Extension otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _extension.EqualTo(otherInternal._extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public FeatureType Type
|
public FeatureType Type
|
||||||
{
|
{
|
||||||
get => _feature.ReadString(Models.Internal.Feature.FeatureTypeKey).AsFeatureType();
|
get => _internal.ReadString(Models.Internal.Feature.FeatureTypeKey).AsFeatureType();
|
||||||
set => _feature[Models.Internal.Feature.FeatureTypeKey] = value.FromFeatureType();
|
set => _internal[Models.Internal.Feature.FeatureTypeKey] = value.FromFeatureType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -35,8 +35,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public FeatureStatus Status
|
public FeatureStatus Status
|
||||||
{
|
{
|
||||||
get => _feature.ReadString(Models.Internal.Feature.StatusKey).AsFeatureStatus();
|
get => _internal.ReadString(Models.Internal.Feature.StatusKey).AsFeatureStatus();
|
||||||
set => _feature[Models.Internal.Feature.StatusKey] = value.FromFeatureStatus();
|
set => _internal[Models.Internal.Feature.StatusKey] = value.FromFeatureStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -49,19 +49,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public FeatureStatus Overall
|
public FeatureStatus Overall
|
||||||
{
|
{
|
||||||
get => _feature.ReadString(Models.Internal.Feature.OverallKey).AsFeatureStatus();
|
get => _internal.ReadString(Models.Internal.Feature.OverallKey).AsFeatureStatus();
|
||||||
set => _feature[Models.Internal.Feature.OverallKey] = value.FromFeatureStatus();
|
set => _internal[Models.Internal.Feature.OverallKey] = value.FromFeatureStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool OverallSpecified { get { return Overall != FeatureStatus.NULL; } }
|
public bool OverallSpecified { get { return Overall != FeatureStatus.NULL; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Feature model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Feature _feature = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -71,6 +65,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Feature()
|
public Feature()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Feature();
|
||||||
ItemType = ItemType.Feature;
|
ItemType = ItemType.Feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,25 +85,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_feature = this._feature?.Clone() as Models.Internal.Feature ?? new Models.Internal.Feature(),
|
_internal = this._internal?.Clone() as Models.Internal.Feature ?? new Models.Internal.Feature(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Feature, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Feature otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _feature.EqualTo(otherInternal._feature);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _info.ReadString(Models.Internal.Info.NameKey);
|
get => _internal.ReadString(Models.Internal.Info.NameKey);
|
||||||
set => _info[Models.Internal.Info.NameKey] = value;
|
set => _internal[Models.Internal.Info.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,16 +28,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value"), XmlElement("value")]
|
[JsonProperty("value"), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _info.ReadString(Models.Internal.Info.ValueKey);
|
get => _internal.ReadString(Models.Internal.Info.ValueKey);
|
||||||
set => _info[Models.Internal.Info.ValueKey] = value;
|
set => _internal[Models.Internal.Info.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Info model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Info _info = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -57,6 +51,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Info()
|
public Info()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Info();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Info;
|
ItemType = ItemType.Info;
|
||||||
}
|
}
|
||||||
@@ -77,25 +72,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_info = this._info?.Clone() as Models.Internal.Info ?? new Models.Internal.Info(),
|
_internal = this._internal?.Clone() as Models.Internal.Info ?? new Models.Internal.Info(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Info, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Info otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _info.EqualTo(otherInternal._info);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("service")]
|
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("service")]
|
||||||
public bool? Service
|
public bool? Service
|
||||||
{
|
{
|
||||||
get => _input.ReadBool(Models.Internal.Input.ServiceKey);
|
get => _internal.ReadBool(Models.Internal.Input.ServiceKey);
|
||||||
set => _input[Models.Internal.Input.ServiceKey] = value;
|
set => _internal[Models.Internal.Input.ServiceKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -33,8 +33,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tilt")]
|
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tilt")]
|
||||||
public bool? Tilt
|
public bool? Tilt
|
||||||
{
|
{
|
||||||
get => _input.ReadBool(Models.Internal.Input.TiltKey);
|
get => _internal.ReadBool(Models.Internal.Input.TiltKey);
|
||||||
set => _input[Models.Internal.Input.TiltKey] = value;
|
set => _internal[Models.Internal.Input.TiltKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -46,8 +46,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("players")]
|
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("players")]
|
||||||
public long? Players
|
public long? Players
|
||||||
{
|
{
|
||||||
get => _input.ReadLong(Models.Internal.Input.PlayersKey);
|
get => _internal.ReadLong(Models.Internal.Input.PlayersKey);
|
||||||
set => _input[Models.Internal.Input.PlayersKey] = value;
|
set => _internal[Models.Internal.Input.PlayersKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -59,8 +59,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("coins")]
|
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("coins")]
|
||||||
public long? Coins
|
public long? Coins
|
||||||
{
|
{
|
||||||
get => _input.ReadLong(Models.Internal.Input.CoinsKey);
|
get => _internal.ReadLong(Models.Internal.Input.CoinsKey);
|
||||||
set => _input[Models.Internal.Input.CoinsKey] = value;
|
set => _internal[Models.Internal.Input.CoinsKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -72,19 +72,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("controls")]
|
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("controls")]
|
||||||
public List<Control>? Controls
|
public List<Control>? Controls
|
||||||
{
|
{
|
||||||
get => _input.Read<Control[]>(Models.Internal.Input.ControlKey)?.ToList();
|
get => _internal.Read<Control[]>(Models.Internal.Input.ControlKey)?.ToList();
|
||||||
set => _input[Models.Internal.Input.ControlKey] = value?.ToArray();
|
set => _internal[Models.Internal.Input.ControlKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ControlsSpecified { get { return Controls != null && Controls.Count > 0; } }
|
public bool ControlsSpecified { get { return Controls != null && Controls.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Input model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Input _input = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -94,6 +88,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Input()
|
public Input()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Input();
|
||||||
ItemType = ItemType.Input;
|
ItemType = ItemType.Input;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,25 +108,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_input = this._input?.Clone() as Models.Internal.Input ?? new Models.Internal.Input(),
|
_internal = this._internal?.Clone() as Models.Internal.Input ?? new Models.Internal.Input(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Input, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Input otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _input.EqualTo(otherInternal._input);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _instance.ReadString(Models.Internal.Instance.NameKey);
|
get => _internal.ReadString(Models.Internal.Instance.NameKey);
|
||||||
set => _instance[Models.Internal.Instance.NameKey] = value;
|
set => _internal[Models.Internal.Instance.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,16 +28,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("briefname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("briefname")]
|
[JsonProperty("briefname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("briefname")]
|
||||||
public string? BriefName
|
public string? BriefName
|
||||||
{
|
{
|
||||||
get => _instance.ReadString(Models.Internal.Instance.BriefNameKey);
|
get => _internal.ReadString(Models.Internal.Instance.BriefNameKey);
|
||||||
set => _instance[Models.Internal.Instance.BriefNameKey] = value;
|
set => _internal[Models.Internal.Instance.BriefNameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Instance model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Instance _instance = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -57,6 +51,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Instance()
|
public Instance()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Instance();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Instance;
|
ItemType = ItemType.Instance;
|
||||||
}
|
}
|
||||||
@@ -77,25 +72,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_instance = this._instance?.Clone() as Models.Internal.Instance ?? new Models.Internal.Instance(),
|
_internal = this._internal?.Clone() as Models.Internal.Instance ?? new Models.Internal.Instance(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Instance, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Instance otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _instance.EqualTo(otherInternal._instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _media.ReadString(Models.Internal.Media.NameKey);
|
get => _internal.ReadString(Models.Internal.Media.NameKey);
|
||||||
set => _media[Models.Internal.Media.NameKey] = value;
|
set => _internal[Models.Internal.Media.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,8 +31,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
||||||
public string? MD5
|
public string? MD5
|
||||||
{
|
{
|
||||||
get => _media.ReadString(Models.Internal.Media.MD5Key);
|
get => _internal.ReadString(Models.Internal.Media.MD5Key);
|
||||||
set => _media[Models.Internal.Media.MD5Key] = TextHelper.NormalizeMD5(value);
|
set => _internal[Models.Internal.Media.MD5Key] = TextHelper.NormalizeMD5(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,8 +41,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
||||||
public string? SHA1
|
public string? SHA1
|
||||||
{
|
{
|
||||||
get => _media.ReadString(Models.Internal.Media.SHA1Key);
|
get => _internal.ReadString(Models.Internal.Media.SHA1Key);
|
||||||
set => _media[Models.Internal.Media.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
set => _internal[Models.Internal.Media.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -51,8 +51,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha256")]
|
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha256")]
|
||||||
public string? SHA256
|
public string? SHA256
|
||||||
{
|
{
|
||||||
get => _media.ReadString(Models.Internal.Media.SHA256Key);
|
get => _internal.ReadString(Models.Internal.Media.SHA256Key);
|
||||||
set => _media[Models.Internal.Media.SHA256Key] = TextHelper.NormalizeSHA256(value);
|
set => _internal[Models.Internal.Media.SHA256Key] = TextHelper.NormalizeSHA256(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -61,16 +61,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("spamsum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("spamsum")]
|
[JsonProperty("spamsum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("spamsum")]
|
||||||
public string? SpamSum
|
public string? SpamSum
|
||||||
{
|
{
|
||||||
get => _media.ReadString(Models.Internal.Media.SpamSumKey);
|
get => _internal.ReadString(Models.Internal.Media.SpamSumKey);
|
||||||
set => _media[Models.Internal.Media.SpamSumKey] = value;
|
set => _internal[Models.Internal.Media.SpamSumKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Media model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Media _media = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -90,6 +84,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Media()
|
public Media()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Media();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Media;
|
ItemType = ItemType.Media;
|
||||||
DupeType = 0x00;
|
DupeType = 0x00;
|
||||||
@@ -101,6 +96,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <param name="baseFile"></param>
|
/// <param name="baseFile"></param>
|
||||||
public Media(BaseFile baseFile)
|
public Media(BaseFile baseFile)
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Media();
|
||||||
Name = baseFile.Filename;
|
Name = baseFile.Filename;
|
||||||
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
|
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
|
||||||
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
|
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
|
||||||
@@ -127,7 +123,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_media = this._media?.Clone() as Models.Internal.Media ?? new Models.Internal.Media(),
|
_internal = this._internal?.Clone() as Models.Internal.Media ?? new Models.Internal.Media(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +149,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Rom ConvertToRom()
|
public Rom ConvertToRom()
|
||||||
{
|
{
|
||||||
var rom = new Rom(_media.ConvertToRom())
|
var rom = new Rom(_internal.ConvertToRom())
|
||||||
{
|
{
|
||||||
ItemType = ItemType.Rom,
|
ItemType = ItemType.Rom,
|
||||||
DupeType = this.DupeType,
|
DupeType = this.DupeType,
|
||||||
@@ -170,28 +166,17 @@ namespace SabreTools.DatItems.Formats
|
|||||||
|
|
||||||
#region Comparision Methods
|
#region Comparision Methods
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Media, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Media otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _media.EqualTo(otherInternal._media);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Media
|
/// Fill any missing size and hash information from another Media
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">Media to fill information from</param>
|
/// <param name="other">Media to fill information from</param>
|
||||||
public void FillMissingInformation(Media other) => _media.FillMissingHashes(other?._media);
|
public void FillMissingInformation(Media other) => _internal.FillMissingHashes(other?._internal);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String representing the suffix</returns>
|
/// <returns>String representing the suffix</returns>
|
||||||
public string GetDuplicateSuffix() => _media.GetDuplicateSuffix();
|
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -18,33 +18,27 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _part.ReadString(Models.Internal.Part.NameKey);
|
get => _internal.ReadString(Models.Internal.Part.NameKey);
|
||||||
set => _part[Models.Internal.Part.NameKey] = value;
|
set => _internal[Models.Internal.Part.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("interface"), XmlElement("interface")]
|
[JsonProperty("interface"), XmlElement("interface")]
|
||||||
public string? Interface
|
public string? Interface
|
||||||
{
|
{
|
||||||
get => _part.ReadString(Models.Internal.Part.InterfaceKey);
|
get => _internal.ReadString(Models.Internal.Part.InterfaceKey);
|
||||||
set => _part[Models.Internal.Part.InterfaceKey] = value;
|
set => _internal[Models.Internal.Part.InterfaceKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("features")]
|
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("features")]
|
||||||
public List<PartFeature>? Features
|
public List<PartFeature>? Features
|
||||||
{
|
{
|
||||||
get => _part.Read<PartFeature[]>(Models.Internal.Part.FeatureKey)?.ToList();
|
get => _internal.Read<PartFeature[]>(Models.Internal.Part.FeatureKey)?.ToList();
|
||||||
set => _part[Models.Internal.Part.FeatureKey] = value?.ToArray();
|
set => _internal[Models.Internal.Part.FeatureKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool FeaturesSpecified { get { return Features != null && Features.Count > 0; } }
|
public bool FeaturesSpecified { get { return Features != null && Features.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Part model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Part _part = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -64,6 +58,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Part()
|
public Part()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Part();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Part;
|
ItemType = ItemType.Part;
|
||||||
}
|
}
|
||||||
@@ -84,25 +79,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_part = this._part?.Clone() as Models.Internal.Part ?? new Models.Internal.Part(),
|
_internal = this._internal?.Clone() as Models.Internal.Part ?? new Models.Internal.Part(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Part, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Part otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _part.EqualTo(otherInternal._part);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _feature.ReadString(Models.Internal.Feature.NameKey);
|
get => _internal.ReadString(Models.Internal.Feature.NameKey);
|
||||||
set => _feature[Models.Internal.Feature.NameKey] = value;
|
set => _internal[Models.Internal.Feature.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,16 +28,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value"), XmlElement("value")]
|
[JsonProperty("value"), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _feature.ReadString(Models.Internal.Feature.ValueKey);
|
get => _internal.ReadString(Models.Internal.Feature.ValueKey);
|
||||||
set => _feature[Models.Internal.Feature.ValueKey] = value;
|
set => _internal[Models.Internal.Feature.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Feature model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Feature _feature = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -57,6 +51,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PartFeature()
|
public PartFeature()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Feature();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.PartFeature;
|
ItemType = ItemType.PartFeature;
|
||||||
}
|
}
|
||||||
@@ -77,25 +72,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_feature = this._feature?.Clone() as Models.Internal.Feature ?? new Models.Internal.Feature(),
|
_internal = this._internal?.Clone() as Models.Internal.Feature ?? new Models.Internal.Feature(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a PartFeature, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not PartFeature otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _feature.EqualTo(otherInternal._feature);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _port.ReadString(Models.Internal.Port.TagKey);
|
get => _internal.ReadString(Models.Internal.Port.TagKey);
|
||||||
set => _port[Models.Internal.Port.TagKey] = value;
|
set => _internal[Models.Internal.Port.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,19 +30,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("analogs", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("analogs")]
|
[JsonProperty("analogs", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("analogs")]
|
||||||
public List<Analog>? Analogs
|
public List<Analog>? Analogs
|
||||||
{
|
{
|
||||||
get => _port.Read<Analog[]>(Models.Internal.Port.AnalogKey)?.ToList();
|
get => _internal.Read<Analog[]>(Models.Internal.Port.AnalogKey)?.ToList();
|
||||||
set => _port[Models.Internal.Port.AnalogKey] = value?.ToArray();
|
set => _internal[Models.Internal.Port.AnalogKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool AnalogsSpecified { get { return Analogs != null && Analogs.Count > 0; } }
|
public bool AnalogsSpecified { get { return Analogs != null && Analogs.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Port model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Port _port = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -52,6 +46,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Port()
|
public Port()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Port();
|
||||||
ItemType = ItemType.Port;
|
ItemType = ItemType.Port;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,25 +66,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_port = this._port?.Clone() as Models.Internal.Port ?? new Models.Internal.Port(),
|
_internal = this._internal?.Clone() as Models.Internal.Port ?? new Models.Internal.Port(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Port, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Port otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _port.EqualTo(otherInternal._port);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _ramOption.ReadString(Models.Internal.RamOption.NameKey);
|
get => _internal.ReadString(Models.Internal.RamOption.NameKey);
|
||||||
set => _ramOption[Models.Internal.RamOption.NameKey] = value;
|
set => _internal[Models.Internal.RamOption.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _ramOption.ReadBool(Models.Internal.RamOption.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.RamOption.DefaultKey);
|
||||||
set => _ramOption[Models.Internal.RamOption.DefaultKey] = value;
|
set => _internal[Models.Internal.RamOption.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -41,16 +41,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("content")]
|
[JsonProperty("content", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("content")]
|
||||||
public string? Content
|
public string? Content
|
||||||
{
|
{
|
||||||
get => _ramOption.ReadString(Models.Internal.RamOption.ContentKey);
|
get => _internal.ReadString(Models.Internal.RamOption.ContentKey);
|
||||||
set => _ramOption[Models.Internal.RamOption.ContentKey] = value;
|
set => _internal[Models.Internal.RamOption.ContentKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal RamOption model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.RamOption _ramOption = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -70,6 +64,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public RamOption()
|
public RamOption()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.RamOption();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.RamOption;
|
ItemType = ItemType.RamOption;
|
||||||
}
|
}
|
||||||
@@ -90,25 +85,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_ramOption = this._ramOption?.Clone() as Models.Internal.RamOption ?? new Models.Internal.RamOption(),
|
_internal = this._internal?.Clone() as Models.Internal.RamOption ?? new Models.Internal.RamOption(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a RamOption, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not RamOption otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _ramOption.EqualTo(otherInternal._ramOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _release.ReadString(Models.Internal.Release.NameKey);
|
get => _internal.ReadString(Models.Internal.Release.NameKey);
|
||||||
set => _release[Models.Internal.Release.NameKey] = value;
|
set => _internal[Models.Internal.Release.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
||||||
public string? Region
|
public string? Region
|
||||||
{
|
{
|
||||||
get => _release.ReadString(Models.Internal.Release.RegionKey);
|
get => _internal.ReadString(Models.Internal.Release.RegionKey);
|
||||||
set => _release[Models.Internal.Release.RegionKey] = value;
|
set => _internal[Models.Internal.Release.RegionKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,8 +38,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("language", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("language")]
|
[JsonProperty("language", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("language")]
|
||||||
public string? Language
|
public string? Language
|
||||||
{
|
{
|
||||||
get => _release.ReadString(Models.Internal.Release.LanguageKey);
|
get => _internal.ReadString(Models.Internal.Release.LanguageKey);
|
||||||
set => _release[Models.Internal.Release.LanguageKey] = value;
|
set => _internal[Models.Internal.Release.LanguageKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,8 +48,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
||||||
public string? Date
|
public string? Date
|
||||||
{
|
{
|
||||||
get => _release.ReadString(Models.Internal.Release.DateKey);
|
get => _internal.ReadString(Models.Internal.Release.DateKey);
|
||||||
set => _release[Models.Internal.Release.DateKey] = value;
|
set => _internal[Models.Internal.Release.DateKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -58,19 +58,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _release.ReadBool(Models.Internal.Release.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.Release.DefaultKey);
|
||||||
set => _release[Models.Internal.Release.DefaultKey] = value;
|
set => _internal[Models.Internal.Release.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DefaultSpecified { get { return Default != null; } }
|
public bool DefaultSpecified { get { return Default != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Release model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Release _release = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -90,6 +84,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Release()
|
public Release()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Release();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Release;
|
ItemType = ItemType.Release;
|
||||||
Region = string.Empty;
|
Region = string.Empty;
|
||||||
@@ -114,25 +109,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_release = this._release?.Clone() as Models.Internal.Release ?? new Models.Internal.Release(),
|
_internal = this._internal?.Clone() as Models.Internal.Release ?? new Models.Internal.Release(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Release, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Release otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _release.EqualTo(otherInternal._release);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.NameKey);
|
get => _internal.ReadString(Models.Internal.Rom.NameKey);
|
||||||
set => _rom[Models.Internal.Rom.NameKey] = value;
|
set => _internal[Models.Internal.Rom.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,8 +34,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("bios", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("bios")]
|
[JsonProperty("bios", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("bios")]
|
||||||
public string? Bios
|
public string? Bios
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.BiosKey);
|
get => _internal.ReadString(Models.Internal.Rom.BiosKey);
|
||||||
set => _rom[Models.Internal.Rom.BiosKey] = value;
|
set => _internal[Models.Internal.Rom.BiosKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -44,8 +44,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("size")]
|
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("size")]
|
||||||
public long? Size
|
public long? Size
|
||||||
{
|
{
|
||||||
get => _rom.ReadLong(Models.Internal.Rom.SizeKey);
|
get => _internal.ReadLong(Models.Internal.Rom.SizeKey);
|
||||||
set => _rom[Models.Internal.Rom.SizeKey] = value;
|
set => _internal[Models.Internal.Rom.SizeKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -57,8 +57,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("crc", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("crc")]
|
[JsonProperty("crc", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("crc")]
|
||||||
public string? CRC
|
public string? CRC
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.CRCKey);
|
get => _internal.ReadString(Models.Internal.Rom.CRCKey);
|
||||||
set => _rom[Models.Internal.Rom.CRCKey] = TextHelper.NormalizeCRC32(value);
|
set => _internal[Models.Internal.Rom.CRCKey] = TextHelper.NormalizeCRC32(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -67,8 +67,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("md5")]
|
||||||
public string? MD5
|
public string? MD5
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.MD5Key);
|
get => _internal.ReadString(Models.Internal.Rom.MD5Key);
|
||||||
set => _rom[Models.Internal.Rom.MD5Key] = TextHelper.NormalizeMD5(value);
|
set => _internal[Models.Internal.Rom.MD5Key] = TextHelper.NormalizeMD5(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -77,8 +77,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha1")]
|
||||||
public string? SHA1
|
public string? SHA1
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SHA1Key);
|
get => _internal.ReadString(Models.Internal.Rom.SHA1Key);
|
||||||
set => _rom[Models.Internal.Rom.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
set => _internal[Models.Internal.Rom.SHA1Key] = TextHelper.NormalizeSHA1(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,8 +87,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha256")]
|
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha256")]
|
||||||
public string? SHA256
|
public string? SHA256
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SHA256Key);
|
get => _internal.ReadString(Models.Internal.Rom.SHA256Key);
|
||||||
set => _rom[Models.Internal.Rom.SHA256Key] = TextHelper.NormalizeSHA256(value);
|
set => _internal[Models.Internal.Rom.SHA256Key] = TextHelper.NormalizeSHA256(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -97,8 +97,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha384", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha384")]
|
[JsonProperty("sha384", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha384")]
|
||||||
public string? SHA384
|
public string? SHA384
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SHA384Key);
|
get => _internal.ReadString(Models.Internal.Rom.SHA384Key);
|
||||||
set => _rom[Models.Internal.Rom.SHA384Key] = TextHelper.NormalizeSHA384(value);
|
set => _internal[Models.Internal.Rom.SHA384Key] = TextHelper.NormalizeSHA384(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -107,8 +107,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("sha512", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha512")]
|
[JsonProperty("sha512", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("sha512")]
|
||||||
public string? SHA512
|
public string? SHA512
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SHA512Key);
|
get => _internal.ReadString(Models.Internal.Rom.SHA512Key);
|
||||||
set => _rom[Models.Internal.Rom.SHA512Key] = TextHelper.NormalizeSHA512(value);
|
set => _internal[Models.Internal.Rom.SHA512Key] = TextHelper.NormalizeSHA512(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,8 +117,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("spamsum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("spamsum")]
|
[JsonProperty("spamsum", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("spamsum")]
|
||||||
public string? SpamSum
|
public string? SpamSum
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SpamSumKey);
|
get => _internal.ReadString(Models.Internal.Rom.SpamSumKey);
|
||||||
set => _rom[Models.Internal.Rom.SpamSumKey] = value;
|
set => _internal[Models.Internal.Rom.SpamSumKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -127,8 +127,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("merge")]
|
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("merge")]
|
||||||
public string? MergeTag
|
public string? MergeTag
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.MergeKey);
|
get => _internal.ReadString(Models.Internal.Rom.MergeKey);
|
||||||
set => _rom[Models.Internal.Rom.MergeKey] = value;
|
set => _internal[Models.Internal.Rom.MergeKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -137,8 +137,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("biregionos")]
|
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("biregionos")]
|
||||||
public string? Region
|
public string? Region
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.RegionKey);
|
get => _internal.ReadString(Models.Internal.Rom.RegionKey);
|
||||||
set => _rom[Models.Internal.Rom.RegionKey] = value;
|
set => _internal[Models.Internal.Rom.RegionKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -147,8 +147,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("offset", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("offset")]
|
[JsonProperty("offset", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("offset")]
|
||||||
public string? Offset
|
public string? Offset
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.OffsetKey);
|
get => _internal.ReadString(Models.Internal.Rom.OffsetKey);
|
||||||
set => _rom[Models.Internal.Rom.OffsetKey] = value;
|
set => _internal[Models.Internal.Rom.OffsetKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -157,8 +157,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
||||||
public string? Date
|
public string? Date
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.DateKey);
|
get => _internal.ReadString(Models.Internal.Rom.DateKey);
|
||||||
set => _rom[Models.Internal.Rom.DateKey] = value;
|
set => _internal[Models.Internal.Rom.DateKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -168,8 +168,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public ItemStatus ItemStatus
|
public ItemStatus ItemStatus
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.StatusKey).AsItemStatus();
|
get => _internal.ReadString(Models.Internal.Rom.StatusKey).AsItemStatus();
|
||||||
set => _rom[Models.Internal.Rom.StatusKey] = value.FromItemStatus(yesno: false);
|
set => _internal[Models.Internal.Rom.StatusKey] = value.FromItemStatus(yesno: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -181,8 +181,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("optional")]
|
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("optional")]
|
||||||
public bool? Optional
|
public bool? Optional
|
||||||
{
|
{
|
||||||
get => _rom.ReadBool(Models.Internal.Rom.OptionalKey);
|
get => _internal.ReadBool(Models.Internal.Rom.OptionalKey);
|
||||||
set => _rom[Models.Internal.Rom.OptionalKey] = value;
|
set => _internal[Models.Internal.Rom.OptionalKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -194,8 +194,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")]
|
||||||
public bool? Inverted
|
public bool? Inverted
|
||||||
{
|
{
|
||||||
get => _rom.ReadBool(Models.Internal.Rom.InvertedKey);
|
get => _internal.ReadBool(Models.Internal.Rom.InvertedKey);
|
||||||
set => _rom[Models.Internal.Rom.InvertedKey] = value;
|
set => _internal[Models.Internal.Rom.InvertedKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -211,8 +211,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("ado_source", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ado_source")]
|
[JsonProperty("ado_source", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ado_source")]
|
||||||
public string? ArchiveDotOrgSource
|
public string? ArchiveDotOrgSource
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SourceKey);
|
get => _internal.ReadString(Models.Internal.Rom.SourceKey);
|
||||||
set => _rom[Models.Internal.Rom.SourceKey] = value;
|
set => _internal[Models.Internal.Rom.SourceKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -221,8 +221,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("ado_format", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ado_format")]
|
[JsonProperty("ado_format", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("ado_format")]
|
||||||
public string? ArchiveDotOrgFormat
|
public string? ArchiveDotOrgFormat
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.FormatKey);
|
get => _internal.ReadString(Models.Internal.Rom.FormatKey);
|
||||||
set => _rom[Models.Internal.Rom.FormatKey] = value;
|
set => _internal[Models.Internal.Rom.FormatKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -231,8 +231,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("original_filename", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("original_filename")]
|
[JsonProperty("original_filename", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("original_filename")]
|
||||||
public string? OriginalFilename
|
public string? OriginalFilename
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.OriginalKey);
|
get => _internal.ReadString(Models.Internal.Rom.OriginalKey);
|
||||||
set => _rom[Models.Internal.Rom.OriginalKey] = value;
|
set => _internal[Models.Internal.Rom.OriginalKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -244,8 +244,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("rotation", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rotation")]
|
[JsonProperty("rotation", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rotation")]
|
||||||
public string? Rotation
|
public string? Rotation
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.RotationKey);
|
get => _internal.ReadString(Models.Internal.Rom.RotationKey);
|
||||||
set => _rom[Models.Internal.Rom.RotationKey] = value;
|
set => _internal[Models.Internal.Rom.RotationKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -254,8 +254,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("summation", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("summation")]
|
[JsonProperty("summation", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("summation")]
|
||||||
public string? Summation
|
public string? Summation
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.SummationKey);
|
get => _internal.ReadString(Models.Internal.Rom.SummationKey);
|
||||||
set => _rom[Models.Internal.Rom.SummationKey] = value;
|
set => _internal[Models.Internal.Rom.SummationKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -265,11 +265,11 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Alternate name for the item
|
/// Alternate name for the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("alt_romname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("alt_romname")]
|
[JsonProperty("alt_internalname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("alt_internalname")]
|
||||||
public string? AltName
|
public string? AltName
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.AltRomnameKey);
|
get => _internal.ReadString(Models.Internal.Rom.AltRomnameKey);
|
||||||
set => _rom[Models.Internal.Rom.AltRomnameKey] = value;
|
set => _internal[Models.Internal.Rom.AltRomnameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -278,8 +278,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("alt_title", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("alt_title")]
|
[JsonProperty("alt_title", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("alt_title")]
|
||||||
public string? AltTitle
|
public string? AltTitle
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.AltTitleKey);
|
get => _internal.ReadString(Models.Internal.Rom.AltTitleKey);
|
||||||
set => _rom[Models.Internal.Rom.AltTitleKey] = value;
|
set => _internal[Models.Internal.Rom.AltTitleKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -292,8 +292,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("mia", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mia")]
|
[JsonProperty("mia", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("mia")]
|
||||||
public bool? MIA
|
public bool? MIA
|
||||||
{
|
{
|
||||||
get => _rom.ReadBool(Models.Internal.Rom.MIAKey);
|
get => _internal.ReadBool(Models.Internal.Rom.MIAKey);
|
||||||
set => _rom[Models.Internal.Rom.MIAKey] = value;
|
set => _internal[Models.Internal.Rom.MIAKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -306,9 +306,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// OpenMSX sub item type
|
/// OpenMSX sub item type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is inverted from the internal model</remarks>
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonProperty("original", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("original")]
|
[JsonProperty("original", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("original")]
|
||||||
public Original? Original { get; set; }
|
public Original? Original
|
||||||
|
{
|
||||||
|
get => _internal.Read<Original>("ORIGINAL");
|
||||||
|
set => _internal["ORIGINAL"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool OriginalSpecified { get { return Original != null && Original != default; } }
|
public bool OriginalSpecified { get { return Original != null && Original != default; } }
|
||||||
@@ -320,8 +324,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public OpenMSXSubType OpenMSXSubType
|
public OpenMSXSubType OpenMSXSubType
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.OpenMSXMediaType).AsOpenMSXSubType();
|
get => _internal.ReadString(Models.Internal.Rom.OpenMSXMediaType).AsOpenMSXSubType();
|
||||||
set => _rom[Models.Internal.Rom.OpenMSXMediaType] = value.FromOpenMSXSubType();
|
set => _internal[Models.Internal.Rom.OpenMSXMediaType] = value.FromOpenMSXSubType();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -334,8 +338,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("openmsx_type", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("openmsx_type")]
|
[JsonProperty("openmsx_type", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("openmsx_type")]
|
||||||
public string? OpenMSXType
|
public string? OpenMSXType
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.OpenMSXType);
|
get => _internal.ReadString(Models.Internal.Rom.OpenMSXType);
|
||||||
set => _rom[Models.Internal.Rom.OpenMSXType] = value;
|
set => _internal[Models.Internal.Rom.OpenMSXType] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -344,8 +348,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("remark", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("remark")]
|
[JsonProperty("remark", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("remark")]
|
||||||
public string? Remark
|
public string? Remark
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.RemarkKey);
|
get => _internal.ReadString(Models.Internal.Rom.RemarkKey);
|
||||||
set => _rom[Models.Internal.Rom.RemarkKey] = value;
|
set => _internal[Models.Internal.Rom.RemarkKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -353,7 +357,11 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// TODO: Investigate where this value came from?
|
/// TODO: Investigate where this value came from?
|
||||||
[JsonProperty("boot", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("boot")]
|
[JsonProperty("boot", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("boot")]
|
||||||
public string? Boot { get; set; }
|
public string? Boot
|
||||||
|
{
|
||||||
|
get => _internal.ReadString("BOOT");
|
||||||
|
set => _internal["BOOT"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -362,9 +370,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Data area information
|
/// Data area information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is inverted from the internal model</remarks>
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonProperty("dataarea", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dataarea")]
|
[JsonProperty("dataarea", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dataarea")]
|
||||||
public DataArea? DataArea { get; set; } = null;
|
public DataArea? DataArea
|
||||||
|
{
|
||||||
|
get => _internal.Read<DataArea>("DATAAREA");
|
||||||
|
set => _internal["DATAAREA"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DataAreaSpecified
|
public bool DataAreaSpecified
|
||||||
@@ -386,8 +398,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public LoadFlag LoadFlag
|
public LoadFlag LoadFlag
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.LoadFlagKey).AsLoadFlag();
|
get => _internal.ReadString(Models.Internal.Rom.LoadFlagKey).AsLoadFlag();
|
||||||
set => _rom[Models.Internal.Rom.LoadFlagKey] = value.FromLoadFlag();
|
set => _internal[Models.Internal.Rom.LoadFlagKey] = value.FromLoadFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -396,9 +408,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Original hardware part associated with the item
|
/// Original hardware part associated with the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is inverted from the internal model</remarks>
|
/// <remarks>Hack on top of internal model</remarks>
|
||||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("part")]
|
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("part")]
|
||||||
public Part? Part { get; set; } = null;
|
public Part? Part
|
||||||
|
{
|
||||||
|
get => _internal.Read<Part>("PART");
|
||||||
|
set => _internal["PART"] = value;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool PartSpecified
|
public bool PartSpecified
|
||||||
@@ -417,18 +433,12 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _rom.ReadString(Models.Internal.Rom.ValueKey);
|
get => _internal.ReadString(Models.Internal.Rom.ValueKey);
|
||||||
set => _rom[Models.Internal.Rom.ValueKey] = value;
|
set => _internal[Models.Internal.Rom.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Rom model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Rom _rom = new();
|
|
||||||
|
|
||||||
#endregion // Fields
|
#endregion // Fields
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -448,6 +458,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Rom()
|
public Rom()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Rom();
|
||||||
Name = null;
|
Name = null;
|
||||||
ItemType = ItemType.Rom;
|
ItemType = ItemType.Rom;
|
||||||
DupeType = 0x00;
|
DupeType = 0x00;
|
||||||
@@ -462,6 +473,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <param name="omitFromScan"></param>
|
/// <param name="omitFromScan"></param>
|
||||||
public Rom(string name, string machineName)
|
public Rom(string name, string machineName)
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Rom();
|
||||||
Name = name;
|
Name = name;
|
||||||
ItemType = ItemType.Rom;
|
ItemType = ItemType.Rom;
|
||||||
Size = null;
|
Size = null;
|
||||||
@@ -480,6 +492,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// <param name="baseFile"></param>
|
/// <param name="baseFile"></param>
|
||||||
public Rom(BaseFile baseFile)
|
public Rom(BaseFile baseFile)
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Rom();
|
||||||
Name = baseFile.Filename;
|
Name = baseFile.Filename;
|
||||||
Size = baseFile.Size;
|
Size = baseFile.Size;
|
||||||
CRC = TextHelper.ByteArrayToString(baseFile.CRC);
|
CRC = TextHelper.ByteArrayToString(baseFile.CRC);
|
||||||
@@ -501,7 +514,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Rom(Models.Internal.Rom? rom)
|
public Rom(Models.Internal.Rom? rom)
|
||||||
{
|
{
|
||||||
_rom = rom ?? new Models.Internal.Rom();
|
_internal = rom ?? new Models.Internal.Rom();
|
||||||
|
|
||||||
ItemType = ItemType.Rom;
|
ItemType = ItemType.Rom;
|
||||||
DupeType = 0x00;
|
DupeType = 0x00;
|
||||||
@@ -525,10 +538,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_rom = this._rom?.Clone() as Models.Internal.Rom ?? new Models.Internal.Rom(),
|
_internal = this._internal?.Clone() as Models.Internal.Rom ?? new Models.Internal.Rom(),
|
||||||
|
|
||||||
DataArea = this.DataArea,
|
|
||||||
Part = this.Part,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,40 +567,29 @@ namespace SabreTools.DatItems.Formats
|
|||||||
|
|
||||||
#region Comparision Methods
|
#region Comparision Methods
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Rom, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Rom otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _rom.EqualTo(otherInternal._rom);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill any missing size and hash information from another Rom
|
/// Fill any missing size and hash information from another Rom
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">Rom to fill information from</param>
|
/// <param name="other">Rom to fill information from</param>
|
||||||
public void FillMissingInformation(Rom other) => _rom.FillMissingHashes(other?._rom);
|
public void FillMissingInformation(Rom other) => _internal.FillMissingHashes(other?._internal);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get unique duplicate suffix on name collision
|
/// Get unique duplicate suffix on name collision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>String representing the suffix</returns>
|
/// <returns>String representing the suffix</returns>
|
||||||
public string GetDuplicateSuffix() => _rom.GetDuplicateSuffix();
|
public string GetDuplicateSuffix() => _internal.GetDuplicateSuffix();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if the Rom contains any hashes
|
/// Returns if the Rom contains any hashes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if any hash exists, false otherwise</returns>
|
/// <returns>True if any hash exists, false otherwise</returns>
|
||||||
public bool HasHashes() => _rom.HasHashes();
|
public bool HasHashes() => _internal.HasHashes();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if all of the hashes are set to their 0-byte values
|
/// Returns if all of the hashes are set to their 0-byte values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if any hash matches the 0-byte value, false otherwise</returns>
|
/// <returns>True if any hash matches the 0-byte value, false otherwise</returns>
|
||||||
public bool HasZeroHash() => _rom.HasZeroHash();
|
public bool HasZeroHash() => _internal.HasZeroHash();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _sample.ReadString(Models.Internal.Sample.NameKey);
|
get => _internal.ReadString(Models.Internal.Sample.NameKey);
|
||||||
set => _sample[Models.Internal.Sample.NameKey] = value;
|
set => _internal[Models.Internal.Sample.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Sample model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Sample _sample = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -47,6 +41,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Sample()
|
public Sample()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Sample();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Sample;
|
ItemType = ItemType.Sample;
|
||||||
}
|
}
|
||||||
@@ -67,25 +62,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_sample = this._sample?.Clone() as Models.Internal.Sample ?? new Models.Internal.Sample(),
|
_internal = this._internal?.Clone() as Models.Internal.Sample ?? new Models.Internal.Sample(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Sample, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Sample otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _sample.EqualTo(otherInternal._sample);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _sharedFeat.ReadString(Models.Internal.SharedFeat.NameKey);
|
get => _internal.ReadString(Models.Internal.SharedFeat.NameKey);
|
||||||
set => _sharedFeat[Models.Internal.SharedFeat.NameKey] = value;
|
set => _internal[Models.Internal.SharedFeat.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,16 +28,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("value"), XmlElement("value")]
|
[JsonProperty("value"), XmlElement("value")]
|
||||||
public string? Value
|
public string? Value
|
||||||
{
|
{
|
||||||
get => _sharedFeat.ReadString(Models.Internal.SharedFeat.ValueKey);
|
get => _internal.ReadString(Models.Internal.SharedFeat.ValueKey);
|
||||||
set => _sharedFeat[Models.Internal.SharedFeat.ValueKey] = value;
|
set => _internal[Models.Internal.SharedFeat.ValueKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal SharedFeat model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.SharedFeat _sharedFeat = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -57,6 +51,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SharedFeature()
|
public SharedFeature()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.SharedFeat();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.SharedFeature;
|
ItemType = ItemType.SharedFeature;
|
||||||
}
|
}
|
||||||
@@ -77,25 +72,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_sharedFeat = this._sharedFeat?.Clone() as Models.Internal.SharedFeat ?? new Models.Internal.SharedFeat(),
|
_internal = this._internal?.Clone() as Models.Internal.SharedFeat ?? new Models.Internal.SharedFeat(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a SharedFeature, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not SharedFeature otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _sharedFeat.EqualTo(otherInternal._sharedFeat);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _slot.ReadString(Models.Internal.Slot.NameKey);
|
get => _internal.ReadString(Models.Internal.Slot.NameKey);
|
||||||
set => _slot[Models.Internal.Slot.NameKey] = value;
|
set => _internal[Models.Internal.Slot.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,19 +30,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("slotoptions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("slotoptions")]
|
[JsonProperty("slotoptions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("slotoptions")]
|
||||||
public List<SlotOption>? SlotOptions
|
public List<SlotOption>? SlotOptions
|
||||||
{
|
{
|
||||||
get => _slot.Read<SlotOption[]>(Models.Internal.Slot.SlotOptionKey)?.ToList();
|
get => _internal.Read<SlotOption[]>(Models.Internal.Slot.SlotOptionKey)?.ToList();
|
||||||
set => _slot[Models.Internal.Slot.SlotOptionKey] = value?.ToArray();
|
set => _internal[Models.Internal.Slot.SlotOptionKey] = value?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool SlotOptionsSpecified { get { return SlotOptions != null && SlotOptions.Count > 0; } }
|
public bool SlotOptionsSpecified { get { return SlotOptions != null && SlotOptions.Count > 0; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Slot model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Slot _slot = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -62,6 +56,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Slot()
|
public Slot()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Slot();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.Slot;
|
ItemType = ItemType.Slot;
|
||||||
}
|
}
|
||||||
@@ -82,25 +77,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_slot = this._slot?.Clone() as Models.Internal.Slot ?? new Models.Internal.Slot(),
|
_internal = this._internal?.Clone() as Models.Internal.Slot ?? new Models.Internal.Slot(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Slot, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Slot otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _slot.EqualTo(otherInternal._slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("name"), XmlElement("name")]
|
[JsonProperty("name"), XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _slotOption.ReadString(Models.Internal.SlotOption.NameKey);
|
get => _internal.ReadString(Models.Internal.SlotOption.NameKey);
|
||||||
set => _slotOption[Models.Internal.SlotOption.NameKey] = value;
|
set => _internal[Models.Internal.SlotOption.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +28,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("devname"), XmlElement("devname")]
|
[JsonProperty("devname"), XmlElement("devname")]
|
||||||
public string? DeviceName
|
public string? DeviceName
|
||||||
{
|
{
|
||||||
get => _slotOption.ReadString(Models.Internal.SlotOption.DevNameKey);
|
get => _internal.ReadString(Models.Internal.SlotOption.DevNameKey);
|
||||||
set => _slotOption[Models.Internal.SlotOption.DevNameKey] = value;
|
set => _internal[Models.Internal.SlotOption.DevNameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,19 +38,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
||||||
public bool? Default
|
public bool? Default
|
||||||
{
|
{
|
||||||
get => _slotOption.ReadBool(Models.Internal.SlotOption.DefaultKey);
|
get => _internal.ReadBool(Models.Internal.SlotOption.DefaultKey);
|
||||||
set => _slotOption[Models.Internal.SlotOption.DefaultKey] = value;
|
set => _internal[Models.Internal.SlotOption.DefaultKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DefaultSpecified { get { return Default != null; } }
|
public bool DefaultSpecified { get { return Default != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal SlotOption model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.SlotOption _slotOption = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -70,6 +64,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SlotOption()
|
public SlotOption()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.SlotOption();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.SlotOption;
|
ItemType = ItemType.SlotOption;
|
||||||
}
|
}
|
||||||
@@ -90,25 +85,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_slotOption = this._slotOption?.Clone() as Models.Internal.SlotOption ?? new Models.Internal.SlotOption(),
|
_internal = this._internal?.Clone() as Models.Internal.SlotOption ?? new Models.Internal.SlotOption(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not SlotOption otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _slotOption.EqualTo(otherInternal._slotOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[XmlElement("tag")]
|
[XmlElement("tag")]
|
||||||
public string? Tag
|
public string? Tag
|
||||||
{
|
{
|
||||||
get => _softwareList.ReadString(Models.Internal.SoftwareList.TagKey);
|
get => _internal.ReadString(Models.Internal.SoftwareList.TagKey);
|
||||||
set => _softwareList[Models.Internal.SoftwareList.TagKey] = value;
|
set => _internal[Models.Internal.SoftwareList.TagKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,8 +35,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[XmlElement("name")]
|
[XmlElement("name")]
|
||||||
public string? Name
|
public string? Name
|
||||||
{
|
{
|
||||||
get => _softwareList.ReadString(Models.Internal.SoftwareList.NameKey);
|
get => _internal.ReadString(Models.Internal.SoftwareList.NameKey);
|
||||||
set => _softwareList[Models.Internal.SoftwareList.NameKey] = value;
|
set => _internal[Models.Internal.SoftwareList.NameKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,8 +47,8 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[XmlElement("status")]
|
[XmlElement("status")]
|
||||||
public SoftwareListStatus Status
|
public SoftwareListStatus Status
|
||||||
{
|
{
|
||||||
get => _softwareList.ReadString(Models.Internal.SoftwareList.StatusKey).AsSoftwareListStatus();
|
get => _internal.ReadString(Models.Internal.SoftwareList.StatusKey).AsSoftwareListStatus();
|
||||||
set => _softwareList[Models.Internal.SoftwareList.StatusKey] = value.FromSoftwareListStatus();
|
set => _internal[Models.Internal.SoftwareList.StatusKey] = value.FromSoftwareListStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@@ -61,16 +61,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[XmlElement("filter")]
|
[XmlElement("filter")]
|
||||||
public string? Filter
|
public string? Filter
|
||||||
{
|
{
|
||||||
get => _softwareList.ReadString(Models.Internal.SoftwareList.FilterKey);
|
get => _internal.ReadString(Models.Internal.SoftwareList.FilterKey);
|
||||||
set => _softwareList[Models.Internal.SoftwareList.FilterKey] = value;
|
set => _internal[Models.Internal.SoftwareList.FilterKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal SoftwareList model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.SoftwareList _softwareList = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -90,6 +84,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SoftwareList()
|
public SoftwareList()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.SoftwareList();
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
ItemType = ItemType.SoftwareList;
|
ItemType = ItemType.SoftwareList;
|
||||||
}
|
}
|
||||||
@@ -109,24 +104,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_softwareList = this._softwareList?.Clone() as Models.Internal.SoftwareList ?? new Models.Internal.SoftwareList(),
|
_internal = this._internal?.Clone() as Models.Internal.SoftwareList ?? new Models.Internal.SoftwareList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Adjuster, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not SoftwareList otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _softwareList.EqualTo(otherInternal._softwareList);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,19 +18,13 @@ namespace SabreTools.DatItems.Formats
|
|||||||
[JsonProperty("channels", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("channels")]
|
[JsonProperty("channels", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("channels")]
|
||||||
public long? Channels
|
public long? Channels
|
||||||
{
|
{
|
||||||
get => _sound.ReadLong(Models.Internal.Sound.ChannelsKey);
|
get => _internal.ReadLong(Models.Internal.Sound.ChannelsKey);
|
||||||
set => _sound[Models.Internal.Sound.ChannelsKey] = value;
|
set => _internal[Models.Internal.Sound.ChannelsKey] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool ChannelsSpecified { get { return Channels != null; } }
|
public bool ChannelsSpecified { get { return Channels != null; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal Sound model
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
|
||||||
private Models.Internal.Sound _sound = new();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -40,6 +34,7 @@ namespace SabreTools.DatItems.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Sound()
|
public Sound()
|
||||||
{
|
{
|
||||||
|
_internal = new Models.Internal.Sound();
|
||||||
ItemType = ItemType.Sound;
|
ItemType = ItemType.Sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,25 +54,10 @@ namespace SabreTools.DatItems.Formats
|
|||||||
Source = this.Source?.Clone() as Source,
|
Source = this.Source?.Clone() as Source,
|
||||||
Remove = this.Remove,
|
Remove = this.Remove,
|
||||||
|
|
||||||
_sound = this._sound?.Clone() as Models.Internal.Sound ?? new Models.Internal.Sound(),
|
_internal = this._internal?.Clone() as Models.Internal.Sound ?? new Models.Internal.Sound(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparision Methods
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public override bool Equals(DatItem? other)
|
|
||||||
{
|
|
||||||
// If we don't have a Sound, return false
|
|
||||||
if (ItemType != other?.ItemType || other is not Sound otherInternal)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Compare the internal models
|
|
||||||
return _sound.EqualTo(otherInternal._sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user