From 4bb02b88fc830e3850dbf72d4b0515ebde09514d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 21 May 2024 11:03:44 -0400 Subject: [PATCH] Fix dictionary error in Redumper parsing --- CHANGELIST.md | 4 ++++ MPF.Core/Modules/Redumper/Parameters.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 472f07c9..3a283795 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -1,3 +1,7 @@ +### 3.1.9a (2024-05-21) + +- Fix dictionary error in Redumper parsing + ### 3.1.9 (2024-05-19) - Update Redumper to build 325 diff --git a/MPF.Core/Modules/Redumper/Parameters.cs b/MPF.Core/Modules/Redumper/Parameters.cs index 5917850b..998dad4f 100644 --- a/MPF.Core/Modules/Redumper/Parameters.cs +++ b/MPF.Core/Modules/Redumper/Parameters.cs @@ -437,7 +437,7 @@ namespace MPF.Core.Modules.Redumper if (InfoTool.GetPlayStationExecutableInfo(drive?.Name, out var pythonTwoSerial, out Region? pythonTwoRegion, out var pythonTwoDate)) { // Ensure internal serial is pulled from local data - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = pythonTwoSerial ?? string.Empty; info.CommonDiscInfo.Region ??= pythonTwoRegion; if (string.IsNullOrEmpty(info.CommonDiscInfo.EXEDateBuildDate)) @@ -513,7 +513,7 @@ namespace MPF.Core.Modules.Redumper if (InfoTool.GetPlayStationExecutableInfo(drive?.Name, out var playstationSerial, out Region? playstationRegion, out var playstationDate)) { // Ensure internal serial is pulled from local data - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationSerial ?? string.Empty; info.CommonDiscInfo.Region ??= playstationRegion; if (string.IsNullOrEmpty(info.CommonDiscInfo.EXEDateBuildDate)) @@ -541,7 +541,7 @@ namespace MPF.Core.Modules.Redumper if (InfoTool.GetPlayStationExecutableInfo(drive?.Name, out var playstationTwoSerial, out Region? playstationTwoRegion, out var playstationTwoDate)) { // Ensure internal serial is pulled from local data - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = playstationTwoSerial ?? string.Empty; info.CommonDiscInfo.Region = info.CommonDiscInfo.Region ?? playstationTwoRegion; if (string.IsNullOrEmpty(info.CommonDiscInfo.EXEDateBuildDate)) @@ -562,7 +562,7 @@ namespace MPF.Core.Modules.Redumper // Get metadata from drive if not available from log if (string.IsNullOrEmpty(info.VersionAndEditions!.Version)) info.VersionAndEditions.Version = InfoTool.GetPlayStation3Version(drive?.Name) ?? string.Empty; - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = InfoTool.GetPlayStation3Serial(drive?.Name) ?? string.Empty; firmwareVersion ??= InfoTool.GetPlayStation3FirmwareVersion(drive?.Name); if (firmwareVersion != null) @@ -577,7 +577,7 @@ namespace MPF.Core.Modules.Redumper } if (string.IsNullOrEmpty(info.VersionAndEditions!.Version)) info.VersionAndEditions.Version = InfoTool.GetPlayStation4Version(drive?.Name) ?? string.Empty; - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = InfoTool.GetPlayStation4Serial(drive?.Name) ?? string.Empty; break; @@ -589,7 +589,7 @@ namespace MPF.Core.Modules.Redumper } if (string.IsNullOrEmpty(info.VersionAndEditions!.Version)) info.VersionAndEditions.Version = InfoTool.GetPlayStation5Version(drive?.Name) ?? string.Empty; - if (string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) + if (!info.CommonDiscInfo!.CommentsSpecialFields!.ContainsKey(SiteCode.InternalSerialName) || string.IsNullOrEmpty(info.CommonDiscInfo!.CommentsSpecialFields![SiteCode.InternalSerialName])) info.CommonDiscInfo.CommentsSpecialFields![SiteCode.InternalSerialName] = InfoTool.GetPlayStation5Serial(drive?.Name) ?? string.Empty; break; }