/// <summary> /// Execute the initial invocation of the dumping programs /// </summary> /// <param name="progress">Optional result progress callback</param> public async Task <Result> Run(IProgress <Result> progress = null) { // Check that we have the basics for dumping Result result = IsValidForDump(); if (!result) { return(result); } // Invoke output processing, if needed if (!Options.ToolsInSeparateWindow) { outputQueue = new ProcessingQueue <string>(ProcessOutputs); Parameters.ReportStatus += OutputToLog; } // Execute internal tool progress?.Report(Result.Success($"Executing {Options.InternalProgram}... {(Options.ToolsInSeparateWindow ? "please wait!" : "see log for output!")}")); Directory.CreateDirectory(OutputDirectory); await Task.Run(() => Parameters.ExecuteInternalProgram(Options.ToolsInSeparateWindow)); progress?.Report(Result.Success($"{Options.InternalProgram} has finished!")); // Execute additional tools progress?.Report(Result.Success("Running any additional tools... see log for output!")); result = await Task.Run(() => ExecuteAdditionalTools()); progress?.Report(result); // Remove event handler if needed if (!Options.ToolsInSeparateWindow) { outputQueue.Dispose(); Parameters.ReportStatus -= OutputToLog; } return(result); }