From 988a5f6d2b9ce244e64e33b1fc65075253cf95fc Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 18 Oct 2024 13:04:53 -0400 Subject: [PATCH] Update RedumpLib to 1.4.4 --- CHANGELIST.md | 1 + MPF.CLI/MPF.CLI.csproj | 10 +++--- MPF.CLI/Program.cs | 9 ++++- MPF.Check/MPF.Check.csproj | 10 +++--- MPF.Check/Program.cs | 9 ++++- .../MPF.ExecutionContexts.csproj | 8 ++++- MPF.Frontend/DumpEnvironment.cs | 2 +- MPF.Frontend/MPF.Frontend.csproj | 2 +- MPF.Frontend/Tools/SubmissionGenerator.cs | 33 +++++++++---------- MPF.Frontend/ViewModels/OptionsViewModel.cs | 10 +++++- MPF.Processors/MPF.Processors.csproj | 10 ++++-- MPF.Test/MPF.Test.csproj | 2 +- MPF.UI/MPF.UI.csproj | 2 +- 13 files changed, 71 insertions(+), 37 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index e905d647..1d6dc8c1 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -21,6 +21,7 @@ - Add separate field for Regex; assorted cleanup - Reduce cleverness in output file code - No directory means no files +- Update RedumpLib to 1.4.4 ### 3.2.2 (2024-09-24) diff --git a/MPF.CLI/MPF.CLI.csproj b/MPF.CLI/MPF.CLI.csproj index cdaaa656..af06536f 100644 --- a/MPF.CLI/MPF.CLI.csproj +++ b/MPF.CLI/MPF.CLI.csproj @@ -36,6 +36,10 @@ net6.0;net7.0;net8.0 + + + + @@ -43,15 +47,11 @@ - - - - runtime; compile; build; native; analyzers; buildtransitive - + diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs index bb3396b2..1a0813e6 100644 --- a/MPF.CLI/Program.cs +++ b/MPF.CLI/Program.cs @@ -48,7 +48,14 @@ namespace MPF.CLI } // Validate the supplied credentials - (bool? _, string? message) = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); + bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); + string message = validated switch + { + true => "Redump username and password accepted!", + false => "Redump username and password denied!", + null => "An error occurred validating your credentials!", + }; + if (!string.IsNullOrEmpty(message)) Console.WriteLine(message); diff --git a/MPF.Check/MPF.Check.csproj b/MPF.Check/MPF.Check.csproj index 5478b43f..90665740 100644 --- a/MPF.Check/MPF.Check.csproj +++ b/MPF.Check/MPF.Check.csproj @@ -40,6 +40,10 @@ + + + + @@ -47,15 +51,11 @@ - - - - runtime; compile; build; native; analyzers; buildtransitive - + diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs index e65fb748..e2f1fb2a 100644 --- a/MPF.Check/Program.cs +++ b/MPF.Check/Program.cs @@ -77,7 +77,14 @@ namespace MPF.Check protectionProgress.ProgressChanged += ConsoleLogger.ProgressUpdated; // Validate the supplied credentials - (bool? _, string? message) = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); + bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); + string message = validated switch + { + true => "Redump username and password accepted!", + false => "Redump username and password denied!", + null => "An error occurred validating your credentials!", + }; + if (!string.IsNullOrEmpty(message)) Console.WriteLine(message); diff --git a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj index 287e85d0..d2b507a9 100644 --- a/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj +++ b/MPF.ExecutionContexts/MPF.ExecutionContexts.csproj @@ -40,11 +40,17 @@ + + + + + + @@ -53,7 +59,7 @@ - + \ No newline at end of file diff --git a/MPF.Frontend/DumpEnvironment.cs b/MPF.Frontend/DumpEnvironment.cs index 533be2d6..f4c0ade8 100644 --- a/MPF.Frontend/DumpEnvironment.cs +++ b/MPF.Frontend/DumpEnvironment.cs @@ -486,7 +486,7 @@ namespace MPF.Frontend // Format the information for the text output resultProgress?.Report(ResultEventArgs.Success("Formatting information...")); - (var formattedValues, var formatResult) = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility); + var formattedValues = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility, out string? formatResult); if (formattedValues == null) resultProgress?.Report(ResultEventArgs.Failure(formatResult)); else diff --git a/MPF.Frontend/MPF.Frontend.csproj b/MPF.Frontend/MPF.Frontend.csproj index 1d311fb7..4a48e3ee 100644 --- a/MPF.Frontend/MPF.Frontend.csproj +++ b/MPF.Frontend/MPF.Frontend.csproj @@ -67,7 +67,7 @@ - + \ No newline at end of file diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index 989f10b3..5a636420 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -212,17 +212,19 @@ namespace MPF.Frontend.Tools continue; } - (bool singleFound, var foundIds, string? result) = await Validator.ValidateSingleTrack(wc, info, sha1); - if (singleFound) - resultProgress?.Report(ResultEventArgs.Success(result)); + var foundIds = await Validator.ValidateSingleTrack(wc, info, sha1); + if (foundIds != null && foundIds.Count == 1) + resultProgress?.Report(ResultEventArgs.Success($"Single match found for {sha1}")); + else if (foundIds != null && foundIds.Count != 1) + resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for {sha1}")); else - resultProgress?.Report(ResultEventArgs.Failure(result)); + resultProgress?.Report(ResultEventArgs.Failure($"No matches found for {sha1}")); // Add the found IDs to the map foundIdSets.Add(foundIds?.ToArray() ?? []); // Ensure that all tracks are found - allFound &= singleFound; + allFound &= (foundIds != null && foundIds.Count == 1); } // If all tracks were found, check if there are any fully-matched IDs @@ -249,23 +251,20 @@ namespace MPF.Frontend.Tools // If we don't have any matches but we have a universal hash if (!info.PartiallyMatchedIDs.Any() && info.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) == true) { -#if NET40 - var validateTask = Validator.ValidateUniversalHash(wc, info); - validateTask.Wait(); - (bool singleFound, var foundIds, string? result) = validateTask.Result; -#else - (bool singleFound, var foundIds, string? result) = await Validator.ValidateUniversalHash(wc, info); -#endif - if (singleFound) - resultProgress?.Report(ResultEventArgs.Success(result)); + string sha1 = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash]; + var foundIds = await Validator.ValidateUniversalHash(wc, info); + if (foundIds != null && foundIds.Count == 1) + resultProgress?.Report(ResultEventArgs.Success($"Single match found for universal hash {sha1}")); + else if (foundIds != null && foundIds.Count != 1) + resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for universal hash {sha1}")); else - resultProgress?.Report(ResultEventArgs.Failure(result)); + resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}")); // Ensure that the hash is found - allFound = singleFound; + allFound = (foundIds != null && foundIds.Count == 1); // If we found a match, then the disc is a match - if (singleFound && foundIds != null) + if ((foundIds != null && foundIds.Count == 1) && foundIds != null) fullyMatchedIDs = foundIds; else fullyMatchedIDs = []; diff --git a/MPF.Frontend/ViewModels/OptionsViewModel.cs b/MPF.Frontend/ViewModels/OptionsViewModel.cs index 6731d64e..89f26f68 100644 --- a/MPF.Frontend/ViewModels/OptionsViewModel.cs +++ b/MPF.Frontend/ViewModels/OptionsViewModel.cs @@ -123,7 +123,15 @@ namespace MPF.Frontend.ViewModels /// public static async Task<(bool?, string?)> TestRedumpLogin(string username, string password) { - return await RedumpClient.ValidateCredentials(username, password); + bool? validated = await RedumpClient.ValidateCredentials(username, password); + string message = validated switch + { + true => "Redump username and password accepted!", + false => "Redump username and password denied!", + null => "An error occurred validating your credentials!", + }; + + return (validated, message); } /// diff --git a/MPF.Processors/MPF.Processors.csproj b/MPF.Processors/MPF.Processors.csproj index cfef2092..0b8019cd 100644 --- a/MPF.Processors/MPF.Processors.csproj +++ b/MPF.Processors/MPF.Processors.csproj @@ -40,6 +40,9 @@ + + + @@ -48,6 +51,9 @@ + + + @@ -59,8 +65,8 @@ - - + + diff --git a/MPF.Test/MPF.Test.csproj b/MPF.Test/MPF.Test.csproj index 06de015a..960bf140 100644 --- a/MPF.Test/MPF.Test.csproj +++ b/MPF.Test/MPF.Test.csproj @@ -18,7 +18,7 @@ - + diff --git a/MPF.UI/MPF.UI.csproj b/MPF.UI/MPF.UI.csproj index b854f062..31c1fc34 100644 --- a/MPF.UI/MPF.UI.csproj +++ b/MPF.UI/MPF.UI.csproj @@ -76,7 +76,7 @@ runtime; compile; build; native; analyzers; buildtransitive - +