Move old submission info, patch to tide over

This commit is contained in:
Matt Nadareski
2026-06-21 22:27:20 -04:00
parent 4e152a7f84
commit d2710afc84
22 changed files with 179 additions and 101 deletions

View File

@@ -1,10 +1,11 @@
using System;
using System.IO;
using SabreTools.RedumpLib.Data;
using Xunit;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
namespace SabreTools.RedumpLib.Test
{
// TODO: Remove all references to redump.org submission information
public class BuilderTests
{
[Theory]

View File

@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.Data;
using System.Linq;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using Xunit;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using SizeAndChecksumsSection = SabreTools.RedumpLib.RedumpOrg.Sections.SizeAndChecksumsSection;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
using TracksAndWriteOffsetsSection = SabreTools.RedumpLib.RedumpOrg.Sections.TracksAndWriteOffsetsSection;
namespace SabreTools.RedumpLib.Test.Data
{
@@ -12,7 +15,7 @@ namespace SabreTools.RedumpLib.Test.Data
{
#region Non-Enumerable
#region NormalizeDiscType
#region NormalizeDiscType
[Fact]
public void NormalizeDiscType_InvalidMedia_Untouched()

View File

@@ -3,9 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpInfo;
using Xunit;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using CopyProtectionSection = SabreTools.RedumpLib.RedumpOrg.Sections.CopyProtectionSection;
using DumpingInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.DumpingInfoSection;
using EDCSection = SabreTools.RedumpLib.RedumpOrg.Sections.EDCSection;
using ExtrasSection = SabreTools.RedumpLib.RedumpOrg.Sections.ExtrasSection;
using SizeAndChecksumsSection = SabreTools.RedumpLib.RedumpOrg.Sections.SizeAndChecksumsSection;
using TracksAndWriteOffsetsSection = SabreTools.RedumpLib.RedumpOrg.Sections.TracksAndWriteOffsetsSection;
using VersionAndEditionsSection = SabreTools.RedumpLib.RedumpOrg.Sections.VersionAndEditionsSection;
namespace SabreTools.RedumpLib.Test.RedumpInfo
{

View File

@@ -3,12 +3,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpOrg;
using Xunit;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using CopyProtectionSection = SabreTools.RedumpLib.RedumpOrg.Sections.CopyProtectionSection;
using DumpingInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.DumpingInfoSection;
using EDCSection = SabreTools.RedumpLib.RedumpOrg.Sections.EDCSection;
using ExtrasSection = SabreTools.RedumpLib.RedumpOrg.Sections.ExtrasSection;
using SizeAndChecksumsSection = SabreTools.RedumpLib.RedumpOrg.Sections.SizeAndChecksumsSection;
using TracksAndWriteOffsetsSection = SabreTools.RedumpLib.RedumpOrg.Sections.TracksAndWriteOffsetsSection;
using VersionAndEditionsSection = SabreTools.RedumpLib.RedumpOrg.Sections.VersionAndEditionsSection;
namespace SabreTools.RedumpLib.Test.RedumpOrg
{
// TODO: Remove all references to redump.org submission information
public class FormatterTests
{
#region ProcessSpecialFields

View File

@@ -2,11 +2,22 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using Xunit;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using CopyProtectionSection = SabreTools.RedumpLib.RedumpOrg.Sections.CopyProtectionSection;
using DumpersAndStatusSection = SabreTools.RedumpLib.RedumpOrg.Sections.DumpersAndStatusSection;
using DumpingInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.DumpingInfoSection;
using EDCSection = SabreTools.RedumpLib.RedumpOrg.Sections.EDCSection;
using ExtrasSection = SabreTools.RedumpLib.RedumpOrg.Sections.ExtrasSection;
using ParentCloneRelationshipSection = SabreTools.RedumpLib.RedumpOrg.Sections.ParentCloneRelationshipSection;
using SizeAndChecksumsSection = SabreTools.RedumpLib.RedumpOrg.Sections.SizeAndChecksumsSection;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
using TracksAndWriteOffsetsSection = SabreTools.RedumpLib.RedumpOrg.Sections.TracksAndWriteOffsetsSection;
using VersionAndEditionsSection = SabreTools.RedumpLib.RedumpOrg.Sections.VersionAndEditionsSection;
namespace SabreTools.RedumpLib.Test
{
// TODO: Remove all references to redump.org submission information
public class SubmissionInfoTests
{
[Fact]

View File

@@ -10,10 +10,13 @@ using System.Threading.Tasks;
using System.Xml;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
using VersionAndEditionsSection = SabreTools.RedumpLib.RedumpOrg.Sections.VersionAndEditionsSection;
namespace SabreTools.RedumpLib
{
// TODO: Remove all references to redump.org submission information
public static class Builder
{
#region Creation

View File

@@ -8,6 +8,7 @@ namespace SabreTools.RedumpLib.Data
/// <summary>
/// Information pertaining to Redump systems
/// </summary>
/// TODO: Remove all references to redump.org submission information
public static class Extensions
{
#region Non-Enumerable
@@ -39,7 +40,7 @@ namespace SabreTools.RedumpLib.Data
/// </summary>
/// <param name="info">Existing SubmissionInfo object to fill</param>
/// <returns>Corrected disc type, if possible</returns>
public static void NormalizeDiscType(this SubmissionInfo info)
public static void NormalizeDiscType(this RedumpOrg.SubmissionInfo info)
{
// If we have nothing valid, do nothing
if (info.CommonDiscInfo.Media is null || info.SizeAndChecksums == default)

View File

@@ -1,101 +1,26 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Data.Sections;
namespace SabreTools.RedumpLib.Data
{
/// <summary>
/// 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>
/// Version of the current schema
/// </summary>
[JsonProperty(PropertyName = "schema_version", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int SchemaVersion { get; set; } = 3;
/// <summary>
/// Fully matched Redump ID
/// </summary>
[JsonIgnore]
public int? FullyMatchedID { get; set; }
/// <summary>
/// List of partially matched Redump IDs
/// </summary>
[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; }
[JsonProperty(PropertyName = "common_disc_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
public CommonDiscInfoSection CommonDiscInfo { get; set; } = new CommonDiscInfoSection();
[JsonProperty(PropertyName = "versions_and_editions", DefaultValueHandling = DefaultValueHandling.Ignore)]
public VersionAndEditionsSection VersionAndEditions { get; set; } = new VersionAndEditionsSection();
[JsonProperty(PropertyName = "edc", DefaultValueHandling = DefaultValueHandling.Ignore)]
public EDCSection EDC { get; set; } = new EDCSection();
[JsonProperty(PropertyName = "parent_clone_relationship", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ParentCloneRelationshipSection ParentCloneRelationship { get; set; } = new ParentCloneRelationshipSection();
[JsonProperty(PropertyName = "extras", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ExtrasSection Extras { get; set; } = new ExtrasSection();
[JsonProperty(PropertyName = "copy_protection", DefaultValueHandling = DefaultValueHandling.Ignore)]
public CopyProtectionSection CopyProtection { get; set; } = new CopyProtectionSection();
[JsonProperty(PropertyName = "dumpers_and_status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DumpersAndStatusSection DumpersAndStatus { get; set; } = new DumpersAndStatusSection();
[JsonProperty(PropertyName = "tracks_and_write_offsets", DefaultValueHandling = DefaultValueHandling.Ignore)]
public TracksAndWriteOffsetsSection TracksAndWriteOffsets { get; set; } = new TracksAndWriteOffsetsSection();
[JsonProperty(PropertyName = "size_and_checksums", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SizeAndChecksumsSection SizeAndChecksums { get; set; } = new SizeAndChecksumsSection();
[JsonProperty(PropertyName = "dumping_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DumpingInfoSection DumpingInfo { get; set; } = new DumpingInfoSection();
[JsonProperty(PropertyName = "artifacts", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Dictionary<string, string> Artifacts { get; set; } = [];
public int SchemaVersion { get; set; } = 1;
public object Clone()
{
Dictionary<string, string> artifacts = [];
foreach (var kvp in this.Artifacts)
{
artifacts[kvp.Key] = kvp.Value;
}
return new SubmissionInfo
{
SchemaVersion = this.SchemaVersion,
FullyMatchedID = this.FullyMatchedID,
PartiallyMatchedIDs = this.PartiallyMatchedIDs,
Added = this.Added,
LastModified = this.LastModified,
CommonDiscInfo = this.CommonDiscInfo?.Clone() as CommonDiscInfoSection ?? new CommonDiscInfoSection(),
VersionAndEditions = this.VersionAndEditions?.Clone() as VersionAndEditionsSection ?? new VersionAndEditionsSection(),
EDC = this.EDC?.Clone() as EDCSection ?? new EDCSection(),
ParentCloneRelationship = this.ParentCloneRelationship?.Clone() as ParentCloneRelationshipSection ?? new ParentCloneRelationshipSection(),
Extras = this.Extras?.Clone() as ExtrasSection ?? new ExtrasSection(),
CopyProtection = this.CopyProtection?.Clone() as CopyProtectionSection ?? new CopyProtectionSection(),
DumpersAndStatus = this.DumpersAndStatus?.Clone() as DumpersAndStatusSection ?? new DumpersAndStatusSection(),
TracksAndWriteOffsets = this.TracksAndWriteOffsets?.Clone() as TracksAndWriteOffsetsSection ?? new TracksAndWriteOffsetsSection(),
SizeAndChecksums = this.SizeAndChecksums?.Clone() as SizeAndChecksumsSection ?? new SizeAndChecksumsSection(),
DumpingInfo = this.DumpingInfo?.Clone() as DumpingInfoSection ?? new DumpingInfoSection(),
Artifacts = artifacts,
};
}
}

View File

@@ -3,10 +3,19 @@ using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using CommonDiscInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.CommonDiscInfoSection;
using CopyProtectionSection = SabreTools.RedumpLib.RedumpOrg.Sections.CopyProtectionSection;
using DumpingInfoSection = SabreTools.RedumpLib.RedumpOrg.Sections.DumpingInfoSection;
using EDCSection = SabreTools.RedumpLib.RedumpOrg.Sections.EDCSection;
using ExtrasSection = SabreTools.RedumpLib.RedumpOrg.Sections.ExtrasSection;
using SizeAndChecksumsSection = SabreTools.RedumpLib.RedumpOrg.Sections.SizeAndChecksumsSection;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
using TracksAndWriteOffsetsSection = SabreTools.RedumpLib.RedumpOrg.Sections.TracksAndWriteOffsetsSection;
using VersionAndEditionsSection = SabreTools.RedumpLib.RedumpOrg.Sections.VersionAndEditionsSection;
namespace SabreTools.RedumpLib.RedumpInfo
{
// TODO: Remove all references to redump.org submission information
public static class Formatter
{
/// <summary>

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using SabreTools.RedumpLib.Data;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
namespace SabreTools.RedumpLib.RedumpInfo
{

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Data.Sections;
using SabreTools.RedumpLib.RedumpOrg.Sections;
namespace SabreTools.RedumpLib.RedumpOrg
{

View File

@@ -2,9 +2,10 @@ using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Converters;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.RedumpOrg.Converters;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Common disc info section of New Disc Form

View File

@@ -2,8 +2,9 @@ using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Converters;
using SabreTools.RedumpLib.Data;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Copy protection section of New Disc form

View File

@@ -1,7 +1,8 @@
using System;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Data;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Dumpers and status section of New Disc form (Moderator only)

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Dumping info section for moderation

View File

@@ -1,8 +1,9 @@
using System;
using Newtonsoft.Json;
using SabreTools.RedumpLib.Converters;
using SabreTools.RedumpLib.Data;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// EDC section of New Disc form (PSX only)

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Extras section of New Disc form

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Parent/Clone relationship section of New Disc form

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Size &amp; checksums section of New Disc form (DVD/BD/UMD-based)

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Tracks and write offsets section of New Disc form (CD/GD-based)

View File

@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;
namespace SabreTools.RedumpLib.Data.Sections
namespace SabreTools.RedumpLib.RedumpOrg.Sections
{
/// <summary>
/// Version and editions section of New Disc form

View File

@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using SabreTools.RedumpLib.RedumpOrg.Sections;
namespace SabreTools.RedumpLib.RedumpOrg
{
/// <summary>
/// redump.org submission page information
/// </summary>
public class SubmissionInfo : ICloneable
{
/// <summary>
/// Version of the current schema
/// </summary>
[JsonProperty(PropertyName = "schema_version", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int SchemaVersion { get; set; } = 3;
/// <summary>
/// Fully matched Redump ID
/// </summary>
[JsonIgnore]
public int? FullyMatchedID { get; set; }
/// <summary>
/// List of partially matched Redump IDs
/// </summary>
[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; }
[JsonProperty(PropertyName = "common_disc_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
public CommonDiscInfoSection CommonDiscInfo { get; set; } = new CommonDiscInfoSection();
[JsonProperty(PropertyName = "versions_and_editions", DefaultValueHandling = DefaultValueHandling.Ignore)]
public VersionAndEditionsSection VersionAndEditions { get; set; } = new VersionAndEditionsSection();
[JsonProperty(PropertyName = "edc", DefaultValueHandling = DefaultValueHandling.Ignore)]
public EDCSection EDC { get; set; } = new EDCSection();
[JsonProperty(PropertyName = "parent_clone_relationship", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ParentCloneRelationshipSection ParentCloneRelationship { get; set; } = new ParentCloneRelationshipSection();
[JsonProperty(PropertyName = "extras", DefaultValueHandling = DefaultValueHandling.Ignore)]
public ExtrasSection Extras { get; set; } = new ExtrasSection();
[JsonProperty(PropertyName = "copy_protection", DefaultValueHandling = DefaultValueHandling.Ignore)]
public CopyProtectionSection CopyProtection { get; set; } = new CopyProtectionSection();
[JsonProperty(PropertyName = "dumpers_and_status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DumpersAndStatusSection DumpersAndStatus { get; set; } = new DumpersAndStatusSection();
[JsonProperty(PropertyName = "tracks_and_write_offsets", DefaultValueHandling = DefaultValueHandling.Ignore)]
public TracksAndWriteOffsetsSection TracksAndWriteOffsets { get; set; } = new TracksAndWriteOffsetsSection();
[JsonProperty(PropertyName = "size_and_checksums", DefaultValueHandling = DefaultValueHandling.Ignore)]
public SizeAndChecksumsSection SizeAndChecksums { get; set; } = new SizeAndChecksumsSection();
[JsonProperty(PropertyName = "dumping_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DumpingInfoSection DumpingInfo { get; set; } = new DumpingInfoSection();
[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,
FullyMatchedID = this.FullyMatchedID,
PartiallyMatchedIDs = this.PartiallyMatchedIDs,
Added = this.Added,
LastModified = this.LastModified,
CommonDiscInfo = this.CommonDiscInfo?.Clone() as CommonDiscInfoSection ?? new CommonDiscInfoSection(),
VersionAndEditions = this.VersionAndEditions?.Clone() as VersionAndEditionsSection ?? new VersionAndEditionsSection(),
EDC = this.EDC?.Clone() as EDCSection ?? new EDCSection(),
ParentCloneRelationship = this.ParentCloneRelationship?.Clone() as ParentCloneRelationshipSection ?? new ParentCloneRelationshipSection(),
Extras = this.Extras?.Clone() as ExtrasSection ?? new ExtrasSection(),
CopyProtection = this.CopyProtection?.Clone() as CopyProtectionSection ?? new CopyProtectionSection(),
DumpersAndStatus = this.DumpersAndStatus?.Clone() as DumpersAndStatusSection ?? new DumpersAndStatusSection(),
TracksAndWriteOffsets = this.TracksAndWriteOffsets?.Clone() as TracksAndWriteOffsetsSection ?? new TracksAndWriteOffsetsSection(),
SizeAndChecksums = this.SizeAndChecksums?.Clone() as SizeAndChecksumsSection ?? new SizeAndChecksumsSection(),
DumpingInfo = this.DumpingInfo?.Clone() as DumpingInfoSection ?? new DumpingInfoSection(),
Artifacts = artifacts,
};
}
}
}