From 0b48324a6838fc4db7d0931eb1511e165a9adc26 Mon Sep 17 00:00:00 2001 From: Deterous <138427222+Deterous@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:00:29 +0900 Subject: [PATCH 1/2] Print error when redump is down --- MPF.CLI/MPF.CLI.csproj | 2 +- MPF.Check/MPF.Check.csproj | 2 +- .../MPF.ExecutionContexts.Test.csproj | 2 +- .../MPF.ExecutionContexts.csproj | 2 +- MPF.Frontend.Test/MPF.Frontend.Test.csproj | 2 +- MPF.Frontend/MPF.Frontend.csproj | 2 +- MPF.Frontend/Tools/SubmissionGenerator.cs | 25 ++++++++++++------- .../MPF.Processors.Test.csproj | 2 +- MPF.Processors/MPF.Processors.csproj | 2 +- MPF.UI/MPF.UI.csproj | 2 +- 10 files changed, 25 insertions(+), 18 deletions(-) diff --git a/MPF.CLI/MPF.CLI.csproj b/MPF.CLI/MPF.CLI.csproj index f93a5e4ab..70175ceaf 100644 --- a/MPF.CLI/MPF.CLI.csproj +++ b/MPF.CLI/MPF.CLI.csproj @@ -44,7 +44,7 @@ - + \ No newline at end of file diff --git a/MPF.Check/MPF.Check.csproj b/MPF.Check/MPF.Check.csproj index 7b3958949..35bfb213e 100644 --- a/MPF.Check/MPF.Check.csproj +++ b/MPF.Check/MPF.Check.csproj @@ -44,7 +44,7 @@ - + \ No newline at end of file diff --git a/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj b/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj index 4a4551295..a5927b2c8 100644 --- a/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj +++ b/MPF.ExecutionContexts.Test/MPF.ExecutionContexts.Test.csproj @@ -17,7 +17,7 @@ - + diff --git a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj index a12d096ee..21fe997d9 100644 --- a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj +++ b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj @@ -32,7 +32,7 @@ - + \ No newline at end of file diff --git a/MPF.Frontend.Test/MPF.Frontend.Test.csproj b/MPF.Frontend.Test/MPF.Frontend.Test.csproj index 6f3d84c42..257d8d880 100644 --- a/MPF.Frontend.Test/MPF.Frontend.Test.csproj +++ b/MPF.Frontend.Test/MPF.Frontend.Test.csproj @@ -17,7 +17,7 @@ - + diff --git a/MPF.Frontend/MPF.Frontend.csproj b/MPF.Frontend/MPF.Frontend.csproj index a3ca61566..47706e35e 100644 --- a/MPF.Frontend/MPF.Frontend.csproj +++ b/MPF.Frontend/MPF.Frontend.csproj @@ -38,7 +38,7 @@ - + diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index 3fe8232e5..73f8471af 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -266,12 +266,17 @@ public static async Task FillFromRedump(Options options, } var foundIds = await Validator.ValidateSingleTrack(wc, info, sha1); - if (foundIds is not null && foundIds.Count == 1) + if (foundIds is null) + { + resultProgress?.Report(ResultEventArgs.Failure($"Error accessing redump.org")); + return false; + } + else if (foundIds.Count == 0) + resultProgress?.Report(ResultEventArgs.Failure($"No matches found for {sha1}")); + else if (foundIds.Count == 1) resultProgress?.Report(ResultEventArgs.Success($"Single match found for {sha1}")); - else if (foundIds is not null && foundIds.Count != 1) - resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for {sha1}")); else - resultProgress?.Report(ResultEventArgs.Failure($"No matches found for {sha1}")); + resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for {sha1}")); // Add the found IDs to the map foundIdSets.Add(foundIds?.ToArray() ?? []); @@ -306,12 +311,14 @@ public static async Task FillFromRedump(Options options, { string sha1 = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash]; var foundIds = await Validator.ValidateUniversalHash(wc, info); - if (foundIds is not null && foundIds.Count == 1) + if (foundIds is null) + resultProgress?.Report(ResultEventArgs.Failure($"Error accessing redump.org")); + else if (foundIds.Count == 0) + resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}")); + else if (foundIds.Count == 1) resultProgress?.Report(ResultEventArgs.Success($"Single match found for universal hash {sha1}")); - else if (foundIds is not null && foundIds.Count != 1) - resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for universal hash {sha1}")); else - resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}")); + resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for universal hash {sha1}")); // Ensure that the hash is found allFound = foundIds is not null && foundIds.Count == 1; @@ -333,7 +340,7 @@ public static async Task FillFromRedump(Options options, info.PartiallyMatchedIDs.Sort(); resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIdsList is not null && fullyMatchedIdsList.Count > 0 - ? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertAll(i => i.ToString())]) + ? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertA ll(i => i.ToString())]) : "No matches found"))); // Exit early if one failed or there are no matched IDs diff --git a/MPF.Processors.Test/MPF.Processors.Test.csproj b/MPF.Processors.Test/MPF.Processors.Test.csproj index 03cd9aae3..98394161e 100644 --- a/MPF.Processors.Test/MPF.Processors.Test.csproj +++ b/MPF.Processors.Test/MPF.Processors.Test.csproj @@ -27,7 +27,7 @@ - + diff --git a/MPF.Processors/MPF.Processors.csproj b/MPF.Processors/MPF.Processors.csproj index ab4d0c7d3..3f505fadc 100644 --- a/MPF.Processors/MPF.Processors.csproj +++ b/MPF.Processors/MPF.Processors.csproj @@ -35,7 +35,7 @@ - + diff --git a/MPF.UI/MPF.UI.csproj b/MPF.UI/MPF.UI.csproj index 440826053..2d53ff506 100644 --- a/MPF.UI/MPF.UI.csproj +++ b/MPF.UI/MPF.UI.csproj @@ -70,7 +70,7 @@ - + From 1b641e533218da9c5a74eb8266392b209e5a492a Mon Sep 17 00:00:00 2001 From: Deterous <138427222+Deterous@users.noreply.github.com> Date: Mon, 2 Feb 2026 22:55:43 +0900 Subject: [PATCH 2/2] code review --- MPF.Frontend/Tools/SubmissionGenerator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index 73f8471af..4c42495eb 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -268,7 +268,7 @@ public static async Task FillFromRedump(Options options, var foundIds = await Validator.ValidateSingleTrack(wc, info, sha1); if (foundIds is null) { - resultProgress?.Report(ResultEventArgs.Failure($"Error accessing redump.org")); + resultProgress?.Report(ResultEventArgs.Failure("Error accessing redump.org")); return false; } else if (foundIds.Count == 0) @@ -312,7 +312,7 @@ public static async Task FillFromRedump(Options options, string sha1 = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash]; var foundIds = await Validator.ValidateUniversalHash(wc, info); if (foundIds is null) - resultProgress?.Report(ResultEventArgs.Failure($"Error accessing redump.org")); + resultProgress?.Report(ResultEventArgs.Failure("Error accessing redump.org")); else if (foundIds.Count == 0) resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}")); else if (foundIds.Count == 1) @@ -340,7 +340,7 @@ public static async Task FillFromRedump(Options options, info.PartiallyMatchedIDs.Sort(); resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIdsList is not null && fullyMatchedIdsList.Count > 0 - ? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertA ll(i => i.ToString())]) + ? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertAll(i => i.ToString())]) : "No matches found"))); // Exit early if one failed or there are no matched IDs