// 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. namespace WixToolset.Mba.Core { using System; using System.ComponentModel; using System.Security; /// /// High level abstraction over the interface. /// public interface IEngine { /// /// Gets the number of packages in the bundle. /// int PackageCount { get; } /// /// Install the packages. /// /// The parent window for the installation user interface. void Apply(IntPtr hwndParent); /// /// Close the splash screen if it is still open. Does nothing if the splash screen is not or /// never was opened. /// void CloseSplashScreen(); /// 0 if equal, 1 if version1 > version2, -1 if version1 < version2 int CompareVersions(string version1, string version2); /// /// Checks if a variable exists in the engine. /// /// The name of the variable. /// Whether the variable exists. bool ContainsVariable(string name); /// /// Determine if all installation conditions are fulfilled. /// void Detect(); /// /// Determine if all installation conditions are fulfilled. /// /// The parent window for the installation user interface. void Detect(IntPtr hwndParent); /// /// Elevate the install. /// /// The parent window of the elevation dialog. /// true if elevation succeeded; otherwise, false if the user cancelled. /// A Win32 error occurred. bool Elevate(IntPtr hwndParent); /// /// Escapes the input string. /// /// The string to escape. /// The escaped string. /// A Win32 error occurred. string EscapeString(string input); /// /// Evaluates the string. /// /// The string representing the condition to evaluate. /// Whether the condition evaluated to true or false. bool EvaluateCondition(string condition); /// /// Formats the input string. /// /// The string to format. /// The formatted string. /// A Win32 error occurred. string FormatString(string format); /// /// Gets numeric variables for the engine. /// /// The name of the variable. long GetVariableNumeric(string name); /// /// Gets string variables for the engine using SecureStrings. /// /// The name of the variable. SecureString GetVariableSecureString(string name); /// /// Gets string variables for the engine. /// /// The name of the variable. string GetVariableString(string name); /// /// Gets variables for the engine. /// /// The name of the variable. string GetVariableVersion(string name); /// /// Gets persisted variables from a related bundle. /// /// The BundleId of the related bundle. /// The name of the variable. string GetRelatedBundleVariable(string bundleId, string name); /// /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. /// /// The parent window of the elevation dialog (if the engine hasn't elevated yet). /// Id of the ApprovedExeForElevation element specified when the bundle was authored. /// Optional arguments. void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments); /// /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. /// /// The parent window of the elevation dialog (if the engine hasn't elevated yet). /// Id of the ApprovedExeForElevation element specified when the bundle was authored. /// Optional arguments. /// 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. void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout); /// /// Logs the . /// /// The logging level. /// The message to log. void Log(LogLevel level, string message); /// /// Determine the installation sequencing and costing. /// /// The action to perform when planning. void Plan(LaunchAction action); /// /// Set the update information for a bundle. /// /// Optional local source path for the update. Default is "update\[OriginalNameOfBundle].exe". /// Optional download source for the update. /// Size of the expected update. /// Type of the hash expected on the update. /// Optional hash expected for the update. void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash); /// /// Sets the URL to the update feed. /// /// URL of the update feed. void SetUpdateSource(string url); /// /// Set the local source for a package or container. /// /// The id that uniquely identifies the package or container. /// The id that uniquely identifies the payload. /// The new source path. void SetLocalSource(string packageOrContainerId, string payloadId, string path); /// /// Set the new download URL for a package or container. /// /// The id that uniquely identifies the package or container. /// The id that uniquely identifies the payload. /// The new url. /// The user name for proxy authentication. /// The password for proxy authentication. void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password); /// /// Sets numeric variables for the engine. /// /// The name of the variable. /// The value to set. void SetVariableNumeric(string name, long value); /// /// Sets string variables for the engine using SecureStrings. /// /// The name of the variable. /// The value to set. /// False if the value is a literal string. void SetVariableString(string name, SecureString value, bool formatted); /// /// Sets string variables for the engine. /// /// The name of the variable. /// The value to set. /// False if the value is a literal string. void SetVariableString(string name, string value, bool formatted); /// /// Sets version variables for the engine. /// /// The name of the variable. /// The value to set. void SetVariableVersion(string name, string value); /// /// Sends error message when embedded. /// /// Error code. /// Error message. /// UI buttons to show on error dialog. int SendEmbeddedError(int errorCode, string message, int uiHint); /// /// Sends progress percentages when embedded. /// /// Percentage completed thus far. /// Overall percentage completed. int SendEmbeddedProgress(int progressPercentage, int overallPercentage); /// /// Shuts down the engine. /// /// Exit code indicating reason for shut down. void Quit(int exitCode); } }