mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make dat items serializable
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using SabreTools.Library.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -12,11 +13,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Description of the BIOS
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the BIOS is default
|
||||
/// </summary>
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -7,6 +7,7 @@ using SabreTools.Library.Data;
|
||||
using SabreTools.Library.DatFiles;
|
||||
using SabreTools.Library.Tools;
|
||||
using NaturalSort;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace SabreTools.Library.DatItems
|
||||
{
|
||||
#region Protected instance variables
|
||||
|
||||
// Machine information
|
||||
[JsonIgnore]
|
||||
protected Machine _machine = new Machine();
|
||||
|
||||
#endregion
|
||||
@@ -29,16 +30,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item type for outputting
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public ItemType ItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Duplicate type when compared to another item
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DupeType DupeType { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -48,6 +52,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Name of the machine associated with the item
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string MachineName
|
||||
{
|
||||
get
|
||||
@@ -73,6 +78,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Additional notes on the machine
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Comment
|
||||
{
|
||||
get
|
||||
@@ -98,6 +104,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Extended description of the machine
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string MachineDescription
|
||||
{
|
||||
get
|
||||
@@ -123,6 +130,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine year(s) of release/manufacture
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Year
|
||||
{
|
||||
get
|
||||
@@ -148,6 +156,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine manufacturer, if available
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Manufacturer
|
||||
{
|
||||
get
|
||||
@@ -173,6 +182,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine publisher, if available
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Publisher
|
||||
{
|
||||
get
|
||||
@@ -198,6 +208,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine romof parent
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string RomOf
|
||||
{
|
||||
get
|
||||
@@ -223,6 +234,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine cloneof parent
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string CloneOf
|
||||
{
|
||||
get
|
||||
@@ -248,6 +260,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine sampleof parent
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string SampleOf
|
||||
{
|
||||
get
|
||||
@@ -274,6 +287,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Machine support status
|
||||
/// </summary>
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
[JsonIgnore]
|
||||
public bool? Supported
|
||||
{
|
||||
get
|
||||
@@ -299,6 +313,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Emulator source file related to the machine
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string SourceFile
|
||||
{
|
||||
get
|
||||
@@ -325,6 +340,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Machine runnable status
|
||||
/// </summary>
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
[JsonIgnore]
|
||||
public bool? Runnable
|
||||
{
|
||||
get
|
||||
@@ -350,6 +366,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine board name
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Board
|
||||
{
|
||||
get
|
||||
@@ -375,6 +392,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Rebuild location if different than machine name
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string RebuildTo
|
||||
{
|
||||
get
|
||||
@@ -400,6 +418,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// List of associated device names
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public List<string> Devices
|
||||
{
|
||||
get
|
||||
@@ -425,6 +444,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public List<string> SlotOptions
|
||||
{
|
||||
get
|
||||
@@ -450,6 +470,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// List of info items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public List<KeyValuePair<string, string>> Infos
|
||||
{
|
||||
get
|
||||
@@ -475,6 +496,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Type of the associated machine
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public MachineType MachineType
|
||||
{
|
||||
get
|
||||
@@ -504,26 +526,31 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("partname")]
|
||||
public string PartName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware interface associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("partinterface")]
|
||||
public string PartInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Features provided to/by the item
|
||||
/// </summary>
|
||||
[JsonProperty("features")]
|
||||
public List<KeyValuePair<string, string>> Features { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part name within an item
|
||||
/// </summary>
|
||||
[JsonProperty("areaname")]
|
||||
public string AreaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware size within the part
|
||||
/// </summary>
|
||||
[JsonProperty("areasize")]
|
||||
public long? AreaSize { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -533,26 +560,31 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Internal system ID for organization
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public int SystemID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal system name for organization
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string System { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal source ID for organization
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public int SourceID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal source name for organization
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Flag if item should be removed
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool Remove { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using SabreTools.Library.Data;
|
||||
using SabreTools.Library.FileTypes;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -27,6 +28,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data MD5 hash
|
||||
/// </summary>
|
||||
[JsonProperty("md5")]
|
||||
public string MD5
|
||||
{
|
||||
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
||||
@@ -36,6 +38,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonProperty("ripemd160")]
|
||||
public string RIPEMD160
|
||||
{
|
||||
get { return _ripemd160.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_ripemd160); }
|
||||
@@ -45,6 +48,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-1 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha1")]
|
||||
public string SHA1
|
||||
{
|
||||
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||
@@ -54,6 +58,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-256 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha256")]
|
||||
public string SHA256
|
||||
{
|
||||
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||
@@ -63,6 +68,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-384 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha384")]
|
||||
public string SHA384
|
||||
{
|
||||
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||
@@ -72,6 +78,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-512 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha512")]
|
||||
public string SHA512
|
||||
{
|
||||
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||
@@ -81,31 +88,37 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Disk name to merge from parent
|
||||
/// </summary>
|
||||
[JsonProperty("merge")]
|
||||
public string MergeTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk region
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk index
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
public string Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk writable flag
|
||||
/// </summary>
|
||||
[JsonProperty("writable")]
|
||||
public bool? Writable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk dump status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public ItemStatus ItemStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the disk is optional in the set
|
||||
/// </summary>
|
||||
[JsonProperty("optional")]
|
||||
public bool? Optional { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SabreTools.Library.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -15,93 +16,111 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Name of the machine
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Additional notes
|
||||
/// </summary>
|
||||
[JsonProperty("comment")]
|
||||
public string Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extended description
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Year(s) of release/manufacture
|
||||
/// </summary>
|
||||
[JsonProperty("year")]
|
||||
public string Year { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Manufacturer, if available
|
||||
/// </summary>
|
||||
[JsonProperty("manufacturer")]
|
||||
public string Manufacturer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Publisher, if available
|
||||
/// </summary>
|
||||
[JsonProperty("publisher")]
|
||||
public string Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// fomof parent
|
||||
/// </summary>
|
||||
[JsonProperty("romof")]
|
||||
public string RomOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// cloneof parent
|
||||
/// </summary>
|
||||
[JsonProperty("cloneof")]
|
||||
public string CloneOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sampleof parent
|
||||
/// </summary>
|
||||
[JsonProperty("sampleof")]
|
||||
public string SampleOf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Support status
|
||||
/// </summary>
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
[JsonProperty("supported")]
|
||||
public bool? Supported { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emulator source file related to the machine
|
||||
/// </summary>
|
||||
[JsonProperty("sourcefile")]
|
||||
public string SourceFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Machine runnable status
|
||||
/// </summary>
|
||||
/// <remarks>yes = true, partial = null, no = false</remarks>
|
||||
[JsonProperty("runnable")]
|
||||
public bool? Runnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Machine board name
|
||||
/// </summary>
|
||||
[JsonProperty("board")]
|
||||
public string Board { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rebuild location if different than machine name
|
||||
/// </summary>
|
||||
[JsonProperty("rebuildto")]
|
||||
public string RebuildTo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of associated device names
|
||||
/// </summary>
|
||||
[JsonProperty("devices")]
|
||||
public List<string> Devices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<string> SlotOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of info items
|
||||
/// </summary>
|
||||
[JsonProperty("infos")]
|
||||
public List<KeyValuePair<string, string>> Infos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of the machine
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public MachineType MachineType { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SabreTools.Library.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -12,21 +13,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Release region(s)
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Release language(s)
|
||||
/// </summary>
|
||||
[JsonProperty("language")]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of release
|
||||
/// </summary>
|
||||
[JsonProperty("date")]
|
||||
public string Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default release, if applicable
|
||||
/// </summary>
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using SabreTools.Library.Data;
|
||||
using SabreTools.Library.FileTypes;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -28,16 +29,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// What BIOS is required for this rom
|
||||
/// </summary>
|
||||
[JsonProperty("bios")]
|
||||
public string Bios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Byte size of the rom
|
||||
/// </summary>
|
||||
[JsonProperty("size")]
|
||||
public long Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File CRC32 hash
|
||||
/// </summary>
|
||||
[JsonProperty("crc")]
|
||||
public string CRC
|
||||
{
|
||||
get { return _crc.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_crc); }
|
||||
@@ -47,6 +51,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File MD5 hash
|
||||
/// </summary>
|
||||
[JsonProperty("md5")]
|
||||
public string MD5
|
||||
{
|
||||
get { return _md5.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_md5); }
|
||||
@@ -56,6 +61,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonProperty("ripemd160")]
|
||||
public string RIPEMD160
|
||||
{
|
||||
get { return _ripemd160.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_ripemd160); }
|
||||
@@ -65,6 +71,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-1 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha1")]
|
||||
public string SHA1
|
||||
{
|
||||
get { return _sha1.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||
@@ -74,6 +81,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-256 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha256")]
|
||||
public string SHA256
|
||||
{
|
||||
get { return _sha256.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||
@@ -83,6 +91,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-384 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha384")]
|
||||
public string SHA384
|
||||
{
|
||||
get { return _sha384.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||
@@ -92,6 +101,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-512 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha512")]
|
||||
public string SHA512
|
||||
{
|
||||
get { return _sha512.IsNullOrWhiteSpace() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||
@@ -101,31 +111,37 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Rom name to merge from parent
|
||||
/// </summary>
|
||||
[JsonProperty("merge")]
|
||||
public string MergeTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rom region
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data offset within rom
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public string Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File created date
|
||||
/// </summary>
|
||||
[JsonProperty("date")]
|
||||
public string Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rom dump status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public ItemStatus ItemStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the rom is optional in the set
|
||||
/// </summary>
|
||||
[JsonProperty("optional")]
|
||||
public bool? Optional { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Data.Sqlite.Portable" Version="1.0.3.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SevenZipSharp.Net45" Version="1.0.19" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.1" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
|
||||
Reference in New Issue
Block a user