Clarify the unmounted device case (fixes #921)

This commit is contained in:
Matt Nadareski
2025-11-24 13:14:24 -05:00
parent a48f9d1c83
commit 395cded5ef
4 changed files with 17 additions and 7 deletions

View File

@@ -74,6 +74,7 @@
- Ensure volume label is trimmed if used in filenames
- Remove DPM identifier for StarForce Keyless
- New Redumper Drive Pregap Start option
- Clarify the unmounted device case
### 3.5.0 (2025-10-10)

View File

@@ -207,13 +207,16 @@ namespace MPF.Frontend.Tools
/// Format found protections to a deduplicated, ordered string
/// </summary>
/// <param name="protections">Dictionary of file to list of protection mappings</param>
/// <param name="drive">Drive object representing the current drive</param>
/// <returns>Detected protections, if any</returns>
public static string? FormatProtections(Dictionary<string, List<string>>? protections)
public static string? FormatProtections(Dictionary<string, List<string>>? protections, Drive? drive)
{
// If the filtered list is empty in some way, return
if (protections == null)
return "(CHECK WITH PROTECTIONID)";
else if (protections.Count == 0)
return "[EXTERNAL SCAN NEEDED]";
else if (protections.Count == 0 && drive?.Name == null)
return "Mounted disc path missing [EXTERNAL SCAN NEEDED]";
else if (protections.Count == 0 && drive?.Name != null)
return "None found [OMIT FROM SUBMISSION]";
// Sanitize context-sensitive protections
@@ -637,7 +640,7 @@ namespace MPF.Frontend.Tools
foundProtections = foundProtections.FindAll(p => p != "StarForce");
}
}
if (foundProtections.Exists(p => p.StartsWith("StarForce Keyless")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("StarForce Keyless"));

View File

@@ -131,9 +131,15 @@ namespace MPF.Frontend.Tools
{
Dictionary<string, List<string>>? protections = null;
if (options.ScanForProtection)
protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress);
{
// Explicitly note missing/invalid device paths
if (drive?.Name == null)
resultProgress?.Report(ResultEventArgs.Success("No mounted device path found, protection outputs may be incomplete!"));
var protectionString = ProtectionTool.FormatProtections(protections);
protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress);
}
var protectionString = ProtectionTool.FormatProtections(protections, drive);
info.CopyProtection.Protection += protectionString;
info.CopyProtection.FullProtections = ReformatProtectionDictionary(protections);

View File

@@ -1959,7 +1959,7 @@ namespace MPF.Frontend.ViewModels
try
{
var protections = await ProtectionTool.RunProtectionScanOnPath(CurrentDrive.Name, Options, progress);
var output = ProtectionTool.FormatProtections(protections);
var output = ProtectionTool.FormatProtections(protections, CurrentDrive);
LogLn($"Detected the following protections in {CurrentDrive.Name}:\r\n\r\n{output}");
return output;