Skip to content

Commit 395cded

Browse files
committed
Clarify the unmounted device case (fixes #921)
1 parent a48f9d1 commit 395cded

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

CHANGELIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
- Ensure volume label is trimmed if used in filenames
7575
- Remove DPM identifier for StarForce Keyless
7676
- New Redumper Drive Pregap Start option
77+
- Clarify the unmounted device case
7778

7879
### 3.5.0 (2025-10-10)
7980

MPF.Frontend/Tools/ProtectionTool.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,16 @@ public static async Task<Dictionary<string, List<string>>> RunProtectionScanOnIm
207207
/// Format found protections to a deduplicated, ordered string
208208
/// </summary>
209209
/// <param name="protections">Dictionary of file to list of protection mappings</param>
210+
/// <param name="drive">Drive object representing the current drive</param>
210211
/// <returns>Detected protections, if any</returns>
211-
public static string? FormatProtections(Dictionary<string, List<string>>? protections)
212+
public static string? FormatProtections(Dictionary<string, List<string>>? protections, Drive? drive)
212213
{
213214
// If the filtered list is empty in some way, return
214215
if (protections == null)
215-
return "(CHECK WITH PROTECTIONID)";
216-
else if (protections.Count == 0)
216+
return "[EXTERNAL SCAN NEEDED]";
217+
else if (protections.Count == 0 && drive?.Name == null)
218+
return "Mounted disc path missing [EXTERNAL SCAN NEEDED]";
219+
else if (protections.Count == 0 && drive?.Name != null)
217220
return "None found [OMIT FROM SUBMISSION]";
218221

219222
// Sanitize context-sensitive protections
@@ -637,7 +640,7 @@ public static string SanitizeFoundProtections(List<string> foundProtections)
637640
foundProtections = foundProtections.FindAll(p => p != "StarForce");
638641
}
639642
}
640-
643+
641644
if (foundProtections.Exists(p => p.StartsWith("StarForce Keyless")))
642645
{
643646
foundProtections = foundProtections.FindAll(p => !p.StartsWith("StarForce Keyless"));

MPF.Frontend/Tools/SubmissionGenerator.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,15 @@ internal static class SubmissionGenerator
131131
{
132132
Dictionary<string, List<string>>? protections = null;
133133
if (options.ScanForProtection)
134+
{
135+
// Explicitly note missing/invalid device paths
136+
if (drive?.Name == null)
137+
resultProgress?.Report(ResultEventArgs.Success("No mounted device path found, protection outputs may be incomplete!"));
138+
134139
protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress);
140+
}
135141

136-
var protectionString = ProtectionTool.FormatProtections(protections);
142+
var protectionString = ProtectionTool.FormatProtections(protections, drive);
137143

138144
info.CopyProtection.Protection += protectionString;
139145
info.CopyProtection.FullProtections = ReformatProtectionDictionary(protections);

MPF.Frontend/ViewModels/MainViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ public void ProcessCustomParameters()
19591959
try
19601960
{
19611961
var protections = await ProtectionTool.RunProtectionScanOnPath(CurrentDrive.Name, Options, progress);
1962-
var output = ProtectionTool.FormatProtections(protections);
1962+
var output = ProtectionTool.FormatProtections(protections, CurrentDrive);
19631963

19641964
LogLn($"Detected the following protections in {CurrentDrive.Name}:\r\n\r\n{output}");
19651965
return output;

0 commit comments

Comments
 (0)