diff --git a/SabreTools.RedumpLib/Data/Sections/DumpingInfoSection.cs b/SabreTools.RedumpLib/Data/Sections/DumpingInfoSection.cs new file mode 100644 index 0000000..3b0261a --- /dev/null +++ b/SabreTools.RedumpLib/Data/Sections/DumpingInfoSection.cs @@ -0,0 +1,55 @@ +using System; +using Newtonsoft.Json; + +namespace SabreTools.RedumpLib.Data.Sections +{ + /// + /// Dumping info section for moderation + /// + /// These do not map to existing fields in a submission form + public class DumpingInfoSection : ICloneable + { + [JsonProperty(PropertyName = "frontend_version", DefaultValueHandling = DefaultValueHandling.Include)] + public string? FrontendVersion { get; set; } + + [JsonProperty(PropertyName = "dumping_program", DefaultValueHandling = DefaultValueHandling.Include)] + public string? DumpingProgram { get; set; } + + [JsonProperty(PropertyName = "dumping_date", DefaultValueHandling = DefaultValueHandling.Include)] + public string? DumpingDate { get; set; } + + [JsonProperty(PropertyName = "dumping_params", DefaultValueHandling = DefaultValueHandling.Include)] + public string? DumpingParameters { get; set; } + + [JsonProperty(PropertyName = "drive_manufacturer", DefaultValueHandling = DefaultValueHandling.Include)] + public string? Manufacturer { get; set; } + + [JsonProperty(PropertyName = "drive_model", DefaultValueHandling = DefaultValueHandling.Include)] + public string? Model { get; set; } + + [JsonProperty(PropertyName = "drive_firmware", DefaultValueHandling = DefaultValueHandling.Include)] + public string? Firmware { get; set; } + + [JsonProperty(PropertyName = "reported_disc_type", DefaultValueHandling = DefaultValueHandling.Include)] + public string? ReportedDiscType { get; set; } + + [JsonProperty(PropertyName = "errors_c2", NullValueHandling = NullValueHandling.Ignore)] + public string? C2ErrorsCount { get; set; } + + public object Clone() + { + return new DumpingInfoSection + { + FrontendVersion = this.FrontendVersion, + DumpingProgram = this.DumpingProgram, + DumpingDate = this.DumpingDate, + DumpingParameters = this.DumpingParameters, + Manufacturer = this.Manufacturer, + Model = this.Model, + Firmware = this.Firmware, + ReportedDiscType = this.ReportedDiscType, + C2ErrorsCount = this.C2ErrorsCount, + }; + } + } +} diff --git a/SabreTools.RedumpLib/Data/SubmissionInfo.cs b/SabreTools.RedumpLib/Data/SubmissionInfo.cs index 39ffab5..881a0f6 100644 --- a/SabreTools.RedumpLib/Data/SubmissionInfo.cs +++ b/SabreTools.RedumpLib/Data/SubmissionInfo.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using Newtonsoft.Json; +using SabreTools.RedumpLib.Data.Sections; namespace SabreTools.RedumpLib.Data { @@ -7,7 +9,6 @@ namespace SabreTools.RedumpLib.Data /// redump.info submission page information /// /// TODO: Fill in specific details from redump.info - /// TODO: Copy in moderation-only sections, like public class SubmissionInfo : ICloneable { /// @@ -16,11 +17,69 @@ namespace SabreTools.RedumpLib.Data [JsonProperty(PropertyName = "schema_version", DefaultValueHandling = DefaultValueHandling.Ignore)] public int SchemaVersion { get; set; } = 1; + /// + /// List of fully-matched Redump IDs + /// + /// + /// Media is considered to be a "full match" if all hash data is a match. + /// This means that media may also be considered a "full match" + /// even if it is missing a track. + /// + [JsonIgnore] + public List? FullyMatchedIDs { get; set; } + + /// + /// List of partially-matched Redump IDs + /// + /// + /// Media is considered to be a "partial match" if at least some hash data + /// is a match to another. In cases where there are shared tracks, this + /// can lead to a high number of partial matches. + /// + [JsonIgnore] + public List? PartiallyMatchedIDs { get; set; } + + /// + /// DateTime of when the disc was added + /// + [JsonIgnore] + public DateTime? Added { get; set; } + + /// + /// DateTime of when the disc was last modified + /// + [JsonIgnore] + public DateTime? LastModified { get; set; } + + /// + /// Dumping info section for moderation + /// + [JsonProperty(PropertyName = "dumping_info", DefaultValueHandling = DefaultValueHandling.Ignore)] + public DumpingInfoSection DumpingInfo { get; set; } = new DumpingInfoSection(); + + /// + /// Proof-of-concept section to handle additional attachments such as encoded files + /// + [JsonProperty(PropertyName = "artifacts", DefaultValueHandling = DefaultValueHandling.Ignore)] + public Dictionary Artifacts { get; set; } = []; + public object Clone() { + Dictionary artifacts = []; + foreach (var kvp in this.Artifacts) + { + artifacts[kvp.Key] = kvp.Value; + } + return new SubmissionInfo { SchemaVersion = this.SchemaVersion, + FullyMatchedIDs = this.FullyMatchedIDs, + PartiallyMatchedIDs = this.PartiallyMatchedIDs, + Added = this.Added, + LastModified = this.LastModified, + DumpingInfo = this.DumpingInfo?.Clone() as DumpingInfoSection ?? new DumpingInfoSection(), + Artifacts = artifacts, }; } }