55using System . Threading . Tasks ;
66using System . Windows . Forms ;
77using System . Collections . Generic ;
8+ using Windows . System ;
89
910namespace CodeRedLauncher
1011{
@@ -121,13 +122,13 @@ public static async Task<bool> IsLauncherOutdated(bool bInvalidate)
121122 private static async Task < Result > InstallModule ( bool bForceInstall )
122123 {
123124 SetStatus ( UpdatorStatus . Preparing ) ;
124- Result report = new Result ( ) ;
125+ Result result = new Result ( ) ;
125126
126127 if ( ! bForceInstall && ! m_moduleOutdated )
127128 {
128129 SetStatus ( UpdatorStatus . Idle ) ;
129- report . FailReason = "No module update required." ;
130- return report ;
130+ result . FailReason = "No module update required." ;
131+ return result ;
131132 }
132133
133134 Architecture . Path tempFolder = ( new Architecture . Path ( Path . GetTempPath ( ) ) / "CodeRedLauncher" ) ;
@@ -208,26 +209,26 @@ private static async Task<Result> InstallModule(bool bForceInstall)
208209 }
209210
210211 Logger . Write ( "(InstallModule) Done!" ) ;
211- report . Succeeded = true ;
212+ result . Succeeded = true ;
212213 m_moduleOutdated = false ;
213214 Configuration . SaveChanges ( ) ;
214215 }
215216 }
216217 else
217218 {
218- report . FailReason = "Failed to download module archive." ;
219+ result . FailReason = "Failed to download module archive." ;
219220 }
220221 }
221222 else
222223 {
223- report . FailReason = "Failed to retrieve download link." ;
224+ result . FailReason = "Failed to retrieve download link." ;
224225 }
225226
226227 Directory . Delete ( tempFolder . GetPath ( ) , true ) ;
227228 }
228229
229230 SetStatus ( UpdatorStatus . Idle ) ;
230- return report ;
231+ return result ;
231232 }
232233
233234 public static async Task < Result > ForceInstallModule ( )
@@ -238,13 +239,13 @@ public static async Task<Result> ForceInstallModule()
238239 private static async Task < Result > InstallLauncher ( bool bForceInstall )
239240 {
240241 SetStatus ( UpdatorStatus . Preparing ) ;
241- Result report = new Result ( ) ;
242+ Result result = new Result ( ) ;
242243
243244 if ( ! bForceInstall && ! m_launcherOutdated )
244245 {
245246 SetStatus ( UpdatorStatus . Idle ) ;
246- report . FailReason = "No launcher update required." ;
247- return report ;
247+ result . FailReason = "No launcher update required." ;
248+ return result ;
248249 }
249250
250251 Architecture . Path tempFolder = ( new Architecture . Path ( Path . GetTempPath ( ) ) / "CodeRedLauncher" ) ;
@@ -318,7 +319,7 @@ private static async Task<Result> InstallLauncher(bool bForceInstall)
318319 if ( dropperExe . Exists ( ) )
319320 {
320321 Logger . Write ( "(InstallLauncher) Done!" ) ;
321- report . Succeeded = true ;
322+ result . Succeeded = true ;
322323 m_launcherOutdated = false ;
323324
324325 // Since the launcher is "half portable", the user can place the exe wherever they want and move it around.
@@ -333,40 +334,40 @@ private static async Task<Result> InstallLauncher(bool bForceInstall)
333334 }
334335 else
335336 {
336- report . FailReason = "Failed to extract dropper executable from its archive." ;
337+ result . FailReason = "Failed to extract dropper executable from its archive." ;
337338 }
338339 }
339340 }
340341 else
341342 {
342- report . FailReason = "Failed to download dropper archive." ;
343+ result . FailReason = "Failed to download dropper archive." ;
343344 }
344345 }
345346 else
346347 {
347- report . FailReason = "Failed to extract launcher executable from its archive." ;
348+ result . FailReason = "Failed to extract launcher executable from its archive." ;
348349 }
349350 }
350351 else
351352 {
352- report . FailReason = "Failed to download launcher archive." ;
353+ result . FailReason = "Failed to download launcher archive." ;
353354 }
354355 }
355356 else
356357 {
357- report . FailReason = "Failed to download launcher executable." ;
358+ result . FailReason = "Failed to download launcher executable." ;
358359 }
359360 }
360361 else
361362 {
362- report . FailReason = "Failed to retrieve download links." ;
363+ result . FailReason = "Failed to retrieve download links." ;
363364 }
364365
365366 Directory . Delete ( tempFolder . GetPath ( ) , true ) ;
366367 }
367368
368369 SetStatus ( UpdatorStatus . Idle ) ;
369- return report ;
370+ return result ;
370371 }
371372
372373 public static async Task < Result > ForceInstallLauncher ( )
@@ -377,40 +378,41 @@ public static async Task<Result> ForceInstallLauncher()
377378 public static async Task < Result > InstallUpdates ( Controls . CRUpdate updateCtrl )
378379 {
379380 m_updateCtrl = updateCtrl ;
380- Result report = new Result ( ) ;
381+ Result result = new Result ( ) ;
381382
382383 if ( ! Configuration . OfflineMode . GetBoolValue ( ) )
383384 {
384385 if ( m_moduleOutdated )
385386 {
386- Result moduleReport = await InstallModule ( false ) ;
387+ Result moduleResult = await InstallModule ( false ) ;
387388
388- if ( ! moduleReport . Succeeded )
389+ if ( ! moduleResult . Succeeded )
389390 {
390- Logger . Write ( "(InstallUpdates) " + moduleReport . FailReason , LogLevel . Error ) ;
391- return moduleReport ;
391+ Logger . Write ( "(InstallUpdates) " + moduleResult . FailReason , LogLevel . Error ) ;
392+ return moduleResult ;
392393 }
393394 }
394395
395396 if ( m_launcherOutdated )
396397 {
397- Result launcherReport = await InstallLauncher ( false ) ;
398+ Result launcherResult = await InstallLauncher ( false ) ;
398399
399- if ( ! launcherReport . Succeeded )
400+ if ( ! launcherResult . Succeeded )
400401 {
401- Logger . Write ( "(InstallUpdates) " + launcherReport . FailReason , LogLevel . Error ) ;
402- return launcherReport ;
402+ Logger . Write ( "(InstallUpdates) " + launcherResult . FailReason , LogLevel . Error ) ;
403+ return launcherResult ;
403404 }
404405 }
405406
406- report . Succeeded = true ;
407+ result . Succeeded = true ;
407408 }
408409 else
409410 {
410- report . FailReason = "Could not install updates, launcher is running in offline mode!" ;
411+ result . FailReason = "Could not install updates, launcher is running in offline mode!" ;
412+ Logger . Write ( "(InstallUpdates) " + result . FailReason , LogLevel . Error ) ;
411413 }
412414
413- return report ;
415+ return result ;
414416 }
415417 }
416418}
0 commit comments