From 76b549d7734dba10313008e0c8837f98ccddd71d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 17 Aug 2018 20:08:50 -0700 Subject: [PATCH] Add try/catch around dump (fixes #110) --- DICUI/MainWindow.xaml.cs | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/DICUI/MainWindow.xaml.cs b/DICUI/MainWindow.xaml.cs index f7c89124..ce2553e3 100644 --- a/DICUI/MainWindow.xaml.cs +++ b/DICUI/MainWindow.xaml.cs @@ -385,24 +385,34 @@ namespace DICUI { _env = DetermineEnvironment(); - // Check for the firmware first - // TODO: Remove this (and method) once DIC end-to-end logging becomes a thing - if (!await _env.DriveHasLatestFimrware()) - return; + try + { + // Check for the firmware first + // TODO: Remove this (and method) once DIC end-to-end logging becomes a thing + if (!await _env.DriveHasLatestFimrware()) + return; - StartStopButton.Content = UIElements.StopDumping; - CopyProtectScanButton.IsEnabled = false; - StatusLabel.Content = "Beginning dumping process"; - ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process.."); + StartStopButton.Content = UIElements.StopDumping; + CopyProtectScanButton.IsEnabled = false; + StatusLabel.Content = "Beginning dumping process"; + ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process.."); - var progress = new Progress(); - progress.ProgressChanged += ProgressUpdated; - Result result = await _env.StartDumping(progress); + var progress = new Progress(); + progress.ProgressChanged += ProgressUpdated; + Result result = await _env.StartDumping(progress); - StatusLabel.Content = result ? "Dumping complete!" : result.Message; - ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message); - StartStopButton.Content = UIElements.StartDumping; - CopyProtectScanButton.IsEnabled = true; + StatusLabel.Content = result ? "Dumping complete!" : result.Message; + ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message); + } + catch + { + // No-op, we don't care what it was + } + finally + { + StartStopButton.Content = UIElements.StartDumping; + CopyProtectScanButton.IsEnabled = true; + } if (EjectWhenDoneCheckBox.IsChecked == true) _env.EjectDisc();