From c9d59a90e49fdfd7dd4ed2bcfc632894d0ed5669 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 11 Oct 2020 21:07:28 -0700 Subject: [PATCH] Default to CD-ROM when detection fails as well --- DICUI.Avalonia/MainWindow.axaml.cs | 4 +++- DICUI/Windows/MainWindow.xaml.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DICUI.Avalonia/MainWindow.axaml.cs b/DICUI.Avalonia/MainWindow.axaml.cs index 1b729565..7baffb5b 100644 --- a/DICUI.Avalonia/MainWindow.axaml.cs +++ b/DICUI.Avalonia/MainWindow.axaml.cs @@ -135,7 +135,9 @@ namespace DICUI.Avalonia { ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter); CurrentMediaType = Validators.GetMediaType(drive); - ViewModels.LoggerViewModel.VerboseLogLn(CurrentMediaType == null ? "unable to detect." : ("detected " + CurrentMediaType.LongName() + ".")); + ViewModels.LoggerViewModel.VerboseLogLn(CurrentMediaType == null ? "unable to detect, defaulting to CD-ROM." : ($"detected {CurrentMediaType.LongName()}.")); + if (CurrentMediaType == null) + CurrentMediaType = MediaType.CDROM; } } } diff --git a/DICUI/Windows/MainWindow.xaml.cs b/DICUI/Windows/MainWindow.xaml.cs index 9acba402..75b74f79 100644 --- a/DICUI/Windows/MainWindow.xaml.cs +++ b/DICUI/Windows/MainWindow.xaml.cs @@ -124,7 +124,9 @@ namespace DICUI.Windows { ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter); CurrentMediaType = Validators.GetMediaType(drive); - ViewModels.LoggerViewModel.VerboseLogLn(CurrentMediaType == null ? "unable to detect." : ("detected " + CurrentMediaType.LongName() + ".")); + ViewModels.LoggerViewModel.VerboseLogLn(CurrentMediaType == null ? "unable to detect, defaulting to CD-ROM." : ($"detected {CurrentMediaType.LongName()}.")); + if (CurrentMediaType == null) + CurrentMediaType = MediaType.CDROM; } } }