diff options
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core')
5 files changed, 33 insertions, 14 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 | }; |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs index 0f9193d0..64e25ff4 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs | |||
| @@ -35,7 +35,6 @@ namespace WixToolset.Mba.Core | |||
| 35 | [MarshalAs(UnmanagedType.I4)] internal int cbSize; | 35 | [MarshalAs(UnmanagedType.I4)] internal int cbSize; |
| 36 | [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; | 36 | [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; |
| 37 | [MarshalAs(UnmanagedType.U4)] private readonly Display display; | 37 | [MarshalAs(UnmanagedType.U4)] private readonly Display display; |
| 38 | [MarshalAs(UnmanagedType.U4)] private readonly Restart restart; | ||
| 39 | private readonly IntPtr wzCommandLine; | 38 | private readonly IntPtr wzCommandLine; |
| 40 | [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; | 39 | [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; |
| 41 | [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; | 40 | [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; |
| @@ -51,7 +50,6 @@ namespace WixToolset.Mba.Core | |||
| 51 | return new BootstrapperCommand( | 50 | return new BootstrapperCommand( |
| 52 | this.action, | 51 | this.action, |
| 53 | this.display, | 52 | this.display, |
| 54 | this.restart, | ||
| 55 | Marshal.PtrToStringUni(this.wzCommandLine), | 53 | Marshal.PtrToStringUni(this.wzCommandLine), |
| 56 | this.nCmdShow, | 54 | this.nCmdShow, |
| 57 | this.resume, | 55 | this.resume, |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs index b7baa55c..f583e619 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperCommand.cs | |||
| @@ -20,11 +20,6 @@ namespace WixToolset.Mba.Core | |||
| 20 | Display Display { get; } | 20 | Display Display { get; } |
| 21 | 21 | ||
| 22 | /// <summary> | 22 | /// <summary> |
| 23 | /// Gets the action to perform if a reboot is required. | ||
| 24 | /// </summary> | ||
| 25 | Restart Restart { get; } | ||
| 26 | |||
| 27 | /// <summary> | ||
| 28 | /// Gets the command line arguments. | 23 | /// Gets the command line arguments. |
| 29 | /// </summary> | 24 | /// </summary> |
| 30 | /// <returns> | 25 | /// <returns> |
diff --git a/src/api/burn/WixToolset.Mba.Core/IMbaCommand.cs b/src/api/burn/WixToolset.Mba.Core/IMbaCommand.cs index a3ad68d8..495b2f44 100644 --- a/src/api/burn/WixToolset.Mba.Core/IMbaCommand.cs +++ b/src/api/burn/WixToolset.Mba.Core/IMbaCommand.cs | |||
| @@ -10,6 +10,11 @@ namespace WixToolset.Mba.Core | |||
| 10 | public interface IMbaCommand | 10 | public interface IMbaCommand |
| 11 | { | 11 | { |
| 12 | /// <summary> | 12 | /// <summary> |
| 13 | /// Gets the action to perform if a reboot is required. | ||
| 14 | /// </summary> | ||
| 15 | Restart Restart { get; } | ||
| 16 | |||
| 17 | /// <summary> | ||
| 13 | /// The command line arguments not parsed into <see cref="IBootstrapperCommand"/> or <see cref="IMbaCommand"/>. | 18 | /// The command line arguments not parsed into <see cref="IBootstrapperCommand"/> or <see cref="IMbaCommand"/>. |
| 14 | /// </summary> | 19 | /// </summary> |
| 15 | string[] UnknownCommandLineArgs { get; } | 20 | string[] UnknownCommandLineArgs { get; } |
diff --git a/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs b/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs index 424cde63..8917a334 100644 --- a/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs +++ b/src/api/burn/WixToolset.Mba.Core/MbaCommand.cs | |||
| @@ -9,6 +9,8 @@ namespace WixToolset.Mba.Core | |||
| 9 | /// </summary> | 9 | /// </summary> |
| 10 | internal sealed class MbaCommand : IMbaCommand | 10 | internal sealed class MbaCommand : IMbaCommand |
| 11 | { | 11 | { |
| 12 | public Restart Restart { get; internal set; } | ||
| 13 | |||
| 12 | public string[] UnknownCommandLineArgs { get; internal set; } | 14 | public string[] UnknownCommandLineArgs { get; internal set; } |
| 13 | 15 | ||
| 14 | public KeyValuePair<string, string>[] Variables { get; internal set; } | 16 | public KeyValuePair<string, string>[] Variables { get; internal set; } |
