From 09afdf52fb065b6f9579dc3b229ce47011cf385e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 2 Oct 2023 01:17:14 -0400 Subject: [PATCH] Skip system detection on inactive drives (fixes #558) --- CHANGELIST.md | 1 + MPF.UI.Core/ViewModels/MainViewModel.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 3b84c112..7ff61df6 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -15,6 +15,7 @@ - Fix XGD4 PIC reading - Ensure popups are topmost - Try out more UI functionality +- Skip system detection on inactive drives ### 2.6.5 (2023-09-27) diff --git a/MPF.UI.Core/ViewModels/MainViewModel.cs b/MPF.UI.Core/ViewModels/MainViewModel.cs index 97f69a6b..867fac8b 100644 --- a/MPF.UI.Core/ViewModels/MainViewModel.cs +++ b/MPF.UI.Core/ViewModels/MainViewModel.cs @@ -940,7 +940,12 @@ namespace MPF.UI.Core.ViewModels if (Drives == null || Drives.Count == 0 || this.Parent.DriveLetterComboBox.SelectedIndex == -1) { if (this.Options.VerboseLogging) - this.Logger.VerboseLog("Skipping system type detection because no valid drives found!"); + this.Logger.VerboseLogLn("Skipping system type detection because no valid drives found!"); + } + else if ((this.Parent.DriveLetterComboBox.SelectedItem as Drive)?.MarkedActive != true) + { + if (this.Options.VerboseLogging) + this.Logger.VerboseLogLn("Skipping system type detection because drive not marked as active!"); } else if (!this.Options.SkipSystemDetection) { @@ -960,7 +965,7 @@ namespace MPF.UI.Core.ViewModels { var currentSystem = this.Options.DefaultSystem; if (this.Options.VerboseLogging) - this.Logger.VerboseLog($"System detection disabled, setting to default of {currentSystem.LongName()}."); + this.Logger.VerboseLogLn($"System detection disabled, setting to default of {currentSystem.LongName()}."); int sysIndex = Systems.FindIndex(s => s == currentSystem); this.Parent.SystemTypeComboBox.SelectedIndex = sysIndex; } @@ -1120,7 +1125,7 @@ namespace MPF.UI.Core.ViewModels // Pull the drive letter from the UI directly, just in case var drive = this.Parent.DriveLetterComboBox.SelectedItem as Drive; - if (drive.Letter != default(char)) + if (drive != null && drive.Letter != default(char)) { if (this.Options.VerboseLogging) this.Logger.VerboseLogLn($"Scanning for copy protection in {drive.Letter}");