Change location of dumping info (fixes #415)

This commit is contained in:
Matt Nadareski
2022-10-17 20:56:28 -07:00
parent b57e0bb97e
commit ca767cf576
5 changed files with 61 additions and 60 deletions

View File

@@ -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

View File

@@ -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;)

View File

@@ -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<string, string>()
{
["Sample Artifact"] = "Sample Data",

View File

@@ -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<string, string>()
{
["Sample Artifact"] = "Sample Data",

View File

@@ -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<string, string> Artifacts { get; set; } = new Dictionary<string, string>();
@@ -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
}
}
/// <summary>
/// Dumping info section for moderation
/// </summary>
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,
};
}
}
/// <summary>
/// Version and editions section of New Disc form
/// </summary>
@@ -553,4 +520,37 @@ namespace RedumpLib.Data
};
}
}
/// <summary>
/// Dumping info section for moderation
/// </summary>
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,
};
}
}
}