diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2019-12-11 19:34:47 +1100 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2019-12-11 20:10:40 +1000 |
| commit | 62352fabd541aaa9d0a2c957c4bdd4b9c682df9c (patch) | |
| tree | 941513045cb644553af582fc0722c853793a90dd /src/WixToolset.Mba.Core/IEngine.cs | |
| parent | ca118d0123624e4e1523eeb7a54eb56364d5876e (diff) | |
| download | wix-62352fabd541aaa9d0a2c957c4bdd4b9c682df9c.tar.gz wix-62352fabd541aaa9d0a2c957c4bdd4b9c682df9c.tar.bz2 wix-62352fabd541aaa9d0a2c957c4bdd4b9c682df9c.zip | |
Import files from BootstrapperCore repo.
Diffstat (limited to 'src/WixToolset.Mba.Core/IEngine.cs')
| -rw-r--r-- | src/WixToolset.Mba.Core/IEngine.cs | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/src/WixToolset.Mba.Core/IEngine.cs b/src/WixToolset.Mba.Core/IEngine.cs new file mode 100644 index 00000000..46b8158a --- /dev/null +++ b/src/WixToolset.Mba.Core/IEngine.cs | |||
| @@ -0,0 +1,176 @@ | |||
| 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 | |||
| 3 | namespace WixToolset.BootstrapperCore | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.ComponentModel; | ||
| 7 | using System.Security; | ||
| 8 | |||
| 9 | public interface IEngine | ||
| 10 | { | ||
| 11 | /// <summary> | ||
| 12 | /// Gets or sets numeric variables for the engine. | ||
| 13 | /// </summary> | ||
| 14 | IVariables<long> NumericVariables { get; } | ||
| 15 | |||
| 16 | /// <summary> | ||
| 17 | /// Gets the number of packages in the bundle. | ||
| 18 | /// </summary> | ||
| 19 | int PackageCount { get; } | ||
| 20 | |||
| 21 | /// <summary> | ||
| 22 | /// Gets or sets string variables for the engine using SecureStrings. | ||
| 23 | /// </summary> | ||
| 24 | IVariables<SecureString> SecureStringVariables { get; } | ||
| 25 | |||
| 26 | /// <summary> | ||
| 27 | /// Gets or sets string variables for the engine. | ||
| 28 | /// </summary> | ||
| 29 | IVariables<string> StringVariables { get; } | ||
| 30 | |||
| 31 | /// <summary> | ||
| 32 | /// Gets or sets <see cref="Version"/> variables for the engine. | ||
| 33 | /// | ||
| 34 | /// The <see cref="Version"/> class can keep track of when the build and revision fields are undefined, but the engine can't. | ||
| 35 | /// Therefore, the build and revision fields must be defined when setting a <see cref="Version"/> variable. | ||
| 36 | /// Use the NormalizeVersion method to make sure the engine can accept the Version. | ||
| 37 | /// | ||
| 38 | /// To keep track of versions without build or revision fields, use StringVariables instead. | ||
| 39 | /// </summary> | ||
| 40 | /// <exception cref="OverflowException">The given <see cref="Version"/> was invalid.</exception> | ||
| 41 | IVariables<Version> VersionVariables { get; } | ||
| 42 | |||
| 43 | /// <summary> | ||
| 44 | /// Install the packages. | ||
| 45 | /// </summary> | ||
| 46 | /// <param name="hwndParent">The parent window for the installation user interface.</param> | ||
| 47 | void Apply(IntPtr hwndParent); | ||
| 48 | |||
| 49 | /// <summary> | ||
| 50 | /// Close the splash screen if it is still open. Does nothing if the splash screen is not or | ||
| 51 | /// never was opened. | ||
| 52 | /// </summary> | ||
| 53 | void CloseSplashScreen(); | ||
| 54 | |||
| 55 | /// <summary> | ||
| 56 | /// Determine if all installation conditions are fulfilled. | ||
| 57 | /// </summary> | ||
| 58 | void Detect(); | ||
| 59 | |||
| 60 | /// <summary> | ||
| 61 | /// Determine if all installation conditions are fulfilled. | ||
| 62 | /// </summary> | ||
| 63 | /// <param name="hwndParent">The parent window for the installation user interface.</param> | ||
| 64 | void Detect(IntPtr hwndParent); | ||
| 65 | |||
| 66 | /// <summary> | ||
| 67 | /// Elevate the install. | ||
| 68 | /// </summary> | ||
| 69 | /// <param name="hwndParent">The parent window of the elevation dialog.</param> | ||
| 70 | /// <returns>true if elevation succeeded; otherwise, false if the user cancelled.</returns> | ||
| 71 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
| 72 | bool Elevate(IntPtr hwndParent); | ||
| 73 | |||
| 74 | /// <summary> | ||
| 75 | /// Escapes the input string. | ||
| 76 | /// </summary> | ||
| 77 | /// <param name="input">The string to escape.</param> | ||
| 78 | /// <returns>The escaped string.</returns> | ||
| 79 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
| 80 | string EscapeString(string input); | ||
| 81 | |||
| 82 | /// <summary> | ||
| 83 | /// Evaluates the <paramref name="condition"/> string. | ||
| 84 | /// </summary> | ||
| 85 | /// <param name="condition">The string representing the condition to evaluate.</param> | ||
| 86 | /// <returns>Whether the condition evaluated to true or false.</returns> | ||
| 87 | bool EvaluateCondition(string condition); | ||
| 88 | |||
| 89 | /// <summary> | ||
| 90 | /// Formats the input string. | ||
| 91 | /// </summary> | ||
| 92 | /// <param name="format">The string to format.</param> | ||
| 93 | /// <returns>The formatted string.</returns> | ||
| 94 | /// <exception cref="Win32Exception">A Win32 error occurred.</exception> | ||
| 95 | string FormatString(string format); | ||
| 96 | |||
| 97 | /// <summary> | ||
| 98 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. | ||
| 99 | /// </summary> | ||
| 100 | /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param> | ||
| 101 | /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param> | ||
| 102 | /// <param name="arguments">Optional arguments.</param> | ||
| 103 | void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments); | ||
| 104 | |||
| 105 | /// <summary> | ||
| 106 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. | ||
| 107 | /// </summary> | ||
| 108 | /// <param name="hwndParent">The parent window of the elevation dialog (if the engine hasn't elevated yet).</param> | ||
| 109 | /// <param name="approvedExeForElevationId">Id of the ApprovedExeForElevation element specified when the bundle was authored.</param> | ||
| 110 | /// <param name="arguments">Optional arguments.</param> | ||
| 111 | /// <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> | ||
| 112 | void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout); | ||
| 113 | |||
| 114 | /// <summary> | ||
| 115 | /// Logs the <paramref name="message"/>. | ||
| 116 | /// </summary> | ||
| 117 | /// <param name="level">The logging level.</param> | ||
| 118 | /// <param name="message">The message to log.</param> | ||
| 119 | void Log(LogLevel level, string message); | ||
| 120 | |||
| 121 | /// <summary> | ||
| 122 | /// Determine the installation sequencing and costing. | ||
| 123 | /// </summary> | ||
| 124 | /// <param name="action">The action to perform when planning.</param> | ||
| 125 | void Plan(LaunchAction action); | ||
| 126 | |||
| 127 | /// <summary> | ||
| 128 | /// Set the update information for a bundle. | ||
| 129 | /// </summary> | ||
| 130 | /// <param name="localSource">Optional local source path for the update. Default is "update\[OriginalNameOfBundle].exe".</param> | ||
| 131 | /// <param name="downloadSource">Optional download source for the update.</param> | ||
| 132 | /// <param name="size">Size of the expected update.</param> | ||
| 133 | /// <param name="hashType">Type of the hash expected on the update.</param> | ||
| 134 | /// <param name="hash">Optional hash expected for the update.</param> | ||
| 135 | void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, byte[] hash); | ||
| 136 | |||
| 137 | /// <summary> | ||
| 138 | /// Set the local source for a package or container. | ||
| 139 | /// </summary> | ||
| 140 | /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param> | ||
| 141 | /// <param name="payloadId">The id that uniquely identifies the payload.</param> | ||
| 142 | /// <param name="path">The new source path.</param> | ||
| 143 | void SetLocalSource(string packageOrContainerId, string payloadId, string path); | ||
| 144 | |||
| 145 | /// <summary> | ||
| 146 | /// Set the new download URL for a package or container. | ||
| 147 | /// </summary> | ||
| 148 | /// <param name="packageOrContainerId">The id that uniquely identifies the package or container.</param> | ||
| 149 | /// <param name="payloadId">The id that uniquely identifies the payload.</param> | ||
| 150 | /// <param name="url">The new url.</param> | ||
| 151 | /// <param name="user">The user name for proxy authentication.</param> | ||
| 152 | /// <param name="password">The password for proxy authentication.</param> | ||
| 153 | void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password); | ||
| 154 | |||
| 155 | /// <summary> | ||
| 156 | /// Sends error message when embedded. | ||
| 157 | /// </summary> | ||
| 158 | /// <param name="errorCode">Error code.</param> | ||
| 159 | /// <param name="message">Error message.</param> | ||
| 160 | /// <param name="uiHint">UI buttons to show on error dialog.</param> | ||
| 161 | int SendEmbeddedError(int errorCode, string message, int uiHint); | ||
| 162 | |||
| 163 | /// <summary> | ||
| 164 | /// Sends progress percentages when embedded. | ||
| 165 | /// </summary> | ||
| 166 | /// <param name="progressPercentage">Percentage completed thus far.</param> | ||
| 167 | /// <param name="overallPercentage">Overall percentage completed.</param> | ||
| 168 | int SendEmbeddedProgress(int progressPercentage, int overallPercentage); | ||
| 169 | |||
| 170 | /// <summary> | ||
| 171 | /// Shuts down the engine. | ||
| 172 | /// </summary> | ||
| 173 | /// <param name="exitCode">Exit code indicating reason for shut down.</param> | ||
| 174 | void Quit(int exitCode); | ||
| 175 | } | ||
| 176 | } | ||
