From 1af9e2c2daaf904fb9b040e55b9bd25b8066d0da Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 14 Jan 2022 16:30:20 -0800 Subject: [PATCH] Conditionally pull region from Redump --- CHANGELIST.md | 1 + MPF.Library/InfoTool.cs | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 7c274fcf..a82d39a6 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -46,6 +46,7 @@ - Fix Sega CD internal serial reading - Fix crash on invalid parameters - Differentiate XMID and XeMID +- Conditionally pull region from Redump ### 2.2 (2021-12-30) - Fix Saturn header finding diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index f8e4aea8..b67a2c65 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -1373,9 +1373,12 @@ namespace MPF.Library info.CommonDiscInfo.Category = DiscCategory.Games; // Region - match = Constants.RegionRegex.Match(discData); - if (match.Success) - info.CommonDiscInfo.Region = Extensions.ToRegion(match.Groups[1].Value); + if (info.CommonDiscInfo.Region == null) + { + match = Constants.RegionRegex.Match(discData); + if (match.Success) + info.CommonDiscInfo.Region = Extensions.ToRegion(match.Groups[1].Value); + } // Languages var matches = Constants.LanguagesRegex.Matches(discData); @@ -1395,11 +1398,10 @@ namespace MPF.Library // info.CommonDiscInfo.Serial = WebUtility.HtmlDecode(match.Groups[1].Value); // Error count - match = Constants.ErrorCountRegex.Match(discData); - if (match.Success) + if (string.IsNullOrEmpty(info.CommonDiscInfo.ErrorsCount)) { - // If the error count is empty, fill from the page - if (string.IsNullOrEmpty(info.CommonDiscInfo.ErrorsCount)) + match = Constants.ErrorCountRegex.Match(discData); + if (match.Success) info.CommonDiscInfo.ErrorsCount = match.Groups[1].Value; }