From 331f875e7f0bbe3883e4ed90cd7c10865065ff4c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 24 Sep 2018 12:17:57 -0700 Subject: [PATCH] Add better progress logging for dumps (fixes #121) --- DICUI/Utilities/DumpEnvironment.cs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/DICUI/Utilities/DumpEnvironment.cs b/DICUI/Utilities/DumpEnvironment.cs index ebf426d3..1f206017 100644 --- a/DICUI/Utilities/DumpEnvironment.cs +++ b/DICUI/Utilities/DumpEnvironment.cs @@ -229,7 +229,7 @@ namespace DICUI.Utilities // Verify dump output and save it progress?.Report(Result.Success("Gathering submission information... please wait!")); - result = await Task.Run(() => VerifyAndSaveDumpOutput()); + result = await Task.Run(() => VerifyAndSaveDumpOutput(progress)); progress?.Report(Result.Success("All submission information gathered!")); return result; @@ -359,7 +359,7 @@ namespace DICUI.Utilities /// Drive letter to check /// Dictionary containing mapped output values, null on error /// TODO: Make sure that all special formats are accounted for - private Dictionary ExtractOutputInformation() + private Dictionary ExtractOutputInformation(IProgress progress) { // Ensure the current disc combination should exist if (!Validators.GetValidMediaTypes(System).Contains(Type)) @@ -422,7 +422,11 @@ namespace DICUI.Utilities case KnownSystem.IBMPCCompatible: case KnownSystem.RainbowDisc: mappings[Template.ISBNField] = Template.OptionalValue; + + progress?.Report(Result.Success("Running copy protection scan... this might take a while!")); mappings[Template.CopyProtectionField] = GetCopyProtection(); + progress?.Report(Result.Success("Copy protection scan complete!")); + if (File.Exists(combinedBase + "_subIntention.txt")) { FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt"); @@ -525,7 +529,11 @@ namespace DICUI.Utilities case KnownSystem.IBMPCCompatible: case KnownSystem.RainbowDisc: mappings[Template.ISBNField] = Template.OptionalValue; + + progress?.Report(Result.Success("Running copy protection scan... this might take a while!")); mappings[Template.CopyProtectionField] = GetCopyProtection(); + progress?.Report(Result.Success("Copy protection scan complete!")); + if (File.Exists(combinedBase + "_subIntention.txt")) { FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt"); @@ -1620,15 +1628,23 @@ namespace DICUI.Utilities /// Verify that the current environment has a complete dump and create submission info is possible /// /// Result instance with the outcome - private Result VerifyAndSaveDumpOutput() + private Result VerifyAndSaveDumpOutput(IProgress progress) { // Check to make sure that the output had all the correct files if (!FoundAllFiles()) return Result.Failure("Error! Please check output directory as dump may be incomplete!"); - Dictionary templateValues = ExtractOutputInformation(); + progress?.Report(Result.Success("Extracting output information from output files...")); + Dictionary templateValues = ExtractOutputInformation(progress); + progress?.Report(Result.Success("Extracting information complete!")); + + progress?.Report(Result.Success("Formatting extracted information...")); List formattedValues = FormatOutputData(templateValues); + progress?.Report(Result.Success("Formatting complete!")); + + progress?.Report(Result.Success("Writing information to !submissionInfo.txt...")); bool success = WriteOutputData(formattedValues); + progress?.Report(Result.Success("Writing complete!")); return Result.Success(); }