Make sure that detected disc type is shown; cleanup

This commit is contained in:
Matt Nadareski
2018-11-05 20:27:01 -08:00
parent 538c0bba09
commit 1d9a2c9be7
4 changed files with 3 additions and 14 deletions

View File

@@ -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() + "."));
}
}

View File

@@ -259,7 +259,6 @@ namespace DICUI.Utilities
case MediaType.Cassette:
return ".wav";
case MediaType.NONE:
case MediaType.CED:
default:
return null;
}

View File

@@ -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
{

View File

@@ -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() + "."));
}
}