diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 10:18:08 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-07-02 12:50:09 -0500 |
| commit | f43d176f95601ff7524e06247166d4f3b6e61c05 (patch) | |
| tree | 2e3580ca60c85e1d07a0ab4a2b1279d25fd41f6c /src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs | |
| parent | 9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2 (diff) | |
| download | wix-f43d176f95601ff7524e06247166d4f3b6e61c05.tar.gz wix-f43d176f95601ff7524e06247166d4f3b6e61c05.tar.bz2 wix-f43d176f95601ff7524e06247166d4f3b6e61c05.zip | |
Make the BA responsible for parsing restart prompt behavior.
Fixes #4975
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs index 345e0448..88a9b9bb 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs | |||
| @@ -17,7 +17,6 @@ namespace WixToolset.Mba.Core | |||
| 17 | /// </summary> | 17 | /// </summary> |
| 18 | /// <param name="action"></param> | 18 | /// <param name="action"></param> |
| 19 | /// <param name="display"></param> | 19 | /// <param name="display"></param> |
| 20 | /// <param name="restart"></param> | ||
| 21 | /// <param name="commandLine"></param> | 20 | /// <param name="commandLine"></param> |
| 22 | /// <param name="cmdShow"></param> | 21 | /// <param name="cmdShow"></param> |
| 23 | /// <param name="resume"></param> | 22 | /// <param name="resume"></param> |
| @@ -30,7 +29,6 @@ namespace WixToolset.Mba.Core | |||
| 30 | public BootstrapperCommand( | 29 | public BootstrapperCommand( |
| 31 | LaunchAction action, | 30 | LaunchAction action, |
| 32 | Display display, | 31 | Display display, |
| 33 | Restart restart, | ||
| 34 | string commandLine, | 32 | string commandLine, |
| 35 | int cmdShow, | 33 | int cmdShow, |
| 36 | ResumeType resume, | 34 | ResumeType resume, |
| @@ -43,7 +41,6 @@ namespace WixToolset.Mba.Core | |||
| 43 | { | 41 | { |
| 44 | this.Action = action; | 42 | this.Action = action; |
| 45 | this.Display = display; | 43 | this.Display = display; |
| 46 | this.Restart = restart; | ||
| 47 | this.CommandLine = commandLine; | 44 | this.CommandLine = commandLine; |
| 48 | this.CmdShow = cmdShow; | 45 | this.CmdShow = cmdShow; |
| 49 | this.Resume = resume; | 46 | this.Resume = resume; |
| @@ -62,9 +59,6 @@ namespace WixToolset.Mba.Core | |||
| 62 | public Display Display { get; } | 59 | public Display Display { get; } |
| 63 | 60 | ||
| 64 | /// <inheritdoc/> | 61 | /// <inheritdoc/> |
| 65 | public Restart Restart { get; } | ||
| 66 | |||
| 67 | /// <inheritdoc/> | ||
| 68 | public string CommandLine { get; } | 62 | public string CommandLine { get; } |
| 69 | 63 | ||
| 70 | /// <inheritdoc/> | 64 | /// <inheritdoc/> |
| @@ -97,6 +91,7 @@ namespace WixToolset.Mba.Core | |||
| 97 | var args = ParseCommandLineToArgs(this.CommandLine); | 91 | var args = ParseCommandLineToArgs(this.CommandLine); |
| 98 | var unknownArgs = new List<string>(); | 92 | var unknownArgs = new List<string>(); |
| 99 | var variables = new List<KeyValuePair<string, string>>(); | 93 | var variables = new List<KeyValuePair<string, string>>(); |
| 94 | var restart = Restart.Unknown; | ||
| 100 | 95 | ||
| 101 | foreach (var arg in args) | 96 | foreach (var arg in args) |
| 102 | { | 97 | { |
| @@ -104,7 +99,25 @@ namespace WixToolset.Mba.Core | |||
| 104 | 99 | ||
| 105 | if (arg[0] == '-' || arg[0] == '/') | 100 | if (arg[0] == '-' || arg[0] == '/') |
| 106 | { | 101 | { |
| 107 | unknownArg = true; | 102 | var parameter = arg.Substring(1).ToLowerInvariant(); |
| 103 | switch (parameter) | ||
| 104 | { | ||
| 105 | case "norestart": | ||
| 106 | if (restart == Restart.Unknown) | ||
| 107 | { | ||
| 108 | restart = Restart.Never; | ||
| 109 | } | ||
| 110 | break; | ||
| 111 | case "forcerestart": | ||
| 112 | if (restart == Restart.Unknown) | ||
| 113 | { | ||
| 114 | restart = Restart.Always; | ||
| 115 | } | ||
| 116 | break; | ||
| 117 | default: | ||
| 118 | unknownArg = true; | ||
| 119 | break; | ||
| 120 | } | ||
| 108 | } | 121 | } |
| 109 | else | 122 | else |
| 110 | { | 123 | { |
| @@ -127,8 +140,14 @@ namespace WixToolset.Mba.Core | |||
| 127 | } | 140 | } |
| 128 | } | 141 | } |
| 129 | 142 | ||
| 143 | if (restart == Restart.Unknown) | ||
| 144 | { | ||
| 145 | restart = this.Display < Display.Full ? Restart.Automatic : Restart.Prompt; | ||
| 146 | } | ||
| 147 | |||
| 130 | return new MbaCommand | 148 | return new MbaCommand |
| 131 | { | 149 | { |
| 150 | Restart = restart, | ||
| 132 | UnknownCommandLineArgs = unknownArgs.ToArray(), | 151 | UnknownCommandLineArgs = unknownArgs.ToArray(), |
| 133 | Variables = variables.ToArray(), | 152 | Variables = variables.ToArray(), |
| 134 | }; | 153 | }; |
