From ca767cf5768c6bbde73346fa5f01758df16c02a3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 17 Oct 2022 20:56:28 -0700 Subject: [PATCH] Change location of dumping info (fixes #415) --- CHANGELIST.md | 1 + MPF.Library/InfoTool.cs | 14 ++--- MPF.Test/RedumpLib/SubmissionInfoTests.cs | 16 ++--- MPF/ViewModels/MainViewModel.cs | 16 ++--- RedumpLib/Data/SubmissionInfo.cs | 74 +++++++++++------------ 5 files changed, 61 insertions(+), 60 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index db976d31..8fd541b6 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -153,6 +153,7 @@ - Add System.Memory package to MPF.Library - Add CodePages package to MPF.Library - Remove extraneous packages +- Change location of dumping info ### 2.3 (2022-02-05) - Start overhauling Redump information pulling, again diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index e53234bb..2638e82e 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -759,13 +759,6 @@ namespace MPF.Library AddIfExists(output, Template.CommentsField, info.CommonDiscInfo.Comments.Trim(), 1); AddIfExists(output, Template.ContentsField, info.CommonDiscInfo.Contents.Trim(), 1); - // Dumping Info section - output.Add(""); output.Add("Dumping Info:"); - AddIfExists(output, Template.DumpingProgramField, info.DumpingInfo.DumpingProgram, 1); - AddIfExists(output, Template.DumpingDriveManufacturer, info.DumpingInfo.Manufacturer, 1); - AddIfExists(output, Template.DumpingDriveModel, info.DumpingInfo.Model, 1); - AddIfExists(output, Template.DumpingDriveFirmware, info.DumpingInfo.Firmware, 1); - // Version and Editions section output.Add(""); output.Add("Version and Editions:"); AddIfExists(output, Template.VersionField, info.VersionAndEditions.Version, 1); @@ -839,6 +832,13 @@ namespace MPF.Library AddIfExists(output, Template.SHA1Field, info.SizeAndChecksums.SHA1, 1); } + // Dumping Info section + output.Add(""); output.Add("Dumping Info:"); + AddIfExists(output, Template.DumpingProgramField, info.DumpingInfo.DumpingProgram, 1); + AddIfExists(output, Template.DumpingDriveManufacturer, info.DumpingInfo.Manufacturer, 1); + AddIfExists(output, Template.DumpingDriveModel, info.DumpingInfo.Model, 1); + AddIfExists(output, Template.DumpingDriveFirmware, info.DumpingInfo.Firmware, 1); + // Make sure there aren't any instances of two blank lines in a row string last = null; for (int i = 0; i < output.Count;) diff --git a/MPF.Test/RedumpLib/SubmissionInfoTests.cs b/MPF.Test/RedumpLib/SubmissionInfoTests.cs index ff56d979..a8c788c6 100644 --- a/MPF.Test/RedumpLib/SubmissionInfoTests.cs +++ b/MPF.Test/RedumpLib/SubmissionInfoTests.cs @@ -92,14 +92,6 @@ namespace MPF.Test.RedumpLib }, }, - DumpingInfo = new DumpingInfoSection() - { - DumpingProgram = "DiscImageCreator 20500101", - Manufacturer = "ATAPI", - Model = "Optical Drive", - Firmware = "1.23", - }, - VersionAndEditions = new VersionAndEditionsSection() { Version = "Original", @@ -165,6 +157,14 @@ namespace MPF.Test.RedumpLib SHA1 = "SHA1", }, + DumpingInfo = new DumpingInfoSection() + { + DumpingProgram = "DiscImageCreator 20500101", + Manufacturer = "ATAPI", + Model = "Optical Drive", + Firmware = "1.23", + }, + Artifacts = new Dictionary() { ["Sample Artifact"] = "Sample Data", diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index 4e317fbf..9333e265 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -334,14 +334,6 @@ namespace MPF.UI.ViewModels }, }, - DumpingInfo = new DumpingInfoSection() - { - DumpingProgram = "DiscImageCreator 20500101", - Manufacturer = "ATAPI", - Model = "Optical Drive", - Firmware = "1.23", - }, - VersionAndEditions = new VersionAndEditionsSection() { Version = "Original", @@ -407,6 +399,14 @@ namespace MPF.UI.ViewModels SHA1 = "SHA1", }, + DumpingInfo = new DumpingInfoSection() + { + DumpingProgram = "DiscImageCreator 20500101", + Manufacturer = "ATAPI", + Model = "Optical Drive", + Firmware = "1.23", + }, + Artifacts = new Dictionary() { ["Sample Artifact"] = "Sample Data", diff --git a/RedumpLib/Data/SubmissionInfo.cs b/RedumpLib/Data/SubmissionInfo.cs index 6867ebf4..e390d70a 100644 --- a/RedumpLib/Data/SubmissionInfo.cs +++ b/RedumpLib/Data/SubmissionInfo.cs @@ -41,9 +41,6 @@ namespace RedumpLib.Data [JsonProperty(PropertyName = "common_disc_info", DefaultValueHandling = DefaultValueHandling.Ignore)] public CommonDiscInfoSection CommonDiscInfo { get; set; } = new CommonDiscInfoSection(); - [JsonProperty(PropertyName = "dumping_info", DefaultValueHandling = DefaultValueHandling.Ignore)] - public DumpingInfoSection DumpingInfo { get; set; } = new DumpingInfoSection(); - [JsonProperty(PropertyName = "versions_and_editions", DefaultValueHandling = DefaultValueHandling.Ignore)] public VersionAndEditionsSection VersionAndEditions { get; set; } = new VersionAndEditionsSection(); @@ -68,6 +65,9 @@ namespace RedumpLib.Data [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 Artifacts { get; set; } = new Dictionary(); @@ -81,7 +81,6 @@ namespace RedumpLib.Data Added = this.Added, LastModified = this.LastModified, CommonDiscInfo = this.CommonDiscInfo?.Clone() as CommonDiscInfoSection, - DumpingInfo = this.DumpingInfo?.Clone() as DumpingInfoSection, VersionAndEditions = this.VersionAndEditions?.Clone() as VersionAndEditionsSection, EDC = this.EDC?.Clone() as EDCSection, ParentCloneRelationship = this.ParentCloneRelationship?.Clone() as ParentCloneRelationshipSection, @@ -90,6 +89,7 @@ namespace RedumpLib.Data DumpersAndStatus = this.DumpersAndStatus?.Clone() as DumpersAndStatusSection, TracksAndWriteOffsets = this.TracksAndWriteOffsets?.Clone() as TracksAndWriteOffsetsSection, SizeAndChecksums = this.SizeAndChecksums?.Clone() as SizeAndChecksumsSection, + DumpingInfo = this.DumpingInfo?.Clone() as DumpingInfoSection, Artifacts = this.Artifacts?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value), }; } @@ -278,39 +278,6 @@ namespace RedumpLib.Data } } - /// - /// Dumping info section for moderation - /// - public class DumpingInfoSection : ICloneable - { - // Name not defined by Redump - [JsonProperty(PropertyName = "d_dumping_program", Required = Required.AllowNull)] - public string DumpingProgram { get; set; } - - // Name not defined by Redump - [JsonProperty(PropertyName = "d_drive_manufacturer", Required = Required.AllowNull)] - public string Manufacturer { get; set; } - - // Name not defined by Redump - [JsonProperty(PropertyName = "d_drive_model", Required = Required.AllowNull)] - public string Model { get; set; } - - // Name not defined by Redump - [JsonProperty(PropertyName = "d_drive_firmware", Required = Required.AllowNull)] - public string Firmware { get; set; } - - public object Clone() - { - return new DumpingInfoSection - { - DumpingProgram = this.DumpingProgram, - Manufacturer = this.Manufacturer, - Model = this.Model, - Firmware = this.Firmware, - }; - } - } - /// /// Version and editions section of New Disc form /// @@ -553,4 +520,37 @@ namespace RedumpLib.Data }; } } + + /// + /// Dumping info section for moderation + /// + public class DumpingInfoSection : ICloneable + { + // Name not defined by Redump + [JsonProperty(PropertyName = "d_dumping_program", Required = Required.AllowNull)] + public string DumpingProgram { get; set; } + + // Name not defined by Redump + [JsonProperty(PropertyName = "d_drive_manufacturer", Required = Required.AllowNull)] + public string Manufacturer { get; set; } + + // Name not defined by Redump + [JsonProperty(PropertyName = "d_drive_model", Required = Required.AllowNull)] + public string Model { get; set; } + + // Name not defined by Redump + [JsonProperty(PropertyName = "d_drive_firmware", Required = Required.AllowNull)] + public string Firmware { get; set; } + + public object Clone() + { + return new DumpingInfoSection + { + DumpingProgram = this.DumpingProgram, + Manufacturer = this.Manufacturer, + Model = this.Model, + Firmware = this.Firmware, + }; + } + } }