From 1d9a2c9be78d82c5a3c1ef534cc6e62cd23101ee Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 5 Nov 2018 20:27:01 -0800 Subject: [PATCH] Make sure that detected disc type is shown; cleanup --- DICUI.Forms/Windows/MainWindow.cs | 2 +- DICUI.Library/Utilities/Converters.cs | 1 - DICUI.Library/Utilities/Validators.cs | 10 ---------- DICUI/Windows/MainWindow.xaml.cs | 4 ++-- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/DICUI.Forms/Windows/MainWindow.cs b/DICUI.Forms/Windows/MainWindow.cs index 8796e30b..03a7a2bf 100644 --- a/DICUI.Forms/Windows/MainWindow.cs +++ b/DICUI.Forms/Windows/MainWindow.cs @@ -634,7 +634,7 @@ namespace DICUI.Forms.Windows { ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter); _currentMediaType = Validators.GetDiscType(drive.Letter); - ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType != null ? "unable to detect." : ("detected " + _currentMediaType.Name() + ".")); + ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType == null ? "unable to detect." : ("detected " + _currentMediaType.Name() + ".")); } } diff --git a/DICUI.Library/Utilities/Converters.cs b/DICUI.Library/Utilities/Converters.cs index c3b65d0d..11872e7e 100644 --- a/DICUI.Library/Utilities/Converters.cs +++ b/DICUI.Library/Utilities/Converters.cs @@ -259,7 +259,6 @@ namespace DICUI.Utilities case MediaType.Cassette: return ".wav"; case MediaType.NONE: - case MediaType.CED: default: return null; } diff --git a/DICUI.Library/Utilities/Validators.cs b/DICUI.Library/Utilities/Validators.cs index 955482bb..afa172e1 100644 --- a/DICUI.Library/Utilities/Validators.cs +++ b/DICUI.Library/Utilities/Validators.cs @@ -462,9 +462,7 @@ namespace DICUI.Utilities var collection = searcher.Get(); foreach (ManagementObject queryObj in collection) - { deviceId = (string)queryObj["DeviceID"]; - } } catch { @@ -474,9 +472,7 @@ namespace DICUI.Utilities // If we got no valid device, we don't care and just return if (deviceId == null) - { return null; - } // Get all relevant disc information try @@ -487,16 +483,12 @@ namespace DICUI.Utilities foreach (var disc in discMaster) { if (disc.ToString().Contains(deviceId)) - { id = disc.ToString(); - } } // If we couldn't find the drive, we don't care and return if (id == null) - { return null; - } // Otherwise, we get the media type, if any MsftDiscRecorder2 recorder = new MsftDiscRecorder2(); @@ -505,9 +497,7 @@ namespace DICUI.Utilities dataWriter.Recorder = recorder; var media = dataWriter.CurrentPhysicalMediaType; if (media != IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN) - { return Converters.IMAPIDiskTypeToMediaType(media); - } } catch { diff --git a/DICUI/Windows/MainWindow.xaml.cs b/DICUI/Windows/MainWindow.xaml.cs index 6cde0ac9..42603713 100644 --- a/DICUI/Windows/MainWindow.xaml.cs +++ b/DICUI/Windows/MainWindow.xaml.cs @@ -263,7 +263,7 @@ namespace DICUI.Windows if (currentSystem != null) { - _mediaTypes = Validators.GetValidMediaTypes(currentSystem).ToList(); + _mediaTypes = Validators.GetValidMediaTypes(currentSystem); MediaTypeComboBox.ItemsSource = _mediaTypes; MediaTypeComboBox.IsEnabled = _mediaTypes.Count > 1; @@ -628,7 +628,7 @@ namespace DICUI.Windows { ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter); _currentMediaType = Validators.GetDiscType(drive.Letter); - ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType != null ? "unable to detect." : ("detected " + _currentMediaType.Name() + ".")); + ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType == null ? "unable to detect." : ("detected " + _currentMediaType.Name() + ".")); } }