More JSON decoration

This commit is contained in:
Matt Nadareski
2020-08-24 01:06:52 -07:00
parent ece8e0cae7
commit ed0fde6c18
3 changed files with 27 additions and 0 deletions

View File

@@ -16,12 +16,14 @@ using SabreTools.Library.Reports;
using SabreTools.Library.Skippers; using SabreTools.Library.Skippers;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
using NaturalSort; using NaturalSort;
using Newtonsoft.Json;
namespace SabreTools.Library.DatFiles namespace SabreTools.Library.DatFiles
{ {
/// <summary> /// <summary>
/// Represents a format-agnostic DAT /// Represents a format-agnostic DAT
/// </summary> /// </summary>
[JsonObject("datfile")]
public abstract class DatFile public abstract class DatFile
{ {
#region Fields #region Fields
@@ -29,11 +31,13 @@ namespace SabreTools.Library.DatFiles
/// <summary> /// <summary>
/// Header values /// Header values
/// </summary> /// </summary>
[JsonProperty("header")]
public DatHeader Header { get; set; } = new DatHeader(); public DatHeader Header { get; set; } = new DatHeader();
/// <summary> /// <summary>
/// DatItems and related statistics /// DatItems and related statistics
/// </summary> /// </summary>
[JsonProperty("items")]
public ItemDictionary Items { get; set; } = new ItemDictionary(); public ItemDictionary Items { get; set; } = new ItemDictionary();
#endregion #endregion

View File

@@ -11,6 +11,7 @@ namespace SabreTools.Library.DatFiles
/// <summary> /// <summary>
/// Represents all possible DAT header information /// Represents all possible DAT header information
/// </summary> /// </summary>
[JsonObject("header")]
public class DatHeader : ICloneable public class DatHeader : ICloneable
{ {
#region Fields #region Fields

View File

@@ -10,12 +10,14 @@ using SabreTools.Library.DatItems;
using SabreTools.Library.IO; using SabreTools.Library.IO;
using SabreTools.Library.Reports; using SabreTools.Library.Reports;
using NaturalSort; using NaturalSort;
using Newtonsoft.Json;
namespace SabreTools.Library.DatFiles namespace SabreTools.Library.DatFiles
{ {
/// <summary> /// <summary>
/// Item dictionary with statistics, bucketing, and sorting /// Item dictionary with statistics, bucketing, and sorting
/// </summary> /// </summary>
[JsonObject("items")]
public class ItemDictionary : IDictionary<string, List<DatItem>> public class ItemDictionary : IDictionary<string, List<DatItem>>
{ {
#region Private instance variables #region Private instance variables
@@ -71,104 +73,124 @@ namespace SabreTools.Library.DatFiles
/// <summary> /// <summary>
/// Overall item count /// Overall item count
/// </summary> /// </summary>
[JsonIgnore]
public long TotalCount { get; private set; } = 0; public long TotalCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of Archive items /// Number of Archive items
/// </summary> /// </summary>
[JsonIgnore]
public long ArchiveCount { get; private set; } = 0; public long ArchiveCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of BiosSet items /// Number of BiosSet items
/// </summary> /// </summary>
[JsonIgnore]
public long BiosSetCount { get; private set; } = 0; public long BiosSetCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of Disk items /// Number of Disk items
/// </summary> /// </summary>
[JsonIgnore]
public long DiskCount { get; private set; } = 0; public long DiskCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of Release items /// Number of Release items
/// </summary> /// </summary>
[JsonIgnore]
public long ReleaseCount { get; private set; } = 0; public long ReleaseCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of Rom items /// Number of Rom items
/// </summary> /// </summary>
[JsonIgnore]
public long RomCount { get; private set; } = 0; public long RomCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of Sample items /// Number of Sample items
/// </summary> /// </summary>
[JsonIgnore]
public long SampleCount { get; private set; } = 0; public long SampleCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of machines /// Number of machines
/// </summary> /// </summary>
/// <remarks>Special count only used by statistics output</remarks> /// <remarks>Special count only used by statistics output</remarks>
[JsonIgnore]
public long GameCount { get; private set; } = 0; public long GameCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Total uncompressed size /// Total uncompressed size
/// </summary> /// </summary>
[JsonIgnore]
public long TotalSize { get; private set; } = 0; public long TotalSize { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with a CRC hash /// Number of items with a CRC hash
/// </summary> /// </summary>
[JsonIgnore]
public long CRCCount { get; private set; } = 0; public long CRCCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with an MD5 hash /// Number of items with an MD5 hash
/// </summary> /// </summary>
[JsonIgnore]
public long MD5Count { get; private set; } = 0; public long MD5Count { get; private set; } = 0;
#if NET_FRAMEWORK #if NET_FRAMEWORK
/// <summary> /// <summary>
/// Number of items with a RIPEMD160 hash /// Number of items with a RIPEMD160 hash
/// </summary> /// </summary>
[JsonIgnore]
public long RIPEMD160Count { get; private set; } = 0; public long RIPEMD160Count { get; private set; } = 0;
#endif #endif
/// <summary> /// <summary>
/// Number of items with a SHA-1 hash /// Number of items with a SHA-1 hash
/// </summary> /// </summary>
[JsonIgnore]
public long SHA1Count { get; private set; } = 0; public long SHA1Count { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with a SHA-256 hash /// Number of items with a SHA-256 hash
/// </summary> /// </summary>
[JsonIgnore]
public long SHA256Count { get; private set; } = 0; public long SHA256Count { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with a SHA-384 hash /// Number of items with a SHA-384 hash
/// </summary> /// </summary>
[JsonIgnore]
public long SHA384Count { get; private set; } = 0; public long SHA384Count { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with a SHA-512 hash /// Number of items with a SHA-512 hash
/// </summary> /// </summary>
[JsonIgnore]
public long SHA512Count { get; private set; } = 0; public long SHA512Count { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with the baddump status /// Number of items with the baddump status
/// </summary> /// </summary>
[JsonIgnore]
public long BaddumpCount { get; private set; } = 0; public long BaddumpCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with the good status /// Number of items with the good status
/// </summary> /// </summary>
[JsonIgnore]
public long GoodCount { get; private set; } = 0; public long GoodCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with the nodump status /// Number of items with the nodump status
/// </summary> /// </summary>
[JsonIgnore]
public long NodumpCount { get; private set; } = 0; public long NodumpCount { get; private set; } = 0;
/// <summary> /// <summary>
/// Number of items with the verified status /// Number of items with the verified status
/// </summary> /// </summary>
[JsonIgnore]
public long VerifiedCount { get; private set; } = 0; public long VerifiedCount { get; private set; } = 0;
#endregion #endregion