@@ -52,12 +52,12 @@ public static class ProtectionFind
52
52
/// - The Bongle (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
53
53
/// - The Copy-Protected CD (http://web.archive.org/web/19990508193708/www.hideseek.com/products.htm)
54
54
/// </remarks>
55
- public static Dictionary < string , string > Scan ( string path , IProgress < float > progress = null )
55
+ public static Dictionary < string , string > Scan ( string path , IProgress < Progress > progress = null )
56
56
{
57
57
var protections = new Dictionary < string , string > ( ) ;
58
58
59
59
// Checkpoint
60
- progress ? . Report ( 0 ) ;
60
+ progress ? . Report ( new Progress ( null , 0 , null ) ) ;
61
61
62
62
// Create mappings for checking against
63
63
var mappings = CreateFilenameProtectionMapping ( ) ;
@@ -77,6 +77,9 @@ public static Dictionary<string, string> Scan(string path, IProgress<float> prog
77
77
string protectionname = ScanInFile ( path ) ? . Replace ( "" + ( char ) 0x00 , "" ) ;
78
78
if ( ! String . IsNullOrEmpty ( protectionname ) )
79
79
protections [ path ] = protectionname ;
80
+
81
+ // Checkpoint
82
+ progress ? . Report ( new Progress ( path , 1 , protectionname ) ) ;
80
83
}
81
84
// If we have a directory
82
85
else if ( Directory . Exists ( path ) )
@@ -106,9 +109,6 @@ public static Dictionary<string, string> Scan(string path, IProgress<float> prog
106
109
// Get the current file
107
110
string file = files [ i ] ;
108
111
109
- // Checkpoint
110
- progress ? . Report ( i / files . Length ) ;
111
-
112
112
// If the file is in the list of known files, add that to the protections found
113
113
if ( mappings . ContainsKey ( Path . GetFileName ( file ) ) )
114
114
protections [ file ] = mappings [ Path . GetFileName ( file ) ] ;
@@ -121,6 +121,9 @@ public static Dictionary<string, string> Scan(string path, IProgress<float> prog
121
121
string protectionname = ScanInFile ( file ) ? . Replace ( "" + ( char ) 0x00 , "" ) ;
122
122
if ( ! String . IsNullOrEmpty ( protectionname ) )
123
123
protections [ file ] = protectionname ;
124
+
125
+ // Checkpoint
126
+ progress ? . Report ( new Progress ( file , i / files . Length , protectionname ) ) ;
124
127
}
125
128
}
126
129
@@ -130,9 +133,6 @@ public static Dictionary<string, string> Scan(string path, IProgress<float> prog
130
133
protections = new Dictionary < string , string > ( ) ;
131
134
}
132
135
133
- // Checkpoint
134
- progress ? . Report ( 1 ) ;
135
-
136
136
return protections ;
137
137
}
138
138
0 commit comments