@@ -485,6 +485,11 @@ private async Task ImportActiveXAsync(ErrorDelegate errorDelegate) {
485485 try {
486486 try {
487487 await registryState . StartImportAsync ( TemplateName , binaryType ) . ConfigureAwait ( true ) ;
488+ } catch ( TaskRequiresElevationException ex ) {
489+ LogExceptionToLauncher ( ex ) ;
490+ // we're already running as admin?
491+ errorDelegate ( String . Format ( Properties . Resources . GameUnableToLaunch , Properties . Resources . AsAdministratorUser ) ) ;
492+ throw new ActiveXImportFailedException ( "The ActiveX Import failed running as Administrator User." ) ;
488493 } catch ( InvalidRegistryStateException ex ) {
489494 LogExceptionToLauncher ( ex ) ;
490495 errorDelegate ( Properties . Resources . RegistryStateUnableToCreate ) ;
@@ -497,11 +502,6 @@ private async Task ImportActiveXAsync(ErrorDelegate errorDelegate) {
497502 LogExceptionToLauncher ( ex ) ;
498503 errorDelegate ( Properties . Resources . GameNotCuratedCorrectly ) ;
499504 throw new ActiveXImportFailedException ( "The ActiveX Import failed because the Modification is invalid." ) ;
500- } catch ( TaskRequiresElevationException ex ) {
501- LogExceptionToLauncher ( ex ) ;
502- // we're already running as admin?
503- errorDelegate ( String . Format ( Properties . Resources . GameUnableToLaunch , Properties . Resources . AsAdministratorUser ) ) ;
504- throw new ActiveXImportFailedException ( "The ActiveX Import failed running as Administrator User." ) ;
505505 } catch ( InvalidOperationException ex ) {
506506 LogExceptionToLauncher ( ex ) ;
507507 errorDelegate ( Properties . Resources . RegistryStateAlreadyInProgress ) ;
@@ -869,12 +869,12 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
869869
870870 try {
871871 runAsAdministrator . Activate ( TemplateName , RunAsAdministratorModification ) ;
872- } catch ( ConfigurationErrorsException ex ) {
873- LogExceptionToLauncher ( ex ) ;
874- errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
875872 } catch ( TaskRequiresElevationException ex ) {
876873 LogExceptionToLauncher ( ex ) ;
877874 AskLaunchAsAdministratorUser ( ) ;
875+ } catch ( ConfigurationErrorsException ex ) {
876+ LogExceptionToLauncher ( ex ) ;
877+ errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
878878 }
879879
880880 ProgressManager . CurrentGoal . Steps ++ ;
@@ -883,18 +883,18 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
883883 if ( modificationsElement . EnvironmentVariables . Count > 0 ) {
884884 try {
885885 environmentVariables . Activate ( TemplateName ) ;
886- } catch ( InvalidEnvironmentVariablesException ex ) {
887- LogExceptionToLauncher ( ex ) ;
888- errorDelegate ( Properties . Resources . EnvironmentVariablesProblem ) ;
889- } catch ( ConfigurationErrorsException ex ) {
890- LogExceptionToLauncher ( ex ) ;
891- errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
892886 } catch ( TaskRequiresElevationException ex ) {
893887 LogExceptionToLauncher ( ex ) ;
894888 AskLaunchAsAdministratorUser ( ) ;
895889 } catch ( CompatibilityLayersException ex ) {
896890 LogExceptionToLauncher ( ex ) ;
897891 AskLaunchWithCompatibilitySettings ( ) ;
892+ } catch ( InvalidEnvironmentVariablesException ex ) {
893+ LogExceptionToLauncher ( ex ) ;
894+ errorDelegate ( Properties . Resources . EnvironmentVariablesProblem ) ;
895+ } catch ( ConfigurationErrorsException ex ) {
896+ LogExceptionToLauncher ( ex ) ;
897+ errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
898898 }
899899 }
900900 }
@@ -960,18 +960,15 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
960960 if ( modificationsElement . RegistryStates . Count > 0 ) {
961961 try {
962962 registryState . Activate ( TemplateName ) ;
963+ } catch ( TaskRequiresElevationException ex ) {
964+ LogExceptionToLauncher ( ex ) ;
965+ AskLaunchAsAdministratorUser ( ) ;
963966 } catch ( InvalidRegistryStateException ex ) {
964967 LogExceptionToLauncher ( ex ) ;
965968 errorDelegate ( Properties . Resources . RegistryStateUnableToCreate ) ;
966969 } catch ( ConfigurationErrorsException ex ) {
967970 LogExceptionToLauncher ( ex ) ;
968971 errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
969- } catch ( TaskRequiresElevationException ex ) {
970- LogExceptionToLauncher ( ex ) ;
971- AskLaunchAsAdministratorUser ( ) ;
972- } catch ( ArgumentException ex ) {
973- LogExceptionToLauncher ( ex ) ;
974- errorDelegate ( Properties . Resources . GameIsMissingFile ) ;
975972 } catch ( InvalidOperationException ex ) {
976973 LogExceptionToLauncher ( ex ) ;
977974 errorDelegate ( Properties . Resources . ModificationsUnableToLoadImport ) ;
@@ -1004,15 +1001,15 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
10041001 if ( modificationsElement . OldCPUSimulator . ElementInformation . IsPresent ) {
10051002 try {
10061003 oldCPUSimulator . Activate ( TemplateName , ref softwareProcessStartInfo , out softwareIsOldCPUSimulator ) ;
1004+ } catch ( TaskRequiresElevationException ex ) {
1005+ LogExceptionToLauncher ( ex ) ;
1006+ AskLaunchAsAdministratorUser ( ) ;
10071007 } catch ( InvalidOldCPUSimulatorException ex ) {
10081008 LogExceptionToLauncher ( ex ) ;
10091009 errorDelegate ( Properties . Resources . OldCPUSimulatorProblem ) ;
10101010 } catch ( ConfigurationErrorsException ex ) {
10111011 LogExceptionToLauncher ( ex ) ;
10121012 errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
1013- } catch ( TaskRequiresElevationException ex ) {
1014- LogExceptionToLauncher ( ex ) ;
1015- AskLaunchAsAdministratorUser ( ) ;
10161013 }
10171014 }
10181015 }
@@ -1070,18 +1067,15 @@ private void DeactivateModifications(ErrorDelegate errorDelegate) {
10701067 // this one really needs to work
10711068 // we can't continue if it does not
10721069 registryState . Deactivate ( ModificationsRevertMethod ) ;
1070+ } catch ( TaskRequiresElevationException ex ) {
1071+ LogExceptionToLauncher ( ex ) ;
1072+ AskLaunchAsAdministratorUser ( ) ;
10731073 } catch ( InvalidRegistryStateException ex ) {
10741074 LogExceptionToLauncher ( ex ) ;
10751075 errorDelegate ( Properties . Resources . RegistryStateUnableToCreate ) ;
10761076 } catch ( ConfigurationErrorsException ex ) {
10771077 LogExceptionToLauncher ( ex ) ;
10781078 errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
1079- } catch ( TaskRequiresElevationException ex ) {
1080- LogExceptionToLauncher ( ex ) ;
1081- AskLaunchAsAdministratorUser ( ) ;
1082- } catch ( ArgumentException ex ) {
1083- LogExceptionToLauncher ( ex ) ;
1084- errorDelegate ( Properties . Resources . GameIsMissingFile ) ;
10851079 } catch ( InvalidOperationException ex ) {
10861080 LogExceptionToLauncher ( ex ) ;
10871081 errorDelegate ( Properties . Resources . ModificationsUnableToLoadImport ) ;
@@ -1094,18 +1088,18 @@ private void DeactivateModifications(ErrorDelegate errorDelegate) {
10941088
10951089 try {
10961090 environmentVariables . Deactivate ( ModificationsRevertMethod ) ;
1097- } catch ( InvalidEnvironmentVariablesException ex ) {
1098- LogExceptionToLauncher ( ex ) ;
1099- errorDelegate ( Properties . Resources . EnvironmentVariablesProblem ) ;
1100- } catch ( ConfigurationErrorsException ex ) {
1101- LogExceptionToLauncher ( ex ) ;
1102- errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
11031091 } catch ( TaskRequiresElevationException ex ) {
11041092 LogExceptionToLauncher ( ex ) ;
11051093 AskLaunchAsAdministratorUser ( ) ;
11061094 } catch ( CompatibilityLayersException ex ) {
11071095 LogExceptionToLauncher ( ex ) ;
11081096 AskLaunchWithCompatibilitySettings ( ) ;
1097+ } catch ( InvalidEnvironmentVariablesException ex ) {
1098+ LogExceptionToLauncher ( ex ) ;
1099+ errorDelegate ( Properties . Resources . EnvironmentVariablesProblem ) ;
1100+ } catch ( ConfigurationErrorsException ex ) {
1101+ LogExceptionToLauncher ( ex ) ;
1102+ errorDelegate ( Properties . Resources . ConfigurationUnableToLoad ) ;
11091103 } catch ( TimeoutException ex ) {
11101104 LogExceptionToLauncher ( ex ) ;
11111105 errorDelegate ( Properties . Resources . EnvironmentVariablesTimeout ) ;
0 commit comments