diff --git a/CHANGELIST.md b/CHANGELIST.md index 434b02a0..fe8b1a9b 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -80,6 +80,7 @@ - Use proper base path for redumper output check - Verify securom sector count - Update packages +- Simplify direct package references ### 3.2.4 (2024-11-24) diff --git a/MPF.CLI/MPF.CLI.csproj b/MPF.CLI/MPF.CLI.csproj index e749f2b9..0c815a73 100644 --- a/MPF.CLI/MPF.CLI.csproj +++ b/MPF.CLI/MPF.CLI.csproj @@ -42,7 +42,6 @@ - diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs index ba8f816e..4d26140a 100644 --- a/MPF.CLI/Program.cs +++ b/MPF.CLI/Program.cs @@ -3,7 +3,6 @@ using System.IO; #if NET40 using System.Threading.Tasks; #endif -using BinaryObjectScanner; using MPF.Frontend; using MPF.Frontend.Tools; using SabreTools.RedumpLib.Data; @@ -124,15 +123,9 @@ namespace MPF.CLI } env.SetExecutionContext(paramStr); - // Make new Progress objects - var resultProgress = new Progress(); - resultProgress.ProgressChanged += ConsoleLogger.ProgressUpdated; - var protectionProgress = new Progress(); - protectionProgress.ProgressChanged += ConsoleLogger.ProgressUpdated; - // Invoke the dumping program Console.WriteLine($"Invoking {options.InternalProgram} using '{paramStr}'"); - var dumpResult = env.Run(resultProgress).GetAwaiter().GetResult(); + var dumpResult = env.Run().GetAwaiter().GetResult(); Console.WriteLine(dumpResult.Message); if (!dumpResult) return; @@ -158,7 +151,7 @@ namespace MPF.CLI } // Finally, attempt to do the output dance - var verifyResult = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress) + var verifyResult = env.VerifyAndSaveDumpOutput() .ConfigureAwait(false).GetAwaiter().GetResult(); Console.WriteLine(verifyResult.Message); } diff --git a/MPF.Check/ConsoleLogger.cs b/MPF.Check/ConsoleLogger.cs deleted file mode 100644 index 14cf63e4..00000000 --- a/MPF.Check/ConsoleLogger.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using BinaryObjectScanner; -using MPF.Frontend; - -namespace MPF.Check -{ - public static class ConsoleLogger - { - /// - /// Simple process counter to write to console - /// - public static void ProgressUpdated(object? sender, ResultEventArgs value) - { - Console.WriteLine(value.Message); - } - - /// - /// Simple process counter to write to console - /// - public static void ProgressUpdated(object? sender, ProtectionProgress value) - { - Console.WriteLine($"{value.Percentage * 100:N2}%: {value.Filename} - {value.Protection}"); - } - } -} diff --git a/MPF.Check/MPF.Check.csproj b/MPF.Check/MPF.Check.csproj index 870a703b..12a6262e 100644 --- a/MPF.Check/MPF.Check.csproj +++ b/MPF.Check/MPF.Check.csproj @@ -46,7 +46,6 @@ - diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs index 92cd652c..ca9679ec 100644 --- a/MPF.Check/Program.cs +++ b/MPF.Check/Program.cs @@ -3,7 +3,6 @@ using System.IO; #if NET40 using System.Threading.Tasks; #endif -using BinaryObjectScanner; using MPF.Frontend; using MPF.Frontend.Tools; using SabreTools.RedumpLib; @@ -69,12 +68,6 @@ namespace MPF.Check return; } - // Make new Progress objects - var resultProgress = new Progress(); - resultProgress.ProgressChanged += ConsoleLogger.ProgressUpdated; - var protectionProgress = new Progress(); - protectionProgress.ProgressChanged += ConsoleLogger.ProgressUpdated; - // Validate the supplied credentials bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); string message = validated switch @@ -108,7 +101,7 @@ namespace MPF.Check var env = new DumpEnvironment(options, filepath, drive, knownSystem, mediaType, internalProgram: null, parameters: null); // Finally, attempt to do the output dance - var result = env.VerifyAndSaveDumpOutput(resultProgress, protectionProgress, seedInfo: opts.Seed) + var result = env.VerifyAndSaveDumpOutput(seedInfo: opts.Seed) .ConfigureAwait(false).GetAwaiter().GetResult(); Console.WriteLine(result.Message); } diff --git a/MPF.Check/launchSettings.json b/MPF.Check/launchSettings.json deleted file mode 100644 index 229d90e6..00000000 --- a/MPF.Check/launchSettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "profiles": { - "MPF.Check": { - "commandName": "Project" - } - } -} \ No newline at end of file diff --git a/MPF.CLI/ConsoleLogger.cs b/MPF.Frontend/ConsoleLogger.cs similarity index 94% rename from MPF.CLI/ConsoleLogger.cs rename to MPF.Frontend/ConsoleLogger.cs index 0b070c1c..53bb1e7c 100644 --- a/MPF.CLI/ConsoleLogger.cs +++ b/MPF.Frontend/ConsoleLogger.cs @@ -1,8 +1,7 @@ using System; using BinaryObjectScanner; -using MPF.Frontend; -namespace MPF.CLI +namespace MPF.Frontend { public static class ConsoleLogger { diff --git a/MPF.Frontend/DumpEnvironment.cs b/MPF.Frontend/DumpEnvironment.cs index cd412c55..ac5b37a7 100644 --- a/MPF.Frontend/DumpEnvironment.cs +++ b/MPF.Frontend/DumpEnvironment.cs @@ -389,6 +389,14 @@ namespace MPF.Frontend if (_executionContext == null) return ResultEventArgs.Failure("Error! Current configuration is not supported!"); + // Build default console progress indicators if none exist + if (progress == null) + { + var temp = new Progress(); + temp.ProgressChanged += ConsoleLogger.ProgressUpdated; + progress = temp; + } + // Check that we have the basics for dumping ResultEventArgs result = IsValidForDump(); if (!result) @@ -428,6 +436,20 @@ namespace MPF.Frontend if (_processor == null) return ResultEventArgs.Failure("Error! Current configuration is not supported!"); + // Build default console progress indicators if none exist + if (resultProgress == null) + { + var temp = new Progress(); + temp.ProgressChanged += ConsoleLogger.ProgressUpdated; + resultProgress = temp; + } + if (protectionProgress == null) + { + var temp = new Progress(); + temp.ProgressChanged += ConsoleLogger.ProgressUpdated; + protectionProgress = temp; + } + resultProgress?.Report(ResultEventArgs.Success("Gathering submission information... please wait!")); // Get the output directory and filename separately diff --git a/MPF.UI/MPF.UI.csproj b/MPF.UI/MPF.UI.csproj index 0ed13cef..04049342 100644 --- a/MPF.UI/MPF.UI.csproj +++ b/MPF.UI/MPF.UI.csproj @@ -69,7 +69,6 @@ -