mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Cleanup and gated code
This commit is contained in:
@@ -8,14 +8,22 @@ namespace MPF.Core.Data
|
||||
{
|
||||
public class IniFile : IDictionary<string, string>
|
||||
{
|
||||
#if NET48
|
||||
private Dictionary<string, string> _keyValuePairs = new Dictionary<string, string>();
|
||||
#else
|
||||
private Dictionary<string, string> _keyValuePairs = new();
|
||||
#endif
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NET48
|
||||
if (_keyValuePairs == null)
|
||||
_keyValuePairs = new Dictionary<string, string>();
|
||||
#else
|
||||
_keyValuePairs ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
|
||||
key = key.ToLowerInvariant();
|
||||
if (_keyValuePairs.ContainsKey(key))
|
||||
@@ -25,8 +33,12 @@ namespace MPF.Core.Data
|
||||
}
|
||||
set
|
||||
{
|
||||
#if NET48
|
||||
if (_keyValuePairs == null)
|
||||
_keyValuePairs = new Dictionary<string, string>();
|
||||
#else
|
||||
_keyValuePairs ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
|
||||
key = key.ToLowerInvariant();
|
||||
_keyValuePairs[key] = value;
|
||||
@@ -99,7 +111,7 @@ namespace MPF.Core.Data
|
||||
// Keys are case-insensitive by default
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(stream))
|
||||
using (var sr = new StreamReader(stream))
|
||||
{
|
||||
string section = string.Empty;
|
||||
while (!sr.EndOfStream)
|
||||
@@ -125,7 +137,11 @@ namespace MPF.Core.Data
|
||||
}
|
||||
|
||||
// Valid INI lines are in the format key=value
|
||||
#if NET48
|
||||
else if (line.Contains("="))
|
||||
#else
|
||||
else if (line.Contains('='))
|
||||
#endif
|
||||
{
|
||||
// Split the line by '=' for key-value pairs
|
||||
string[] data = line.Split('=');
|
||||
@@ -185,7 +201,7 @@ namespace MPF.Core.Data
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(stream))
|
||||
using (var sw = new StreamWriter(stream))
|
||||
{
|
||||
// Order the dictionary by keys to link sections together
|
||||
var orderedKeyValuePairs = _keyValuePairs.OrderBy(kvp => kvp.Key);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace MPF.Core
|
||||
public BaseParameters? Parameters { get; private set; }
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace MPF.Core
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Dumping
|
||||
|
||||
@@ -358,11 +358,6 @@ namespace MPF.Core
|
||||
await Task.Run(() => Parameters.ExecuteInternalProgram(Options.ToolsInSeparateWindow));
|
||||
progress?.Report(Result.Success($"{this.InternalProgram} has finished!"));
|
||||
|
||||
// Execute additional tools
|
||||
progress?.Report(Result.Success("Running any additional tools... see log for output!"));
|
||||
result = await Task.Run(() => ExecuteAdditionalTools());
|
||||
progress?.Report(result);
|
||||
|
||||
// Remove event handler if needed
|
||||
if (!Options.ToolsInSeparateWindow)
|
||||
{
|
||||
@@ -535,18 +530,12 @@ namespace MPF.Core
|
||||
return parametersValid && floppyValid && removableDiskValid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run any additional tools given a DumpEnvironment
|
||||
/// </summary>
|
||||
/// <returns>Result instance with the outcome</returns>
|
||||
private Result ExecuteAdditionalTools() => Result.Success("No external tools needed!");
|
||||
|
||||
/// <summary>
|
||||
/// Run internal program async with an input set of parameters
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns>Standard output from commandline window</returns>
|
||||
private async Task<string> ExecuteInternalProgram(BaseParameters parameters)
|
||||
private static async Task<string> ExecuteInternalProgram(BaseParameters parameters)
|
||||
{
|
||||
Process childProcess;
|
||||
string output = await Task.Run(() =>
|
||||
@@ -584,20 +573,21 @@ namespace MPF.Core
|
||||
/// <param name="info">Existing submission information</param>
|
||||
/// <param name="seed">User-supplied submission information</param>
|
||||
#if NET48
|
||||
private void InjectSubmissionInformation(SubmissionInfo info, SubmissionInfo seed)
|
||||
private static void InjectSubmissionInformation(SubmissionInfo info, SubmissionInfo seed)
|
||||
#else
|
||||
private void InjectSubmissionInformation(SubmissionInfo? info, SubmissionInfo? seed)
|
||||
private static void InjectSubmissionInformation(SubmissionInfo? info, SubmissionInfo? seed)
|
||||
#endif
|
||||
{
|
||||
// If we have any invalid info
|
||||
if (info == null || seed == null)
|
||||
if (seed == null)
|
||||
return;
|
||||
|
||||
// Otherwise, inject information as necessary
|
||||
if (seed.CommonDiscInfo != null)
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
// Ensure that required sections exist
|
||||
info = InfoTool.EnsureAllSections(info);
|
||||
|
||||
// Otherwise, inject information as necessary
|
||||
if (info.CommonDiscInfo != null && seed.CommonDiscInfo != null)
|
||||
{
|
||||
// Info that only overwrites if supplied
|
||||
if (!string.IsNullOrWhiteSpace(seed.CommonDiscInfo.Title)) info.CommonDiscInfo.Title = seed.CommonDiscInfo.Title;
|
||||
if (!string.IsNullOrWhiteSpace(seed.CommonDiscInfo.ForeignTitleNonLatin)) info.CommonDiscInfo.ForeignTitleNonLatin = seed.CommonDiscInfo.ForeignTitleNonLatin;
|
||||
@@ -607,7 +597,7 @@ namespace MPF.Core
|
||||
if (seed.CommonDiscInfo.Region != null) info.CommonDiscInfo.Region = seed.CommonDiscInfo.Region;
|
||||
if (seed.CommonDiscInfo.Languages != null) info.CommonDiscInfo.Languages = seed.CommonDiscInfo.Languages;
|
||||
if (seed.CommonDiscInfo.LanguageSelection != null) info.CommonDiscInfo.LanguageSelection = seed.CommonDiscInfo.LanguageSelection;
|
||||
if (seed.CommonDiscInfo.Serial != null) info.CommonDiscInfo.Serial = seed.CommonDiscInfo.Serial;
|
||||
if (!string.IsNullOrWhiteSpace(seed.CommonDiscInfo.Serial)) info.CommonDiscInfo.Serial = seed.CommonDiscInfo.Serial;
|
||||
if (!string.IsNullOrWhiteSpace(seed.CommonDiscInfo.Barcode)) info.CommonDiscInfo.Barcode = seed.CommonDiscInfo.Barcode;
|
||||
if (!string.IsNullOrWhiteSpace(seed.CommonDiscInfo.Comments)) info.CommonDiscInfo.Comments = seed.CommonDiscInfo.Comments;
|
||||
if (seed.CommonDiscInfo.CommentsSpecialFields != null) info.CommonDiscInfo.CommentsSpecialFields = seed.CommonDiscInfo.CommentsSpecialFields;
|
||||
@@ -636,19 +626,15 @@ namespace MPF.Core
|
||||
info.CommonDiscInfo.Layer3ToolstampMasteringCode = seed.CommonDiscInfo.Layer3ToolstampMasteringCode;
|
||||
}
|
||||
|
||||
if (seed.VersionAndEditions != null)
|
||||
if (info.VersionAndEditions != null && seed.VersionAndEditions != null)
|
||||
{
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
|
||||
// Info that only overwrites if supplied
|
||||
if (!string.IsNullOrWhiteSpace(seed.VersionAndEditions.Version)) info.VersionAndEditions.Version = seed.VersionAndEditions.Version;
|
||||
if (!string.IsNullOrWhiteSpace(seed.VersionAndEditions.OtherEditions)) info.VersionAndEditions.OtherEditions = seed.VersionAndEditions.OtherEditions;
|
||||
}
|
||||
|
||||
if (seed.CopyProtection != null)
|
||||
if (info.CopyProtection != null && seed.CopyProtection != null)
|
||||
{
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
|
||||
// Info that only overwrites if supplied
|
||||
if (!string.IsNullOrWhiteSpace(seed.CopyProtection.Protection)) info.CopyProtection.Protection = seed.CopyProtection.Protection;
|
||||
}
|
||||
@@ -732,6 +718,6 @@ namespace MPF.Core
|
||||
return await ExecuteInternalProgram(parameters);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,58 @@ namespace MPF.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure all required sections in a submission info exist
|
||||
/// </summary>
|
||||
/// <param name="info">SubmissionInfo object to verify</param>
|
||||
#if NET48
|
||||
public static SubmissionInfo EnsureAllSections(SubmissionInfo info)
|
||||
{
|
||||
// If there's no info, create one
|
||||
if (info == null) info = new SubmissionInfo();
|
||||
|
||||
// Ensure all sections
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
if (info.EDC == null) info.EDC = new EDCSection();
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
if (info.TracksAndWriteOffsets == null) info.TracksAndWriteOffsets = new TracksAndWriteOffsetsSection();
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
if (info.DumpingInfo == null) info.DumpingInfo = new DumpingInfoSection();
|
||||
|
||||
// Ensure special dictionaries
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
if (info.CommonDiscInfo.ContentsSpecialFields == null) info.CommonDiscInfo.ContentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
|
||||
return info;
|
||||
}
|
||||
#else
|
||||
public static SubmissionInfo EnsureAllSections(SubmissionInfo? info)
|
||||
{
|
||||
// If there's no info, create one
|
||||
info ??= new SubmissionInfo();
|
||||
|
||||
// Ensure all sections
|
||||
info.CommonDiscInfo ??= new CommonDiscInfoSection();
|
||||
info.VersionAndEditions ??= new VersionAndEditionsSection();
|
||||
info.EDC ??= new EDCSection();
|
||||
info.ParentCloneRelationship ??= new ParentCloneRelationshipSection();
|
||||
info.Extras ??= new ExtrasSection();
|
||||
info.CopyProtection ??= new CopyProtectionSection();
|
||||
info.DumpersAndStatus ??= new DumpersAndStatusSection();
|
||||
info.TracksAndWriteOffsets ??= new TracksAndWriteOffsetsSection();
|
||||
info.SizeAndChecksums ??= new SizeAndChecksumsSection();
|
||||
info.DumpingInfo ??= new DumpingInfoSection();
|
||||
|
||||
// Ensure special dictionaries
|
||||
info.CommonDiscInfo.CommentsSpecialFields ??= new Dictionary<SiteCode, string>();
|
||||
info.CommonDiscInfo.ContentsSpecialFields ??= new Dictionary<SiteCode, string>();
|
||||
|
||||
return info;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Extract all of the possible information from a given input combination
|
||||
/// </summary>
|
||||
@@ -135,34 +187,26 @@ namespace MPF.Core
|
||||
Serial = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty,
|
||||
Barcode = options.AddPlaceholders ? Template.OptionalValue : string.Empty,
|
||||
Contents = string.Empty,
|
||||
#if NET48
|
||||
ContentsSpecialFields = new Dictionary<SiteCode?, string>(),
|
||||
#else
|
||||
ContentsSpecialFields = new Dictionary<SiteCode, string>(),
|
||||
#endif
|
||||
Comments = string.Empty,
|
||||
#if NET48
|
||||
CommentsSpecialFields = new Dictionary<SiteCode?, string>(),
|
||||
#else
|
||||
CommentsSpecialFields = new Dictionary<SiteCode, string>(),
|
||||
#endif
|
||||
},
|
||||
VersionAndEditions = new VersionAndEditionsSection()
|
||||
{
|
||||
Version = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty,
|
||||
OtherEditions = options.AddPlaceholders ? "(VERIFY THIS) Original" : string.Empty,
|
||||
},
|
||||
TracksAndWriteOffsets = new TracksAndWriteOffsetsSection(),
|
||||
};
|
||||
|
||||
// Ensure that required sections exist
|
||||
info = EnsureAllSections(info);
|
||||
|
||||
// Get specific tool output handling
|
||||
parameters?.GenerateSubmissionInfo(info, options, combinedBase, drive, options.IncludeArtifacts);
|
||||
|
||||
// Get a list of matching IDs for each line in the DAT
|
||||
if (!string.IsNullOrEmpty(info.TracksAndWriteOffsets.ClrMameProData) && options.HasRedumpLogin)
|
||||
#if NET48
|
||||
if (!string.IsNullOrEmpty(info.TracksAndWriteOffsets.ClrMameProData) && options.HasRedumpLogin)
|
||||
FillFromRedump(options, info, resultProgress);
|
||||
#else
|
||||
if (!string.IsNullOrEmpty(info.TracksAndWriteOffsets!.ClrMameProData) && options.HasRedumpLogin)
|
||||
_ = await FillFromRedump(options, info, resultProgress);
|
||||
#endif
|
||||
|
||||
@@ -172,14 +216,22 @@ namespace MPF.Core
|
||||
|
||||
// Add the volume label to comments, if possible or necessary
|
||||
if (drive?.VolumeLabel != null && drive.GetRedumpSystemFromVolumeLabel() == null)
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.VolumeLabel] = drive.VolumeLabel;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.VolumeLabel] = drive.VolumeLabel;
|
||||
#endif
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -190,12 +242,19 @@ namespace MPF.Core
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
|
||||
// If we have a single-layer disc
|
||||
#if NET48
|
||||
if (info.SizeAndChecksums.Layerbreak == default)
|
||||
#else
|
||||
if (info.SizeAndChecksums!.Layerbreak == default)
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -205,7 +264,11 @@ namespace MPF.Core
|
||||
// If we have a dual-layer disc
|
||||
else
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -220,23 +283,37 @@ namespace MPF.Core
|
||||
break;
|
||||
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer1MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0AdditionalMould = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.BCA = info.Extras.BCA ?? (options.AddPlaceholders ? Template.RequiredValue : string.Empty);
|
||||
#else
|
||||
info.Extras!.BCA ??= (options.AddPlaceholders ? Template.RequiredValue : string.Empty);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
|
||||
// If we have a single-layer disc
|
||||
#if NET48
|
||||
if (info.SizeAndChecksums.Layerbreak == default)
|
||||
#else
|
||||
if (info.SizeAndChecksums!.Layerbreak == default)
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -246,7 +323,11 @@ namespace MPF.Core
|
||||
// If we have a dual-layer disc
|
||||
else
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -258,15 +339,22 @@ namespace MPF.Core
|
||||
info.CommonDiscInfo.Layer1MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
}
|
||||
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.DiscKey = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.Extras!.DiscKey = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
info.Extras.BCA = info.Extras.BCA ?? (options.AddPlaceholders ? Template.RequiredValue : string.Empty);
|
||||
|
||||
break;
|
||||
|
||||
case MediaType.UMD:
|
||||
// Both single- and dual-layer discs have two "layers" for the ring
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Layer0MasteringRing = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Layer0MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer0MouldSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
@@ -275,10 +363,15 @@ namespace MPF.Core
|
||||
info.CommonDiscInfo.Layer1MasteringSID = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
info.CommonDiscInfo.Layer1ToolstampMasteringCode = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
#if NET48
|
||||
info.SizeAndChecksums.CRC32 = info.SizeAndChecksums.CRC32 ?? (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
info.SizeAndChecksums.MD5 = info.SizeAndChecksums.MD5 ?? (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
info.SizeAndChecksums.SHA1 = info.SizeAndChecksums.SHA1 ?? (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
#else
|
||||
info.SizeAndChecksums!.CRC32 ??= (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
info.SizeAndChecksums.MD5 ??= (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
info.SizeAndChecksums.SHA1 ??= (options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : string.Empty);
|
||||
#endif
|
||||
info.TracksAndWriteOffsets.ClrMameProData = null;
|
||||
break;
|
||||
}
|
||||
@@ -287,7 +380,11 @@ namespace MPF.Core
|
||||
switch (system)
|
||||
{
|
||||
case RedumpSystem.AcornArchimedes:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.UnitedKingdom;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.UnitedKingdom;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.AppleMacintosh:
|
||||
@@ -300,11 +397,11 @@ namespace MPF.Core
|
||||
resultProgress?.Report(Result.Success("Running copy protection scan... this might take a while!"));
|
||||
var (protectionString, fullProtections) = await GetCopyProtection(drive, options, protectionProgress);
|
||||
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
info.CopyProtection.Protection = protectionString;
|
||||
#if NET48
|
||||
info.CopyProtection.Protection = protectionString;
|
||||
info.CopyProtection.FullProtections = fullProtections ?? new Dictionary<string, List<string>>();
|
||||
#else
|
||||
info.CopyProtection!.Protection = protectionString;
|
||||
info.CopyProtection.FullProtections = fullProtections as Dictionary<string, List<string>?> ?? new Dictionary<string, List<string>?>();
|
||||
#endif
|
||||
resultProgress?.Report(Result.Success("Copy protection scan complete!"));
|
||||
@@ -314,73 +411,139 @@ namespace MPF.Core
|
||||
case RedumpSystem.AudioCD:
|
||||
case RedumpSystem.DVDAudio:
|
||||
case RedumpSystem.SuperAudioCD:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.Audio;
|
||||
#else
|
||||
info.CommonDiscInfo!.Category ??= DiscCategory.Audio;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.BandaiPlaydiaQuickInteractiveSystem:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
break;
|
||||
|
||||
case RedumpSystem.BDVideo:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.BonusDiscs;
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
info.CopyProtection.Protection = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Category ??= DiscCategory.BonusDiscs;
|
||||
info.CopyProtection!.Protection = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.CommodoreAmigaCD:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.CommodoreAmigaCD32:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Europe;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region ??= Region.Europe;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.CommodoreAmigaCDTV:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Europe;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region ??= Region.Europe;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.DVDVideo:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.BonusDiscs;
|
||||
#else
|
||||
info.CommonDiscInfo!.Category ??= DiscCategory.BonusDiscs;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.FujitsuFMTownsseries:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
break;
|
||||
|
||||
case RedumpSystem.FujitsuFMTownsMarty:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.IncredibleTechnologiesEagle:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamieAmusement:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiFireBeat:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiSystemGV:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiSystem573:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiTwinkle:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.MattelHyperScan:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.MicrosoftXboxOne:
|
||||
@@ -389,7 +552,11 @@ namespace MPF.Core
|
||||
string xboxOneMsxcPath = Path.Combine($"{drive.Letter}:\\", "MSXC");
|
||||
if (drive != null && Directory.Exists(xboxOneMsxcPath))
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Filename] = string.Join("\n",
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.Filename] = string.Join("\n",
|
||||
#endif
|
||||
Directory.GetFiles(xboxOneMsxcPath, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName));
|
||||
}
|
||||
}
|
||||
@@ -402,7 +569,11 @@ namespace MPF.Core
|
||||
string xboxSeriesXMsxcPath = Path.Combine($"{drive.Letter}:\\", "MSXC");
|
||||
if (drive != null && Directory.Exists(xboxSeriesXMsxcPath))
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Filename] = string.Join("\n",
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.Filename] = string.Join("\n",
|
||||
#endif
|
||||
Directory.GetFiles(xboxSeriesXMsxcPath, "*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName));
|
||||
}
|
||||
}
|
||||
@@ -410,59 +581,112 @@ namespace MPF.Core
|
||||
break;
|
||||
|
||||
case RedumpSystem.NamcoSegaNintendoTriforce:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.NavisoftNaviken21:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.NECPC88series:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.NECPC98series:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.NECPCFXPCFXGA:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaChihiro:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaDreamcast:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaNaomi:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaNaomi2:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaTitanVideo:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SharpX68000:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SNKNeoGeoCD:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.EXEDateBuildDate = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation:
|
||||
// Only check the disc if the dumping program couldn't detect
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#if NET48
|
||||
if (drive != null && info.CopyProtection.AntiModchip == YesNo.NULL)
|
||||
#else
|
||||
if (drive != null && info.CopyProtection!.AntiModchip == YesNo.NULL)
|
||||
#endif
|
||||
{
|
||||
resultProgress?.Report(Result.Success("Checking for anti-modchip strings... this might take a while!"));
|
||||
info.CopyProtection.AntiModchip = await GetAntiModchipDetected(drive) ? YesNo.Yes : YesNo.No;
|
||||
@@ -480,27 +704,45 @@ namespace MPF.Core
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation2:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.LanguageSelection = new LanguageSelection?[] { LanguageSelection.BiosSettings, LanguageSelection.LanguageSelector, LanguageSelection.OptionsMenu };
|
||||
#else
|
||||
info.CommonDiscInfo!.LanguageSelection = new LanguageSelection?[] { LanguageSelection.BiosSettings, LanguageSelection.LanguageSelector, LanguageSelection.OptionsMenu };
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation3:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.DiscKey = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#else
|
||||
info.Extras!.DiscKey = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
#endif
|
||||
info.Extras.DiscID = options.AddPlaceholders ? Template.RequiredValue : string.Empty;
|
||||
break;
|
||||
|
||||
case RedumpSystem.TomyKissSite:
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? Region.Japan;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region ??= Region.Japan;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#if NET48
|
||||
info.CopyProtection.Protection = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#else
|
||||
info.CopyProtection!.Protection = options.AddPlaceholders ? Template.RequiredIfExistsValue : string.Empty;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the category if it's not overriden
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Category = info.CommonDiscInfo.Category ?? DiscCategory.Games;
|
||||
#else
|
||||
info.CommonDiscInfo!.Category ??= DiscCategory.Games;
|
||||
#endif
|
||||
|
||||
// Comments and contents have odd handling
|
||||
if (string.IsNullOrEmpty(info.CommonDiscInfo.Comments))
|
||||
@@ -642,8 +884,13 @@ namespace MPF.Core
|
||||
/// <returns>Status of the LibCrypt data, if possible</returns>
|
||||
private static void GetLibCryptDetected(SubmissionInfo info, string basePath)
|
||||
{
|
||||
bool? psLibCryptStatus = Protection.GetLibCryptDetected(basePath + ".sub");
|
||||
#if NET48
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#else
|
||||
info.CopyProtection ??= new CopyProtectionSection();
|
||||
#endif
|
||||
|
||||
bool? psLibCryptStatus = Protection.GetLibCryptDetected(basePath + ".sub");
|
||||
if (psLibCryptStatus == true)
|
||||
{
|
||||
// Guard against false positives
|
||||
@@ -2161,11 +2408,7 @@ namespace MPF.Core
|
||||
private async static Task<bool> FillFromId(RedumpHttpClient wc, SubmissionInfo info, int id, bool includeAllData)
|
||||
{
|
||||
// Ensure that required sections exist
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
if (info.CommonDiscInfo.ContentsSpecialFields == null) info.CommonDiscInfo.ContentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
if (info.DumpersAndStatus == null) info.DumpersAndStatus = new DumpersAndStatusSection();
|
||||
info = EnsureAllSections(info);
|
||||
|
||||
var discData = await wc.DownloadSingleSiteID(id);
|
||||
if (string.IsNullOrEmpty(discData))
|
||||
@@ -2185,7 +2428,7 @@ namespace MPF.Core
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Title = title.Substring(0, firstParenLocation);
|
||||
#else
|
||||
info.CommonDiscInfo.Title = title[..firstParenLocation];
|
||||
info.CommonDiscInfo!.Title = title[..firstParenLocation];
|
||||
#endif
|
||||
var subMatches = Constants.DiscNumberLetterRegex.Matches(title);
|
||||
foreach (Match subMatch in subMatches.Cast<Match>())
|
||||
@@ -2208,16 +2451,28 @@ namespace MPF.Core
|
||||
// Otherwise, leave the title as-is
|
||||
else
|
||||
{
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Title = title;
|
||||
#else
|
||||
info.CommonDiscInfo!.Title = title;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Foreign Title
|
||||
match = Constants.ForeignTitleRegex.Match(discData);
|
||||
if (match.Success)
|
||||
#if NET48
|
||||
info.CommonDiscInfo.ForeignTitleNonLatin = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
#else
|
||||
info.CommonDiscInfo!.ForeignTitleNonLatin = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
#endif
|
||||
else
|
||||
#if NET48
|
||||
info.CommonDiscInfo.ForeignTitleNonLatin = null;
|
||||
#else
|
||||
info.CommonDiscInfo!.ForeignTitleNonLatin = null;
|
||||
#endif
|
||||
|
||||
// Category
|
||||
match = Constants.CategoryRegex.Match(discData);
|
||||
@@ -2265,7 +2520,11 @@ namespace MPF.Core
|
||||
}
|
||||
|
||||
// Version
|
||||
#if NET48
|
||||
if (info.VersionAndEditions.Version == null)
|
||||
#else
|
||||
if (info.VersionAndEditions!.Version == null)
|
||||
#endif
|
||||
{
|
||||
match = Constants.VersionRegex.Match(discData);
|
||||
if (match.Success)
|
||||
@@ -2278,7 +2537,11 @@ namespace MPF.Core
|
||||
{
|
||||
// Start with any currently listed dumpers
|
||||
var tempDumpers = new List<string>();
|
||||
#if NET48
|
||||
if (info.DumpersAndStatus.Dumpers != null && info.DumpersAndStatus.Dumpers.Length > 0)
|
||||
#else
|
||||
if (info.DumpersAndStatus!.Dumpers != null && info.DumpersAndStatus.Dumpers.Length > 0)
|
||||
#endif
|
||||
{
|
||||
foreach (string dumper in info.DumpersAndStatus.Dumpers)
|
||||
tempDumpers.Add(dumper);
|
||||
@@ -2387,7 +2650,11 @@ namespace MPF.Core
|
||||
}
|
||||
|
||||
// If we don't already have this site code, add it to the dictionary
|
||||
#if NET48
|
||||
if (!info.CommonDiscInfo.CommentsSpecialFields.ContainsKey(siteCode.Value))
|
||||
#else
|
||||
if (!info.CommonDiscInfo.CommentsSpecialFields!.ContainsKey(siteCode.Value))
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[siteCode.Value] = $"(VERIFY THIS) {commentLine.Replace(shortName, string.Empty).Trim()}";
|
||||
|
||||
// Otherwise, append the value to the existing key
|
||||
@@ -2402,7 +2669,11 @@ namespace MPF.Core
|
||||
{
|
||||
if (addToLast && lastSiteCode != null)
|
||||
{
|
||||
#if NET48
|
||||
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode.Value]))
|
||||
#else
|
||||
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.CommentsSpecialFields![lastSiteCode.Value]))
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode.Value] += "\n";
|
||||
|
||||
info.CommonDiscInfo.CommentsSpecialFields[lastSiteCode.Value] += commentLine;
|
||||
@@ -2474,7 +2745,11 @@ namespace MPF.Core
|
||||
lastSiteCode = siteCode;
|
||||
|
||||
// If we don't already have this site code, add it to the dictionary
|
||||
#if NET48
|
||||
if (!info.CommonDiscInfo.ContentsSpecialFields.ContainsKey(siteCode.Value))
|
||||
#else
|
||||
if (!info.CommonDiscInfo.ContentsSpecialFields!.ContainsKey(siteCode.Value))
|
||||
#endif
|
||||
info.CommonDiscInfo.ContentsSpecialFields[siteCode.Value] = $"(VERIFY THIS) {contentLine.Replace(shortName, string.Empty).Trim()}";
|
||||
|
||||
// A subset of tags can be multiline
|
||||
@@ -2490,7 +2765,11 @@ namespace MPF.Core
|
||||
{
|
||||
if (addToLast && lastSiteCode != null)
|
||||
{
|
||||
#if NET48
|
||||
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode.Value]))
|
||||
#else
|
||||
if (!string.IsNullOrWhiteSpace(info.CommonDiscInfo.ContentsSpecialFields![lastSiteCode.Value]))
|
||||
#endif
|
||||
info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode.Value] += "\n";
|
||||
|
||||
info.CommonDiscInfo.ContentsSpecialFields[lastSiteCode.Value] += contentLine;
|
||||
@@ -2547,7 +2826,11 @@ namespace MPF.Core
|
||||
return false;
|
||||
|
||||
// Set the current dumper based on username
|
||||
#if NET48
|
||||
if (info.DumpersAndStatus == null) info.DumpersAndStatus = new DumpersAndStatusSection();
|
||||
#else
|
||||
info.DumpersAndStatus ??= new DumpersAndStatusSection();
|
||||
#endif
|
||||
info.DumpersAndStatus.Dumpers = new string[] { options.RedumpUsername };
|
||||
info.PartiallyMatchedIDs = new List<int>();
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <inheritdoc/>
|
||||
public override (bool, List<string>) CheckAllOutputFilesExist(string basePath, bool preCheck)
|
||||
{
|
||||
List<string> missingFiles = new List<string>();
|
||||
var missingFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -332,9 +332,15 @@ namespace MPF.Core.Modules.Aaru
|
||||
// TODO: Fill in submission info specifics for Aaru
|
||||
var outputDirectory = Path.GetDirectoryName(basePath);
|
||||
|
||||
// Ensure that required sections exist
|
||||
info = InfoTool.EnsureAllSections(info);
|
||||
|
||||
// TODO: Determine if there's an Aaru version anywhere
|
||||
if (info.DumpingInfo == null) info.DumpingInfo = new DumpingInfoSection();
|
||||
#if NET48
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#else
|
||||
info.DumpingInfo!.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#endif
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + ".cicm.xml")?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// Deserialize the sidecar, if possible
|
||||
@@ -366,8 +372,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
var datafile = GenerateDatafile(sidecar, basePath);
|
||||
|
||||
// Fill in the hash data
|
||||
if (info.TracksAndWriteOffsets == null) info.TracksAndWriteOffsets = new TracksAndWriteOffsetsSection();
|
||||
#if NET48
|
||||
info.TracksAndWriteOffsets.ClrMameProData = GenerateDatfile(datafile);
|
||||
#else
|
||||
info.TracksAndWriteOffsets!.ClrMameProData = GenerateDatfile(datafile);
|
||||
#endif
|
||||
|
||||
switch (this.Type)
|
||||
{
|
||||
@@ -381,8 +390,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
if (File.Exists(basePath + ".resume.xml"))
|
||||
errorCount = GetErrorCount(basePath + ".resume.xml");
|
||||
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
#else
|
||||
info.CommonDiscInfo!.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
#endif
|
||||
|
||||
info.TracksAndWriteOffsets.Cuesheet = GenerateCuesheet(sidecar, basePath) ?? string.Empty;
|
||||
|
||||
@@ -394,12 +406,15 @@ namespace MPF.Core.Modules.Aaru
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
|
||||
// Get the individual hash data, as per internal
|
||||
if (GetISOHashValues(datafile, out long size, out var crc32, out var md5, out var sha1))
|
||||
{
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Size = size;
|
||||
#else
|
||||
info.SizeAndChecksums!.CRC32 = crc32;
|
||||
#endif
|
||||
info.SizeAndChecksums.CRC32 = crc32;
|
||||
info.SizeAndChecksums.MD5 = md5;
|
||||
info.SizeAndChecksums.SHA1 = sha1;
|
||||
@@ -418,7 +433,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
if (this.Type == MediaType.DVD)
|
||||
layerbreak = GetLayerbreak(sidecar) ?? string.Empty;
|
||||
else if (this.Type == MediaType.BluRay)
|
||||
#if NET48
|
||||
layerbreak = info.SizeAndChecksums.Size > 25_025_314_816 ? "25025314816" : null;
|
||||
#else
|
||||
layerbreak = info.SizeAndChecksums!.Size > 25_025_314_816 ? "25025314816" : null;
|
||||
#endif
|
||||
|
||||
// If we have a single-layer disc
|
||||
if (string.IsNullOrWhiteSpace(layerbreak))
|
||||
@@ -428,7 +447,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
// If we have a dual-layer disc
|
||||
else
|
||||
{
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Layerbreak = Int64.Parse(layerbreak);
|
||||
#else
|
||||
info.SizeAndChecksums!.Layerbreak = Int64.Parse(layerbreak);
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO: Investigate XGD disc outputs
|
||||
@@ -448,52 +471,60 @@ namespace MPF.Core.Modules.Aaru
|
||||
|
||||
case RedumpSystem.DVDAudio:
|
||||
case RedumpSystem.DVDVideo:
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#if NET48
|
||||
info.CopyProtection.Protection = GetDVDProtection(sidecar) ?? string.Empty;
|
||||
#else
|
||||
info.CopyProtection!.Protection = GetDVDProtection(sidecar) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiPython2:
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var pythonTwoSerial, out Region? pythonTwoRegion, out var pythonTwoDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = pythonTwoSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = pythonTwoSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? pythonTwoRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = pythonTwoDate;
|
||||
}
|
||||
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
#if NET48
|
||||
info.VersionAndEditions.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
if (GetXgdAuxInfo(sidecar, out var xgd1DMIHash, out var xgd1PFIHash, out var xgd1SSHash, out var ss, out var xgd1SSVer))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd1DMIHash ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = xgd1DMIHash ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.SecuritySectorRanges = ss ?? string.Empty;
|
||||
#else
|
||||
info.Extras!.SecuritySectorRanges = ss ?? string.Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (GetXboxDMIInfo(sidecar, out var serial, out var version, out Region? region))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Serial = serial ?? string.Empty;
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Serial = serial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = region;
|
||||
}
|
||||
|
||||
@@ -502,26 +533,30 @@ namespace MPF.Core.Modules.Aaru
|
||||
case RedumpSystem.MicrosoftXbox360:
|
||||
if (GetXgdAuxInfo(sidecar, out var xgd23DMIHash, out var xgd23PFIHash, out var xgd23SSHash, out var ss360, out var xgd23SSVer))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd23DMIHash ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.DMIHash] = xgd23DMIHash ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.SecuritySectorRanges = ss360 ?? string.Empty;
|
||||
#else
|
||||
info.Extras!.SecuritySectorRanges = ss360 ?? string.Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (GetXbox360DMIInfo(sidecar, out var serial360, out var version360, out Region? region360))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Serial = serial360 ?? string.Empty;
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = version360 ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Serial = serial360 ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = version360 ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = region360;
|
||||
}
|
||||
break;
|
||||
@@ -530,13 +565,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var playstationSerial, out Region? playstationRegion, out var playstationDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = playstationSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = playstationDate;
|
||||
}
|
||||
@@ -547,62 +580,61 @@ namespace MPF.Core.Modules.Aaru
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var playstationTwoSerial, out Region? playstationTwoRegion, out var playstationTwoDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = playstationTwoSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationTwoSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = playstationTwoDate;
|
||||
}
|
||||
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
#if NET48
|
||||
info.VersionAndEditions.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation3:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation3Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation3Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation4:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation4Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation4Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation5:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation5Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation5Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// Fill in any artifacts that exist, Base64-encoded, if we need to
|
||||
if (includeArtifacts)
|
||||
{
|
||||
#if NET48
|
||||
if (info.Artifacts == null) info.Artifacts = new Dictionary<string, string>();
|
||||
#else
|
||||
info.Artifacts ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
if (File.Exists(basePath + ".cicm.xml"))
|
||||
info.Artifacts["cicm"] = GetBase64(GetFullFile(basePath + ".cicm.xml")) ?? string.Empty;
|
||||
if (File.Exists(basePath + ".ibg"))
|
||||
@@ -625,7 +657,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
public override string? GenerateParameters()
|
||||
#endif
|
||||
{
|
||||
List<string> parameters = new List<string>();
|
||||
var parameters = new List<string>();
|
||||
|
||||
#region Pre-command flags
|
||||
|
||||
@@ -651,8 +683,12 @@ namespace MPF.Core.Modules.Aaru
|
||||
|
||||
#endregion
|
||||
|
||||
#if NET48
|
||||
if (BaseCommand == null)
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
#else
|
||||
BaseCommand ??= CommandStrings.NONE;
|
||||
#endif
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(BaseCommand))
|
||||
parameters.Add(BaseCommand);
|
||||
@@ -1641,7 +1677,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <inheritdoc/>
|
||||
public override List<string> GetLogFilePaths(string basePath)
|
||||
{
|
||||
List<string> logFiles = new List<string>();
|
||||
var logFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -2340,7 +2376,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Extra Methods
|
||||
|
||||
@@ -2350,9 +2386,9 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <param name="baseCommand">Command string to normalize</param>
|
||||
/// <returns>Normalized command</returns>
|
||||
#if NET48
|
||||
private string NormalizeCommand(List<string> parts, ref int start)
|
||||
private static string NormalizeCommand(List<string> parts, ref int start)
|
||||
#else
|
||||
private string? NormalizeCommand(List<string> parts, ref int start)
|
||||
private static string? NormalizeCommand(List<string> parts, ref int start)
|
||||
#endif
|
||||
{
|
||||
// Invalid start means invalid command
|
||||
@@ -2383,9 +2419,9 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <param name="baseCommand">Command string to normalize</param>
|
||||
/// <returns>Normalized command</returns>
|
||||
#if NET48
|
||||
private string NormalizeCommand(string baseCommand)
|
||||
private static string NormalizeCommand(string baseCommand)
|
||||
#else
|
||||
private string? NormalizeCommand(string baseCommand)
|
||||
private static string? NormalizeCommand(string baseCommand)
|
||||
#endif
|
||||
{
|
||||
// If the base command is inavlid, just return nulls
|
||||
@@ -2606,7 +2642,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <param name="trackType">TrackTypeTrackType to convert</param>
|
||||
/// <param name="bytesPerSector">Sector size to help with specific subtypes</param>
|
||||
/// <returns>CueTrackDataType representing the input data</returns>
|
||||
private CueTrackDataType ConvertToDataType(TrackTypeTrackType trackType, uint bytesPerSector)
|
||||
private static CueTrackDataType ConvertToDataType(TrackTypeTrackType trackType, uint bytesPerSector)
|
||||
{
|
||||
switch (trackType)
|
||||
{
|
||||
@@ -2637,7 +2673,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// </summary>
|
||||
/// <param name="trackFlagsType">TrackFlagsType containing flag data</param>
|
||||
/// <returns>CueTrackFlag representing the flags</returns>
|
||||
private CueTrackFlag ConvertToTrackFlag(TrackFlagsType trackFlagsType)
|
||||
private static CueTrackFlag ConvertToTrackFlag(TrackFlagsType trackFlagsType)
|
||||
{
|
||||
if (trackFlagsType == null)
|
||||
return 0;
|
||||
@@ -2663,9 +2699,9 @@ namespace MPF.Core.Modules.Aaru
|
||||
/// <param name="basePath">Base path for determining file names</param>
|
||||
/// <returns>String containing the cuesheet, null on error</returns>
|
||||
#if NET48
|
||||
private string GenerateCuesheet(CICMMetadataType cicmSidecar, string basePath)
|
||||
private static string GenerateCuesheet(CICMMetadataType cicmSidecar, string basePath)
|
||||
#else
|
||||
private string? GenerateCuesheet(CICMMetadataType? cicmSidecar, string basePath)
|
||||
private static string? GenerateCuesheet(CICMMetadataType? cicmSidecar, string basePath)
|
||||
#endif
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
@@ -2677,7 +2713,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
var cueFiles = new List<CueFile>();
|
||||
var cueSheet = new CueSheet
|
||||
{
|
||||
Performer = string.Join(", ", cicmSidecar.Performer ?? new string[0]),
|
||||
Performer = string.Join(", ", cicmSidecar.Performer ?? Array.Empty<string>()),
|
||||
};
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
@@ -2702,7 +2738,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
foreach (TrackType track in opticalDisc.Track)
|
||||
{
|
||||
// Create cue track entry
|
||||
CueTrack cueTrack = new CueTrack
|
||||
var cueTrack = new CueTrack
|
||||
{
|
||||
Number = (int)(track.Sequence?.TrackNumber ?? 0),
|
||||
DataType = ConvertToDataType(track.TrackType1, track.BytesPerSector),
|
||||
@@ -2711,7 +2747,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
};
|
||||
|
||||
// Create cue file entry
|
||||
CueFile cueFile = new CueFile
|
||||
var cueFile = new CueFile
|
||||
{
|
||||
FileName = GenerateTrackName(basePath, (int)totalTracks, cueTrack.Number, opticalDisc.DiscType),
|
||||
FileType = CueFileType.BINARY,
|
||||
@@ -2930,8 +2966,8 @@ namespace MPF.Core.Modules.Aaru
|
||||
return null;
|
||||
|
||||
// Required variables
|
||||
Datafile datafile = new Datafile();
|
||||
List<Rom> roms = new List<Rom>();
|
||||
var datafile = new Datafile();
|
||||
var roms = new List<Rom>();
|
||||
|
||||
// Process OpticalDisc, if possible
|
||||
if (cicmSidecar.OpticalDisc != null && cicmSidecar.OpticalDisc.Length > 0)
|
||||
@@ -3184,7 +3220,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
}
|
||||
|
||||
// Now generate the byte array data
|
||||
List<byte> pvdData = new List<byte>();
|
||||
var pvdData = new List<byte>();
|
||||
pvdData.AddRange(new string(' ', 13).ToCharArray().Select(c => (byte)c));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(creation));
|
||||
pvdData.AddRange(GeneratePVDDateTimeBytes(modification));
|
||||
@@ -3255,7 +3291,11 @@ namespace MPF.Core.Modules.Aaru
|
||||
return null;
|
||||
|
||||
string pvdLine = $"{row} : ";
|
||||
#if NET48
|
||||
pvdLine += BitConverter.ToString(bytes.Slice(0, 8).ToArray()).Replace("-", " ");
|
||||
#else
|
||||
pvdLine += BitConverter.ToString(bytes[..8].ToArray()).Replace("-", " ");
|
||||
#endif
|
||||
pvdLine += " ";
|
||||
pvdLine += BitConverter.ToString(bytes.Slice(8, 8).ToArray().ToArray()).Replace("-", " ");
|
||||
pvdLine += " ";
|
||||
@@ -3295,7 +3335,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
if (xtr == null)
|
||||
return null;
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
var serializer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
return serializer.Deserialize(xtr) as CICMMetadataType;
|
||||
}
|
||||
|
||||
@@ -3402,7 +3442,7 @@ namespace MPF.Core.Modules.Aaru
|
||||
long? totalErrors = null;
|
||||
|
||||
// Parse the resume XML file
|
||||
using (StreamReader sr = File.OpenText(resume))
|
||||
using (var sr = File.OpenText(resume))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace MPF.Core.Modules
|
||||
/// <summary>
|
||||
/// Set of flags to pass to the executable
|
||||
/// </summary>
|
||||
#if NET48
|
||||
protected Dictionary<string, bool?> flags = new Dictionary<string, bool?>();
|
||||
#else
|
||||
protected Dictionary<string, bool?> flags = new();
|
||||
#endif
|
||||
protected internal IEnumerable<string> Keys => flags.Keys;
|
||||
|
||||
/// <summary>
|
||||
@@ -239,7 +243,11 @@ namespace MPF.Core.Modules
|
||||
/// </summary>
|
||||
/// <param name="basePath">Base filename and path to use for checking</param>
|
||||
/// <returns>List of all log file paths, empty otherwise</returns>
|
||||
#if NET48
|
||||
public virtual List<string> GetLogFilePaths(string basePath) => new List<string>();
|
||||
#else
|
||||
public virtual List<string> GetLogFilePaths(string basePath) => new();
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Get the MediaType from the current set of parameters
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace MPF.Core.Modules.CleanRip
|
||||
/// <inheritdoc/>
|
||||
public override (bool, List<string>) CheckAllOutputFilesExist(string basePath, bool preCheck)
|
||||
{
|
||||
List<string> missingFiles = new List<string>();
|
||||
var missingFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.DVD: // Only added here to help users; not strictly correct
|
||||
@@ -70,9 +70,15 @@ namespace MPF.Core.Modules.CleanRip
|
||||
public override void GenerateSubmissionInfo(SubmissionInfo info, Options options, string basePath, Drive? drive, bool includeArtifacts)
|
||||
#endif
|
||||
{
|
||||
// Ensure that required sections exist
|
||||
info = InfoTool.EnsureAllSections(info);
|
||||
|
||||
// TODO: Determine if there's a CleanRip version anywhere
|
||||
if (info.DumpingInfo == null) info.DumpingInfo = new DumpingInfoSection();
|
||||
#if NET48
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#else
|
||||
info.DumpingInfo!.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#endif
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + "-dumpinfo.txt")?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
var datafile = GenerateCleanripDatafile(basePath + ".iso", basePath + "-dumpinfo.txt");
|
||||
@@ -80,8 +86,11 @@ namespace MPF.Core.Modules.CleanRip
|
||||
// Get the individual hash data, as per internal
|
||||
if (GetISOHashValues(datafile, out long size, out var crc32, out var md5, out var sha1))
|
||||
{
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Size = size;
|
||||
#else
|
||||
info.SizeAndChecksums!.Size = size;
|
||||
#endif
|
||||
info.SizeAndChecksums.CRC32 = crc32;
|
||||
info.SizeAndChecksums.MD5 = md5;
|
||||
info.SizeAndChecksums.SHA1 = sha1;
|
||||
@@ -98,23 +107,23 @@ namespace MPF.Core.Modules.CleanRip
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
if (File.Exists(basePath + ".bca"))
|
||||
{
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.BCA = GetBCA(basePath + ".bca");
|
||||
}
|
||||
#else
|
||||
info.Extras!.BCA = GetBCA(basePath + ".bca");
|
||||
#endif
|
||||
|
||||
if (GetGameCubeWiiInformation(basePath + "-dumpinfo.txt", out Region? gcRegion, out var gcVersion, out var gcName))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
info.CommonDiscInfo.Region = gcRegion ?? info.CommonDiscInfo.Region;
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = gcVersion ?? info.VersionAndEditions.Version;
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = gcRegion ?? info.CommonDiscInfo.Region;
|
||||
info.VersionAndEditions.Version = gcVersion ?? info.VersionAndEditions.Version;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalName] = gcName ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.Region = gcRegion ?? info.CommonDiscInfo.Region;
|
||||
info.VersionAndEditions!.Version = gcVersion ?? info.VersionAndEditions.Version;
|
||||
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalName] = gcName ?? string.Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -123,7 +132,12 @@ namespace MPF.Core.Modules.CleanRip
|
||||
// Fill in any artifacts that exist, Base64-encoded, if we need to
|
||||
if (includeArtifacts)
|
||||
{
|
||||
#if NET48
|
||||
if (info.Artifacts == null) info.Artifacts = new Dictionary<string, string>();
|
||||
#else
|
||||
info.Artifacts ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
|
||||
if (File.Exists(basePath + ".bca"))
|
||||
info.Artifacts["bca"] = GetBase64(GetFullFile(basePath + ".bca", binary: true)) ?? string.Empty;
|
||||
if (File.Exists(basePath + "-dumpinfo.txt"))
|
||||
@@ -134,7 +148,7 @@ namespace MPF.Core.Modules.CleanRip
|
||||
/// <inheritdoc/>
|
||||
public override List<string> GetLogFilePaths(string basePath)
|
||||
{
|
||||
List<string> logFiles = new List<string>();
|
||||
var logFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.DVD: // Only added here to help users; not strictly correct
|
||||
@@ -171,7 +185,7 @@ namespace MPF.Core.Modules.CleanRip
|
||||
if (!File.Exists(dumpinfo))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(dumpinfo))
|
||||
using (var sr = File.OpenText(dumpinfo))
|
||||
{
|
||||
long size = new FileInfo(iso).Length;
|
||||
string crc = string.Empty;
|
||||
@@ -190,12 +204,21 @@ namespace MPF.Core.Modules.CleanRip
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (string.IsNullOrWhiteSpace(line))
|
||||
continue;
|
||||
#if NET48
|
||||
else if (line.StartsWith("CRC32"))
|
||||
crc = line.Substring(7).ToLowerInvariant();
|
||||
else if (line.StartsWith("MD5"))
|
||||
md5 = line.Substring(5);
|
||||
else if (line.StartsWith("SHA-1"))
|
||||
sha1 = line.Substring(7);
|
||||
#else
|
||||
else if (line.StartsWith("CRC32"))
|
||||
crc = line[7..].ToLowerInvariant();
|
||||
else if (line.StartsWith("MD5"))
|
||||
md5 = line[5..];
|
||||
else if (line.StartsWith("SHA-1"))
|
||||
sha1 = line[7..];
|
||||
#endif
|
||||
}
|
||||
|
||||
return new Datafile
|
||||
@@ -267,7 +290,7 @@ namespace MPF.Core.Modules.CleanRip
|
||||
if (!File.Exists(dumpinfo))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(dumpinfo))
|
||||
using (var sr = File.OpenText(dumpinfo))
|
||||
{
|
||||
long size = new FileInfo(iso).Length;
|
||||
string crc = string.Empty;
|
||||
@@ -286,12 +309,21 @@ namespace MPF.Core.Modules.CleanRip
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (string.IsNullOrWhiteSpace(line))
|
||||
continue;
|
||||
#if NET48
|
||||
else if (line.StartsWith("CRC32"))
|
||||
crc = line.Substring(7).ToLowerInvariant();
|
||||
else if (line.StartsWith("MD5"))
|
||||
md5 = line.Substring(5);
|
||||
else if (line.StartsWith("SHA-1"))
|
||||
sha1 = line.Substring(7);
|
||||
#else
|
||||
else if (line.StartsWith("CRC32"))
|
||||
crc = line[7..].ToLowerInvariant();
|
||||
else if (line.StartsWith("MD5"))
|
||||
md5 = line[5..];
|
||||
else if (line.StartsWith("SHA-1"))
|
||||
sha1 = line[7..];
|
||||
#endif
|
||||
}
|
||||
|
||||
return $"<rom name=\"{Path.GetFileName(iso)}\" size=\"{size}\" crc=\"{crc}\" md5=\"{md5}\" sha1=\"{sha1}\" />";
|
||||
@@ -324,7 +356,7 @@ namespace MPF.Core.Modules.CleanRip
|
||||
if (!File.Exists(dumpinfo))
|
||||
return false;
|
||||
|
||||
using (StreamReader sr = File.OpenText(dumpinfo))
|
||||
using (var sr = File.OpenText(dumpinfo))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -342,15 +374,27 @@ namespace MPF.Core.Modules.CleanRip
|
||||
}
|
||||
else if (line.StartsWith("Version"))
|
||||
{
|
||||
#if NET48
|
||||
version = line.Substring("Version: ".Length);
|
||||
#else
|
||||
version = line["Version: ".Length..];
|
||||
#endif
|
||||
}
|
||||
else if (line.StartsWith("Internal Name"))
|
||||
{
|
||||
#if NET48
|
||||
name = line.Substring("Internal Name: ".Length);
|
||||
#else
|
||||
name = line["Internal Name: ".Length..];
|
||||
#endif
|
||||
}
|
||||
else if (line.StartsWith("Filename"))
|
||||
{
|
||||
#if NET48
|
||||
string serial = line.Substring("Filename: ".Length);
|
||||
#else
|
||||
string serial = line["Filename: ".Length..];
|
||||
#endif
|
||||
|
||||
// char gameType = serial[0];
|
||||
// string gameid = serial[1] + serial[2];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -293,9 +293,15 @@ namespace MPF.Core.Modules.Redumper
|
||||
public override void GenerateSubmissionInfo(SubmissionInfo info, Options options, string basePath, Drive? drive, bool includeArtifacts)
|
||||
#endif
|
||||
{
|
||||
// Ensure that required sections exist
|
||||
info = InfoTool.EnsureAllSections(info);
|
||||
|
||||
// Get the dumping program and version
|
||||
if (info.DumpingInfo == null) info.DumpingInfo = new DumpingInfoSection();
|
||||
#if NET48
|
||||
info.DumpingInfo.DumpingProgram = $"{EnumConverter.LongName(this.InternalProgram)} {GetVersion($"{basePath}.log") ?? "Unknown Version"}";
|
||||
#else
|
||||
info.DumpingInfo!.DumpingProgram = $"{EnumConverter.LongName(this.InternalProgram)} {GetVersion($"{basePath}.log") ?? "Unknown Version"}";
|
||||
#endif
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate($"{basePath}.log")?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// Fill in the hardware data
|
||||
@@ -309,67 +315,89 @@ namespace MPF.Core.Modules.Redumper
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.PVD = GetPVD($"{basePath}.log") ?? "Disc has no PVD";
|
||||
if (info.TracksAndWriteOffsets == null) info.TracksAndWriteOffsets = new TracksAndWriteOffsetsSection();
|
||||
info.TracksAndWriteOffsets.ClrMameProData = GetDatfile($"{basePath}.log");
|
||||
#else
|
||||
info.Extras!.PVD = GetPVD($"{basePath}.log") ?? "Disc has no PVD";
|
||||
info.TracksAndWriteOffsets!.ClrMameProData = GetDatfile($"{basePath}.log");
|
||||
#endif
|
||||
info.TracksAndWriteOffsets.Cuesheet = GetFullFile($"{basePath}.cue") ?? string.Empty;
|
||||
|
||||
// Attempt to get the write offset
|
||||
string cdWriteOffset = GetWriteOffset($"{basePath}.log") ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
info.CommonDiscInfo.RingWriteOffset = cdWriteOffset;
|
||||
#else
|
||||
info.CommonDiscInfo!.RingWriteOffset = cdWriteOffset;
|
||||
#endif
|
||||
info.TracksAndWriteOffsets.OtherWriteOffsets = cdWriteOffset;
|
||||
|
||||
// Attempt to get the error count
|
||||
long errorCount = GetErrorCount($"{basePath}.log");
|
||||
info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
|
||||
// Attempt to get multisession data
|
||||
string cdMultiSessionInfo = GetMultisessionInformation($"{basePath}.log") ?? string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(cdMultiSessionInfo))
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Multisession] = cdMultiSessionInfo;
|
||||
#else
|
||||
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.Multisession] = cdMultiSessionInfo;
|
||||
#endif
|
||||
|
||||
// Attempt to get the universal hash, if it's an audio disc
|
||||
if (this.System.IsAudio())
|
||||
{
|
||||
string universalHash = GetUniversalHash($"{basePath}.log") ?? string.Empty;
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash;
|
||||
#else
|
||||
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.UniversalHash] = universalHash;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Attempt to get the non-zero data start, if it's an audio disc
|
||||
if (this.System.IsAudio())
|
||||
{
|
||||
string ringNonZeroDataStart = GetRingNonZeroDataStart($"{basePath}.log") ?? string.Empty;
|
||||
#if NET48
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.RingNonZeroDataStart] = ringNonZeroDataStart;
|
||||
#else
|
||||
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.RingNonZeroDataStart] = ringNonZeroDataStart;
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MediaType.DVD:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.PVD = GetPVD($"{basePath}.log") ?? "Disc has no PVD";
|
||||
if (info.TracksAndWriteOffsets == null) info.TracksAndWriteOffsets = new TracksAndWriteOffsetsSection();
|
||||
info.TracksAndWriteOffsets.ClrMameProData = GetDatfile($"{basePath}.log");
|
||||
#else
|
||||
info.Extras!.PVD = GetPVD($"{basePath}.log") ?? "Disc has no PVD";
|
||||
info.TracksAndWriteOffsets!.ClrMameProData = GetDatfile($"{basePath}.log");
|
||||
#endif
|
||||
|
||||
// Get the individual hash data, as per internal
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
if (GetISOHashValues(info.TracksAndWriteOffsets.ClrMameProData, out long size, out var crc32, out var md5, out var sha1))
|
||||
{
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Size = size;
|
||||
#else
|
||||
info.SizeAndChecksums!.Size = size;
|
||||
#endif
|
||||
info.SizeAndChecksums.CRC32 = crc32;
|
||||
info.SizeAndChecksums.MD5 = md5;
|
||||
info.SizeAndChecksums.SHA1 = sha1;
|
||||
}
|
||||
|
||||
string layerbreak = GetLayerbreak($"{basePath}.log") ?? string.Empty;
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Layerbreak = !string.IsNullOrEmpty(layerbreak) ? Int64.Parse(layerbreak) : default;
|
||||
#else
|
||||
info.SizeAndChecksums!.Layerbreak = !string.IsNullOrEmpty(layerbreak) ? Int64.Parse(layerbreak) : default;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -385,27 +413,31 @@ namespace MPF.Core.Modules.Redumper
|
||||
|
||||
case RedumpSystem.DVDAudio:
|
||||
case RedumpSystem.DVDVideo:
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#if NET48
|
||||
info.CopyProtection.Protection = GetDVDProtection($"{basePath}.log") ?? string.Empty;
|
||||
#else
|
||||
info.CopyProtection!.Protection = GetDVDProtection($"{basePath}.log") ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.KonamiPython2:
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var pythonTwoSerial, out Region? pythonTwoRegion, out var pythonTwoDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = pythonTwoSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = pythonTwoSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? pythonTwoRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = pythonTwoDate;
|
||||
}
|
||||
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
#if NET48
|
||||
info.VersionAndEditions.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
@@ -421,15 +453,13 @@ namespace MPF.Core.Modules.Redumper
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaMegaCDSegaCD:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
info.Extras.Header = GetSegaCDHeader($"{basePath}.log", out var scdBuildDate, out var scdSerial, out _) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.Extras.Header = GetSegaCDHeader($"{basePath}.log", out var scdBuildDate, out var scdSerial, out _) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = scdSerial ?? string.Empty;
|
||||
#else
|
||||
info.Extras!.Header = GetSegaCDHeader($"{basePath}.log", out var scdBuildDate, out var scdSerial, out _) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = scdSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.EXEDateBuildDate = scdBuildDate ?? string.Empty;
|
||||
// TODO: Support region setting from parsed value
|
||||
break;
|
||||
@@ -451,8 +481,11 @@ namespace MPF.Core.Modules.Redumper
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaSaturn:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.Header = GetSaturnHeader($"{basePath}.log") ?? string.Empty;
|
||||
#else
|
||||
info.Extras!.Header = GetSaturnHeader($"{basePath}.log") ?? string.Empty;
|
||||
#endif
|
||||
|
||||
// Take only the first 16 lines for Saturn
|
||||
if (!string.IsNullOrEmpty(info.Extras.Header))
|
||||
@@ -461,15 +494,13 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (GetSaturnBuildInfo(info.Extras.Header, out var saturnSerial, out var saturnVersion, out var buildDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = saturnSerial ?? string.Empty;
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = saturnVersion ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = saturnSerial ?? string.Empty;
|
||||
info.VersionAndEditions!.Version = saturnVersion ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.EXEDateBuildDate = buildDate ?? string.Empty;
|
||||
}
|
||||
|
||||
@@ -479,21 +510,22 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var playstationSerial, out Region? playstationRegion, out var playstationDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = playstationSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = playstationDate;
|
||||
}
|
||||
|
||||
if (info.CopyProtection == null) info.CopyProtection = new CopyProtectionSection();
|
||||
#if NET48
|
||||
info.CopyProtection.AntiModchip = GetPlayStationAntiModchipDetected($"{basePath}.log").ToYesNo();
|
||||
if (info.EDC == null) info.EDC = new EDCSection();
|
||||
info.EDC.EDC = GetPlayStationEDCStatus($"{basePath}.log").ToYesNo();
|
||||
#else
|
||||
info.CopyProtection!.AntiModchip = GetPlayStationAntiModchipDetected($"{basePath}.log").ToYesNo();
|
||||
info.EDC!.EDC = GetPlayStationEDCStatus($"{basePath}.log").ToYesNo();
|
||||
#endif
|
||||
info.CopyProtection.LibCrypt = GetPlayStationLibCryptStatus($"{basePath}.log").ToYesNo();
|
||||
info.CopyProtection.LibCryptData = GetPlayStationLibCryptData($"{basePath}.log");
|
||||
break;
|
||||
@@ -502,62 +534,62 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (GetPlayStationExecutableInfo(drive?.Letter, out var playstationTwoSerial, out Region? playstationTwoRegion, out var playstationTwoDate))
|
||||
{
|
||||
// Ensure internal serial is pulled from local data
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = playstationTwoSerial ?? string.Empty;
|
||||
#else
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationTwoSerial ?? string.Empty;
|
||||
#endif
|
||||
info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion;
|
||||
info.CommonDiscInfo.EXEDateBuildDate = playstationTwoDate;
|
||||
}
|
||||
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
#if NET48
|
||||
info.VersionAndEditions.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation2Version(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation3:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation3Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation3Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation3Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation4:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation4Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation4Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation4Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RedumpSystem.SonyPlayStation5:
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode?, string>();
|
||||
#else
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null) info.CommonDiscInfo.CommentsSpecialFields = new Dictionary<SiteCode, string>();
|
||||
#endif
|
||||
info.VersionAndEditions.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = GetPlayStation5Serial(drive?.Letter) ?? string.Empty;
|
||||
#else
|
||||
info.VersionAndEditions!.Version = GetPlayStation5Version(drive?.Letter) ?? string.Empty;
|
||||
info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName] = GetPlayStation5Serial(drive?.Letter) ?? string.Empty;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// Fill in any artifacts that exist, Base64-encoded, if we need to
|
||||
if (includeArtifacts)
|
||||
{
|
||||
#if NET48
|
||||
if (info.Artifacts == null) info.Artifacts = new Dictionary<string, string>();
|
||||
#else
|
||||
info.Artifacts ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
|
||||
if (File.Exists($"{basePath}.cdtext"))
|
||||
info.Artifacts["cdtext"] = GetBase64(GetFullFile($"{basePath}.cdtext")) ?? string.Empty;
|
||||
if (File.Exists($"{basePath}.cue"))
|
||||
@@ -1330,7 +1362,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1376,7 +1408,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1428,7 +1460,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
#else
|
||||
string? region = null, rceProtection = null, copyrightProtectionSystemType = null, vobKeys = null, decryptedDiscKey = null;
|
||||
#endif
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1529,7 +1561,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return -1;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1580,7 +1612,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1659,7 +1691,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1725,7 +1757,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1765,7 +1797,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1809,7 +1841,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1851,7 +1883,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1895,7 +1927,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1941,7 +1973,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2033,7 +2065,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2093,7 +2125,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2185,7 +2217,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2232,7 +2264,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2283,7 +2315,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
// redumper v2022.10.28 [Oct 28 2022, 05:41:43] (print usage: --help,-h)
|
||||
// redumper v2022.12.22 build_87 [Dec 22 2022, 01:56:26]
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -2327,7 +2359,7 @@ namespace MPF.Core.Modules.Redumper
|
||||
if (!File.Exists(log))
|
||||
return false;
|
||||
|
||||
using (StreamReader sr = File.OpenText(log))
|
||||
using (var sr = File.OpenText(log))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
/// <inheritdoc/>
|
||||
public override (bool, List<string>) CheckAllOutputFilesExist(string basePath, bool preCheck)
|
||||
{
|
||||
List<string> missingFiles = new List<string>();
|
||||
var missingFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.UMD:
|
||||
@@ -71,22 +71,34 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
public override void GenerateSubmissionInfo(SubmissionInfo info, Options options, string basePath, Drive? drive, bool includeArtifacts)
|
||||
#endif
|
||||
{
|
||||
// Ensure that required sections exist
|
||||
info = InfoTool.EnsureAllSections(info);
|
||||
|
||||
// TODO: Determine if there's a UMDImageCreator version anywhere
|
||||
if (info.DumpingInfo == null) info.DumpingInfo = new DumpingInfoSection();
|
||||
#if NET48
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#else
|
||||
info.DumpingInfo!.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
#endif
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + "_disc.txt")?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.UMD:
|
||||
if (info.Extras == null) info.Extras = new ExtrasSection();
|
||||
#if NET48
|
||||
info.Extras.PVD = GetPVD(basePath + "_mainInfo.txt") ?? string.Empty;
|
||||
#else
|
||||
info.Extras!.PVD = GetPVD(basePath + "_mainInfo.txt") ?? string.Empty;
|
||||
#endif
|
||||
|
||||
if (GetFileHashes(basePath + ".iso", out long filesize, out var crc32, out var md5, out var sha1))
|
||||
{
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
#if NET48
|
||||
info.SizeAndChecksums.Size = filesize;
|
||||
#else
|
||||
info.SizeAndChecksums!.Size = filesize;
|
||||
#endif
|
||||
info.SizeAndChecksums.CRC32 = crc32;
|
||||
info.SizeAndChecksums.MD5 = md5;
|
||||
info.SizeAndChecksums.SHA1 = sha1;
|
||||
@@ -94,13 +106,17 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
|
||||
if (GetUMDAuxInfo(basePath + "_disc.txt", out var title, out DiscCategory? umdcat, out var umdversion, out var umdlayer, out long umdsize))
|
||||
{
|
||||
if (info.CommonDiscInfo == null) info.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
#if NET48
|
||||
info.CommonDiscInfo.Title = title ?? string.Empty;
|
||||
info.CommonDiscInfo.Category = umdcat ?? DiscCategory.Games;
|
||||
if (info.VersionAndEditions == null) info.VersionAndEditions = new VersionAndEditionsSection();
|
||||
info.VersionAndEditions.Version = umdversion ?? string.Empty;
|
||||
if (info.SizeAndChecksums == null) info.SizeAndChecksums = new SizeAndChecksumsSection();
|
||||
info.SizeAndChecksums.Size = umdsize;
|
||||
#else
|
||||
info.CommonDiscInfo!.Title = title ?? string.Empty;
|
||||
info.CommonDiscInfo.Category = umdcat ?? DiscCategory.Games;
|
||||
info.VersionAndEditions!.Version = umdversion ?? string.Empty;
|
||||
info.SizeAndChecksums!.Size = umdsize;
|
||||
#endif
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(umdlayer))
|
||||
info.SizeAndChecksums.Layerbreak = Int64.Parse(umdlayer ?? "-1");
|
||||
@@ -112,7 +128,12 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
// Fill in any artifacts that exist, Base64-encoded, if we need to
|
||||
if (includeArtifacts)
|
||||
{
|
||||
#if NET48
|
||||
if (info.Artifacts == null) info.Artifacts = new Dictionary<string, string>();
|
||||
#else
|
||||
info.Artifacts ??= new Dictionary<string, string>();
|
||||
#endif
|
||||
|
||||
if (File.Exists(basePath + "_disc.txt"))
|
||||
info.Artifacts["disc"] = GetBase64(GetFullFile(basePath + "_disc.txt")) ?? string.Empty;
|
||||
if (File.Exists(basePath + "_drive.txt"))
|
||||
@@ -129,7 +150,7 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
/// <inheritdoc/>
|
||||
public override List<string> GetLogFilePaths(string basePath)
|
||||
{
|
||||
List<string> logFiles = new List<string>();
|
||||
var logFiles = new List<string>();
|
||||
switch (this.Type)
|
||||
{
|
||||
case MediaType.UMD:
|
||||
@@ -169,7 +190,7 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
if (!File.Exists(mainInfo))
|
||||
return null;
|
||||
|
||||
using (StreamReader sr = File.OpenText(mainInfo))
|
||||
using (var sr = File.OpenText(mainInfo))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -211,7 +232,7 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
if (!File.Exists(disc))
|
||||
return false;
|
||||
|
||||
using (StreamReader sr = File.OpenText(disc))
|
||||
using (var sr = File.OpenText(disc))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -224,7 +245,11 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
break;
|
||||
|
||||
if (line.StartsWith("TITLE") && title == null)
|
||||
#if NET48
|
||||
title = line.Substring("TITLE: ".Length);
|
||||
#else
|
||||
title = line["TITLE: ".Length..];
|
||||
#endif
|
||||
else if (line.StartsWith("DISC_VERSION") && umdversion == null)
|
||||
umdversion = line.Split(' ')[1];
|
||||
else if (line.StartsWith("pspUmdTypes"))
|
||||
@@ -236,7 +261,7 @@ namespace MPF.Core.Modules.UmdImageCreator
|
||||
}
|
||||
|
||||
// If the L0 length is the size of the full disc, there's no layerbreak
|
||||
if (Int64.TryParse(umdlayer, out long umdlayerValue) && umdlayerValue * 2048 == umdsize)
|
||||
if (Int64.TryParse(umdlayer, out long umdlayerValue) && umdlayerValue * 2048 == umdsize)
|
||||
umdlayer = null;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace MPF.Core.Utilities
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
using (System.Net.WebClient wc = new System.Net.WebClient())
|
||||
using (var wc = new System.Net.WebClient())
|
||||
{
|
||||
wc.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0";
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace MPF.Core.Utilities
|
||||
return (latestTag, releaseUrl);
|
||||
}
|
||||
#else
|
||||
using (System.Net.Http.HttpClient hc = new System.Net.Http.HttpClient())
|
||||
using (var hc = new System.Net.Http.HttpClient())
|
||||
{
|
||||
// TODO: Figure out a better way than having this hardcoded...
|
||||
string url = "https://api.github.com/repos/SabreTools/MPF/releases/latest";
|
||||
|
||||
Reference in New Issue
Block a user