diff --git a/MPF.Library/Data/BaseParameters.cs b/MPF.Library/Data/BaseParameters.cs index fad91006..581be892 100644 --- a/MPF.Library/Data/BaseParameters.cs +++ b/MPF.Library/Data/BaseParameters.cs @@ -171,32 +171,39 @@ namespace MPF.Data /// /// Run internal program /// - public void ExecuteInternalProgram() + /// True to show in separate window, false otherwise + public void ExecuteInternalProgram(bool separateWindow) { - var tcs = new TaskCompletionSource(); - process = new Process() + // Create the start info + var startInfo = new ProcessStartInfo() { - StartInfo = new ProcessStartInfo() - { - FileName = ExecutablePath, - Arguments = GenerateParameters() ?? "", - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - }, + FileName = ExecutablePath, + Arguments = GenerateParameters() ?? "", + CreateNoWindow = !separateWindow, + UseShellExecute = separateWindow, + RedirectStandardOutput = !separateWindow, + RedirectStandardError = !separateWindow, }; + + // Create the new process + process = new Process() { StartInfo = startInfo }; - // Add event handlers - process.OutputDataReceived += OutputToLog; - process.ErrorDataReceived += OutputToLog; + // Add event handlers, if necessary + if (!separateWindow) + { + process.OutputDataReceived += OutputToLog; + process.ErrorDataReceived += OutputToLog; + } // Start the process process.Start(); - // Begin reading the outputs - process.BeginOutputReadLine(); - process.BeginErrorReadLine(); + // Begin reading the outputs, if necessary + if (!separateWindow) + { + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + } process.WaitForExit(); process.Close(); diff --git a/MPF.Library/Data/Options.cs b/MPF.Library/Data/Options.cs index f18ba7cc..885468e2 100644 --- a/MPF.Library/Data/Options.cs +++ b/MPF.Library/Data/Options.cs @@ -268,6 +268,15 @@ namespace MPF.Data set { _settings["IgnoreFixedDrives"] = value.ToString(); } } + /// + /// Show dumping tools in their own window instead of in the log + /// + public bool ToolsInSeparateWindow + { + get { return GetBooleanSetting(_settings, "ToolsInSeparateWindow", false); } + set { _settings["ToolsInSeparateWindow"] = value.ToString(); } + } + #endregion #region Skip Options diff --git a/MPF.Library/Utilities/DumpEnvironment.cs b/MPF.Library/Utilities/DumpEnvironment.cs index 86a0bb26..dad3bf1a 100644 --- a/MPF.Library/Utilities/DumpEnvironment.cs +++ b/MPF.Library/Utilities/DumpEnvironment.cs @@ -386,10 +386,10 @@ namespace MPF.Utilities return result; // Execute internal tool - progress?.Report(Result.Success($"Executing {Options.InternalProgram}... see log for output!")); + progress?.Report(Result.Success($"Executing {Options.InternalProgram}... {(Options.ToolsInSeparateWindow ? "please wait!" : "see log for output!")}")); Directory.CreateDirectory(OutputDirectory); Parameters.ReportStatus += OutputToLog; - await Task.Run(() => Parameters.ExecuteInternalProgram()); + await Task.Run(() => Parameters.ExecuteInternalProgram(Options.ToolsInSeparateWindow)); progress?.Report(Result.Success($"{Options.InternalProgram} has finished!")); // Execute additional tools diff --git a/MPF/UserControls/LogOutput.xaml.cs b/MPF/UserControls/LogOutput.xaml.cs index 16208a72..a0eeb7ea 100644 --- a/MPF/UserControls/LogOutput.xaml.cs +++ b/MPF/UserControls/LogOutput.xaml.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; @@ -124,6 +123,18 @@ namespace MPF.UserControls ProgressLabel.Text = string.Format("Scanning sectors for protection... ({0:##.##}%)", percentProgress); } })); + + _matchers.Add(new Matcher( + "Checking SubQ ctl (Track)", + @"\s*(\d+)\/\s*(\d+)$", + match => { + if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) + { + float percentProgress = (current / (float)total) * 100; + ProgressBar.Value = percentProgress; + ProgressLabel.Text = string.Format("Checking subchannels... ({0:##.##}%)", percentProgress); + } + })); } #endregion diff --git a/MPF/Windows/OptionsWindow.xaml b/MPF/Windows/OptionsWindow.xaml index 2323044c..a6a9f636 100644 --- a/MPF/Windows/OptionsWindow.xaml +++ b/MPF/Windows/OptionsWindow.xaml @@ -80,6 +80,11 @@ ToolTip="Ignore hard drives and other fixed drives" Margin="0,4" /> + +