From e5e7bf49fce93098945c2b495c179953a40d7fc3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 20 Dec 2024 23:11:29 -0500 Subject: [PATCH] Fix log line for default system use --- CHANGELIST.md | 1 + MPF.Frontend/ViewModels/MainViewModel.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 0a98128b..ea36708c 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -111,6 +111,7 @@ - Separate params checkbox from input - Disable more UI elements when editing - Ensure parameters checkbox is enabled to start +- Fix log line for default system use ### 3.2.4 (2024-11-24) diff --git a/MPF.Frontend/ViewModels/MainViewModel.cs b/MPF.Frontend/ViewModels/MainViewModel.cs index 3c023c95..05f4e03d 100644 --- a/MPF.Frontend/ViewModels/MainViewModel.cs +++ b/MPF.Frontend/ViewModels/MainViewModel.cs @@ -1263,8 +1263,9 @@ namespace MPF.Frontend.ViewModels else if (!Options.SkipSystemDetection) { VerboseLog($"Trying to detect system for drive {CurrentDrive.Name}.. "); - var currentSystem = GetRedumpSystem(CurrentDrive, Options.DefaultSystem) ?? Options.DefaultSystem; - VerboseLogLn(currentSystem == null ? "unable to detect." : ($"detected {currentSystem.LongName()}.")); + var currentSystem = GetRedumpSystem(CurrentDrive); + VerboseLogLn(currentSystem == null ? $"unable to detect, defaulting to {Options.DefaultSystem.LongName()}" : ($"detected {currentSystem.LongName()}.")); + currentSystem ??= Options.DefaultSystem; if (currentSystem != null) { @@ -1462,17 +1463,15 @@ namespace MPF.Frontend.ViewModels /// /// Get the current system from drive /// - /// - /// - private static RedumpSystem? GetRedumpSystem(Drive? drive, RedumpSystem? defaultValue) + private static RedumpSystem? GetRedumpSystem(Drive? drive) { // If the drive does not exist, we can't do anything if (drive == null) - return defaultValue; + return null; // If we can't read the media in that drive, we can't do anything if (string.IsNullOrEmpty(drive.Name) || !Directory.Exists(drive.Name)) - return defaultValue; + return null; // We're going to assume for floppies, HDDs, and removable drives if (drive.InternalDriveType != InternalDriveType.Optical) @@ -1756,7 +1755,7 @@ namespace MPF.Frontend.ViewModels #endregion // Default return - return defaultValue; + return null; } /// @@ -1873,7 +1872,7 @@ namespace MPF.Frontend.ViewModels else { // No Volume Label found, fallback to something sensible - switch (GetRedumpSystem(drive, null)) + switch (GetRedumpSystem(drive)) { case RedumpSystem.SonyPlayStation: case RedumpSystem.SonyPlayStation2: