Esempio n. 1
0
        /// <summary>
        /// Begin the dumping process using the given inputs
        /// </summary>
        private async void StartDumping()
        {
            if (_env == null)
            {
                _env = DetermineEnvironment();
            }

            // If still in custom parameter mode, check that users meant to continue or not
            if (EnableParametersCheckBox.IsChecked == true)
            {
                MessageBoxResult result = MessageBox.Show("It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", "Custom Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    EnableParametersCheckBox.IsChecked = false;
                    ParametersTextBox.IsEnabled        = false;
                    ProcessCustomParameters();
                }
                else if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                // If "No", then we continue with the current known environment
            }

            try
            {
                // Check for the firmware first
                // TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
                if (!await _env.DriveHasLatestFimrware())
                {
                    MessageBox.Show($"DiscImageCreator has reported that drive {_env.Drive.Letter} is not updated to the most recent firmware. Please update the firmware for your drive and try again.", "Outdated Firmware", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                // Validate that the user explicitly wants an inactive drive to be considered for dumping
                if (!_env.Drive.MarkedActive)
                {
                    MessageBoxResult mbresult = MessageBox.Show("The currently selected drive does not appear to contain a disc! Are you sure you want to continue?", "Missing Disc", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                    if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
                    {
                        ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
                        return;
                    }
                }

                // If a complete dump already exists
                if (_env.FoundAllFiles())
                {
                    MessageBoxResult mbresult = MessageBox.Show("A complete dump already exists! Are you sure you want to overwrite?", "Overwrite?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                    if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
                    {
                        ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
                        return;
                    }
                }

                StartStopButton.Content         = Constants.StopDumping;
                CopyProtectScanButton.IsEnabled = false;
                StatusLabel.Content             = "Beginning dumping process";
                ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");

                var progress = new Progress <Result>();
                progress.ProgressChanged += ProgressUpdated;
                Result result = await _env.StartDumping(progress);

                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         = Constants.StartDumping;
                CopyProtectScanButton.IsEnabled = true;
            }

            if (EjectWhenDoneCheckBox.IsChecked == true)
            {
                ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
                _env.EjectDisc();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Begin the dumping process using the given inputs
        /// </summary>
        private async void StartDumping()
        {
            if (_env == null)
            {
                _env = DetermineEnvironment();
            }

            // If still in custom parameter mode, check that users meant to continue or not
            if (EnableParametersCheckBox.IsChecked == true)
            {
                MessageBoxResult result = MessageBox.Show("It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", "Custom Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    EnableParametersCheckBox.IsChecked = false;
                    ParametersTextBox.IsEnabled        = false;
                    ProcessCustomParameters();
                }
                else if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                // If "No", then we continue with the current known environment
            }

            // Fix the output paths
            _env.FixOutputPaths();

            try
            {
                // Check for the firmware first for DiscImageCreator
                // TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
                if (!_env.UseChef && !await _env.DriveHasLatestFimrware())
                {
                    MessageBox.Show($"DiscImageCreator has reported that drive {_env.Drive.Letter} is not updated to the most recent firmware. Please update the firmware for your drive and try again.", "Outdated Firmware", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                // Validate that the user explicitly wants an inactive drive to be considered for dumping
                if (!_env.Drive.MarkedActive)
                {
                    MessageBoxResult mbresult = MessageBox.Show("The currently selected drive does not appear to contain a disc! Are you sure you want to continue?", "Missing Disc", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                    if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
                    {
                        ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
                        return;
                    }
                }

                // If a complete dump already exists
                if (_env.FoundAllFiles())
                {
                    MessageBoxResult mbresult = MessageBox.Show("A complete dump already exists! Are you sure you want to overwrite?", "Overwrite?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                    if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
                    {
                        ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
                        return;
                    }
                }

                StartStopButton.Content         = Constants.StopDumping;
                CopyProtectScanButton.IsEnabled = false;
                StatusLabel.Content             = "Beginning dumping process";
                ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");

                var progress = new Progress <Result>();
                progress.ProgressChanged += ProgressUpdated;
                Result result = await _env.Run(progress);

                // If we didn't execute a dumping command we cannot get submission output
                bool isDumpingCommand = false;
                if (_env.UseChef)
                {
                    isDumpingCommand = _env.ChefParameters.IsDumpingCommand();
                }
                else
                {
                    isDumpingCommand = _env.CreatorParameters.IsDumpingCommand();
                }

                if (!isDumpingCommand)
                {
                    ViewModels.LoggerViewModel.VerboseLogLn("No dumping command was run, submission information will not be gathered.");
                    StatusLabel.Content             = "Execution complete!";
                    StartStopButton.Content         = Constants.StartDumping;
                    CopyProtectScanButton.IsEnabled = true;
                    return;
                }

                if (result)
                {
                    // TODO: Remove Chef handling when irrelevant
                    if (_env.UseChef)
                    {
                        ViewModels.LoggerViewModel.VerboseLogLn("DiscImageChef does not support split tracks or DiscImageCreator-compatible outputs");
                        ViewModels.LoggerViewModel.VerboseLogLn("No automatic submission information will be gathered for this disc");
                    }
                    else
                    {
                        // Verify dump output and save it
                        result = _env.VerifyAndSaveDumpOutput(progress,
                                                              EjectWhenDoneCheckBox.IsChecked,
                                                              _options.ResetDriveAfterDump,
                                                              (si) =>
                        {
                            // lazy initialization
                            if (_discInformationWindow == null)
                            {
                                _discInformationWindow         = new DiscInformationWindow(this, si);
                                _discInformationWindow.Closed += delegate
                                {
                                    _discInformationWindow = null;
                                };
                            }

                            _discInformationWindow.Owner = this;
                            _discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                            _discInformationWindow.Refresh();
                            return(_discInformationWindow.ShowDialog());
                        }
                                                              );
                    }
                }

                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         = Constants.StartDumping;
                CopyProtectScanButton.IsEnabled = true;
            }
        }