diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs
index 4179697b..9a8ab4d6 100644
--- a/BurnOutSharp/ProtectionFind.cs
+++ b/BurnOutSharp/ProtectionFind.cs
@@ -33,6 +33,7 @@ namespace BurnOutSharp
/// Scan a path to find any known copy protection(s)
///
/// Path to scan for protection(s)
+ /// Optional progress indicator that will return a float in the range from 0 to 1
/// Dictionary of filename to protection mappings, if possible
///
/// TODO: Sector scanning?
@@ -51,10 +52,13 @@ namespace BurnOutSharp
/// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
/// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
///
- public static Dictionary Scan(string path)
+ public static Dictionary Scan(string path, IProgress progress = null)
{
var protections = new Dictionary();
+ // Checkpoint
+ progress?.Report(0);
+
// Create mappings for checking against
var mappings = CreateFilenameProtectionMapping();
@@ -97,8 +101,14 @@ namespace BurnOutSharp
protections[path] = "Zzxzz";
// Loop through all files and scan them
- foreach (string file in files)
+ for (int i = 0; i < files.Length; i++)
{
+ // Get the current file
+ string file = files[i];
+
+ // Checkpoint
+ progress?.Report(i / files.Length);
+
// If the file is in the list of known files, add that to the protections found
if (mappings.ContainsKey(Path.GetFileName(file)))
protections[file] = mappings[Path.GetFileName(file)];
@@ -120,6 +130,9 @@ namespace BurnOutSharp
protections = new Dictionary();
}
+ // Checkpoint
+ progress?.Report(1);
+
return protections;
}