aboutsummaryrefslogtreecommitdiff
path: root/src/api/burn/WixToolset.Mba.Core/IEngine.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-22 05:46:03 -0700
committerRob Mensching <rob@firegiant.com>2021-04-29 16:41:44 -0700
commitc00516901e6b67e398396b14fe7682d0376f8643 (patch)
treeb0d62089a1c5700c7f2c3e3790750bf2d8ea33c0 /src/api/burn/WixToolset.Mba.Core/IEngine.cs
parent8eb98efd2175d9ece2e4639d43081667af9a4990 (diff)
downloadwix-c00516901e6b67e398396b14fe7682d0376f8643.tar.gz
wix-c00516901e6b67e398396b14fe7682d0376f8643.tar.bz2
wix-c00516901e6b67e398396b14fe7682d0376f8643.zip
Move balutil into API/burn
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/IEngine.cs')
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IEngine.cs222
1 files changed, 222 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/IEngine.cs b/src/api/burn/WixToolset.Mba.Core/IEngine.cs
new file mode 100644
index 00000000..3e636961
--- /dev/null
+++ b/src/api/burn/WixToolset.Mba.Core/IEngine.cs
@@ -0,0 +1,222 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset.Mba.Core
4{
5 using System;
6 using System.ComponentModel;
7 using System.Security;
8
9 /// <summary>
10 /// High level abstraction over the <see cref="IBootstrapperEngine"/> interface.
11 /// </summary>
12 public interface IEngine
13 {
14 /// <summary>
15 /// Gets the number of packages in the bundle.
16 /// </summary>
17 int PackageCount { get; }
18
19 /// <summary>
20 /// Install the packages.
21 /// </summary>
22 /// <param name="hwndParent">The parent window for the installation user interface.</param>
23 void Apply(IntPtr hwndParent);
24
25 /// <summary>
26 /// Close the splash screen if it is still open. Does nothing if the splash screen is not or
27 /// never was opened.
28 /// </summary>
29 void CloseSplashScreen();
30
31 /// <returns>0 if equal, 1 if version1 &gt; version2, -1 if version1 &lt; version2</returns>
32 int CompareVersions(string version1, string version2);
33
34 /// <summary>
35 /// Checks if a variable exists in the engine.
36 /// </summary>
37 /// <param name="name">The name of the variable.</param>
38 /// <returns>Whether the variable exists.</returns>
39 bool ContainsVariable(string name);
40
41 /// <summary>
42 /// Determine if all installation conditions are fulfilled.
43 /// </summary>
44 void Detect();
45
46 /// <summary>
47 /// Determine if all installation conditions are fulfilled.
48 /// </summary>
49 /// <param name="hwndParent">The parent window for the installation user interface.</param>
50 void Detect(IntPtr hwndParent);
51
52 /// <summary>
53 /// Elevate the install.
54 /// </summary>
55 /// <param name="hwndParent">The parent window of the elevation dialog.</param>
56 /// <returns>true if elevation succeeded; otherwise, false if the user cancelled.</returns>
57 /// <exception cref="Win32Exception">A Win32 error occurred.</exception>
58 bool Elevate(IntPtr hwndParent);
59
60 /// <summary>
61 /// Escapes the input string.
62 /// </summary>
63 /// <param name="input">The string to escape.</param>
64 /// <returns>The escaped string.</returns>
65 /// <exception cref="Win32Exception">A Win32 error occurred.</exception>
66 string EscapeString(string input);
67
68 /// <summary>
69 /// Evaluates the <paramref name="condition"/> string.
70 /// </summary>
71 /// <param name="condition">The string representing the condition to evaluate.</param>
72 /// <returns>Whether the condition evaluated to true or false.</returns>
73 bool EvaluateCondition(string condition);
74
75 /// <summary>
76 /// Formats the input string.
77 /// </summary>
78 /// <param name="format">The string to format.</param>
79 /// <returns>The formatted string.</returns>
80 /// <exception cref="Win32Exception">A Win32 error occurred.</exception>
81 string FormatString(string format);
82
83 /// <summary>
84 /// Gets numeric variables for the engine.
85 /// </summary>
86 /// <param name="name">The name of the variable.</param>
87 long GetVariableNumeric(string name);
88
89 /// <summary>
90 /// Gets string variables for the engine using SecureStrings.
91 /// </summary>
92 /// <param name="name">The name of the variable.</param>
93 SecureString GetVariableSecureString(string name);
94
95 /// <summary>
96 /// Gets string variables for the engine.
97 /// </summary>
98 /// <param name="name">The name of the variable.</param>
99 string GetVariableString(string name);
100
101 /// <summary>
102 /// Gets <see cref="Version"/> variables for the engine.
103 /// </summary>
104 /// <param name="name">The name of the variable.</param>
105 string GetVariableVersion(string name);
106
107 /// <summary>
108 /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt.
109 /// </summary>
110 /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param>
111 /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param>
112 /// <param name="arguments">Optional arguments.</param>
113 void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments);
114
115 /// <summary>
116 /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt.
117 /// </summary>
118 /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param>
119 /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param>
120 /// <param name="arguments">Optional arguments.</param>
121 /// <param name="waitForInputIdleTimeout">Timeout in milliseconds. When set to something other than zero, the engine will call WaitForInputIdle for the new process with this timeout before calling OnLaunchApprovedExeComplete.</param>
122 void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout);
123
124 /// <summary>
125 /// Logs the <paramref name="message"/>.
126 /// </summary>
127 /// <param name="level">The logging level.</param>
128 /// <param name="message">The message to log.</param>
129 void Log(LogLevel level, string message);
130
131 /// <summary>
132 /// Determine the installation sequencing and costing.
133 /// </summary>
134 /// <param name="action">The action to perform when planning.</param>
135 void Plan(LaunchAction action);
136
137 /// <summary>
138 /// Set the update information for a bundle.
139 /// </summary>
140 /// <param name="localSource">Optional local source path for the update. Default is "update\[OriginalNameOfBundle].exe".</param>
141 /// <param name="downloadSource">Optional download source for the update.</param>
142 /// <param name="size">Size of the expected update.</param>
143 /// <param name="hashType">Type of the hash expected on the update.</param>
144 /// <param name="hash">Optional hash expected for the update.</param>
145 void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, byte[] hash);
146
147 /// <summary>
148 /// Sets the URL to the update feed.
149 /// </summary>
150 /// <param name="url">URL of the update feed.</param>
151 void SetUpdateSource(string url);
152
153 /// <summary>
154 /// Set the local source for a package or container.
155 /// </summary>
156 /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param>
157 /// <param name="payloadId">The id that uniquely identifies the payload.</param>
158 /// <param name="path">The new source path.</param>
159 void SetLocalSource(string packageOrContainerId, string payloadId, string path);
160
161 /// <summary>
162 /// Set the new download URL for a package or container.
163 /// </summary>
164 /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param>
165 /// <param name="payloadId">The id that uniquely identifies the payload.</param>
166 /// <param name="url">The new url.</param>
167 /// <param name="user">The user name for proxy authentication.</param>
168 /// <param name="password">The password for proxy authentication.</param>
169 void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password);
170
171 /// <summary>
172 /// Sets numeric variables for the engine.
173 /// </summary>
174 /// <param name="name">The name of the variable.</param>
175 /// <param name="value">The value to set.</param>
176 void SetVariableNumeric(string name, long value);
177
178 /// <summary>
179 /// Sets string variables for the engine using SecureStrings.
180 /// </summary>
181 /// <param name="name">The name of the variable.</param>
182 /// <param name="value">The value to set.</param>
183 /// <param name="formatted">False if the value is a literal string.</param>
184 void SetVariableString(string name, SecureString value, bool formatted);
185
186 /// <summary>
187 /// Sets string variables for the engine.
188 /// </summary>
189 /// <param name="name">The name of the variable.</param>
190 /// <param name="value">The value to set.</param>
191 /// <param name="formatted">False if the value is a literal string.</param>
192 void SetVariableString(string name, string value, bool formatted);
193
194 /// <summary>
195 /// Sets version variables for the engine.
196 /// </summary>
197 /// <param name="name">The name of the variable.</param>
198 /// <param name="value">The value to set.</param>
199 void SetVariableVersion(string name, string value);
200
201 /// <summary>
202 /// Sends error message when embedded.
203 /// </summary>
204 /// <param name="errorCode">Error code.</param>
205 /// <param name="message">Error message.</param>
206 /// <param name="uiHint">UI buttons to show on error dialog.</param>
207 int SendEmbeddedError(int errorCode, string message, int uiHint);
208
209 /// <summary>
210 /// Sends progress percentages when embedded.
211 /// </summary>
212 /// <param name="progressPercentage">Percentage completed thus far.</param>
213 /// <param name="overallPercentage">Overall percentage completed.</param>
214 int SendEmbeddedProgress(int progressPercentage, int overallPercentage);
215
216 /// <summary>
217 /// Shuts down the engine.
218 /// </summary>
219 /// <param name="exitCode">Exit code indicating reason for shut down.</param>
220 void Quit(int exitCode);
221 }
222}