@@ -145,7 +145,7 @@ static void Main(string[] args)
145
145
JavaScriptSerializer jsonSer = new JavaScriptSerializer ( ) ;
146
146
147
147
// Start.
148
- Dictionary < string , dynamic > results = null ;
148
+ SortedList < string , dynamic > results = null ;
149
149
150
150
if ( ! API . Install ( sessionGuid , out results ) )
151
151
{
@@ -172,19 +172,16 @@ static void Main(string[] args)
172
172
if ( response . ContainsKey ( "Response" ) )
173
173
{
174
174
// Yes, get the response.
175
- results = jsonSer . Deserialize < Dictionary < string , dynamic > > ( response [ "Response" ] ) ;
175
+ results = jsonSer . Deserialize < SortedList < string , dynamic > > ( response [ "Response" ] ) ;
176
176
}
177
177
178
178
// As long as we have something.
179
179
if ( status != - 1 && results != null )
180
- {
181
- // Get the installed and failed lists.
182
- ArrayList installed = results . ContainsKey ( "Installed" ) ? results [ "Installed" ] : null ;
183
- ArrayList failed = results . ContainsKey ( "Failed" ) ? results [ "Failed" ] : null ;
184
-
185
- // Give some feedback on it, only if it's changed.
186
- string print = string . Format ( "\t {0} module archives processed, {0}/{1} succeeded." , installed . Count + failed . Count , installed . Count ) ;
180
+ {
181
+ // Build feedback.
182
+ string print = BuildUpdateString ( results ) ;
187
183
184
+ // Same as previous feedback?
188
185
if ( print != previousPrint )
189
186
{
190
187
WriteLine ( print ) ;
@@ -204,15 +201,14 @@ static void Main(string[] args)
204
201
}
205
202
else
206
203
{
207
- // Get the installed and failed lists.
208
- ArrayList installed = results . ContainsKey ( "Installed" ) ? results [ "Installed" ] : null ;
209
- ArrayList failed = results . ContainsKey ( "Failed" ) ? results [ "Failed" ] : null ;
204
+ // Build feedback.
205
+ string print = BuildUpdateString ( results ) ;
210
206
211
- // Give some feedback on it.
212
- WriteLine ( string . Format ( "\t {0} module archives processed, {0}/{1} succeeded." , installed . Count + failed . Count , installed . Count ) ) ;
213
-
207
+ // Print feedback.
208
+ WriteLine ( print ) ;
214
209
}
215
210
211
+ // Finished install.
216
212
WriteLine ( string . Format ( "Finished installation in {0} ms." , ( DateTime . Now - installStartTime ) . TotalMilliseconds ) ) ;
217
213
ReadLine ( ) ;
218
214
}
@@ -227,6 +223,35 @@ static void Main(string[] args)
227
223
}
228
224
}
229
225
226
+ private static string BuildUpdateString ( SortedList < string , dynamic > results )
227
+ {
228
+ // Get counts.
229
+ int attempted = 0 ;
230
+ int succeeded = 0 ;
231
+ int failed = 0 ;
232
+
233
+ foreach ( KeyValuePair < string , dynamic > kvp in results )
234
+ {
235
+ Dictionary < string , dynamic > module = kvp . Value ;
236
+
237
+ if ( module . ContainsKey ( "Attempted" ) && ( bool ) module [ "Attempted" ] )
238
+ {
239
+ attempted ++ ;
240
+
241
+ if ( module . ContainsKey ( "Success" ) && ( bool ) module [ "Success" ] )
242
+ {
243
+ succeeded ++ ;
244
+ }
245
+ else
246
+ {
247
+ failed ++ ;
248
+ }
249
+ }
250
+ }
251
+
252
+ return string . Format ( "\t {0}/{1} module archives processed, {2}/{0} succeeded." , attempted , results . Count , succeeded ) ;
253
+ }
254
+
230
255
private static void WriteException ( Exception ex , int maxDepth = 10 , int depth = 0 )
231
256
{
232
257
WriteLine ( ex . Message ) ;
0 commit comments