mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-09-21 22:44:51 +00:00
Add back some functionality to submission info
This commit is contained in:
55
SabreTools.RedumpLib/Data/Sections/DumpingInfoSection.cs
Normal file
55
SabreTools.RedumpLib/Data/Sections/DumpingInfoSection.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.RedumpLib.Data.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Dumping info section for moderation
|
||||
/// </summary>
|
||||
/// <remarks>These do not map to existing fields in a submission form</remarks>
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
/// </summary>
|
||||
/// TODO: Fill in specific details from redump.info
|
||||
/// TODO: Copy in moderation-only sections, like <see cref="RedumpOrg.Sections.DumpingInfoSection"/>
|
||||
public class SubmissionInfo : ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,11 +17,69 @@ namespace SabreTools.RedumpLib.Data
|
||||
[JsonProperty(PropertyName = "schema_version", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public int SchemaVersion { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// List of fully-matched Redump IDs
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public List<int>? FullyMatchedIDs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of partially-matched Redump IDs
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public List<int>? PartiallyMatchedIDs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of when the disc was added
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DateTime? Added { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of when the disc was last modified
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DateTime? LastModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dumping info section for moderation
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "dumping_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DumpingInfoSection DumpingInfo { get; set; } = new DumpingInfoSection();
|
||||
|
||||
/// <summary>
|
||||
/// Proof-of-concept section to handle additional attachments such as encoded files
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "artifacts", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Dictionary<string, string> Artifacts { get; set; } = [];
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
Dictionary<string, string> 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user