/// <summary>
        /// Initializes the native part of <see cref="WixToolset.Mba.Core"/>.
        /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method.
        /// </summary>
        /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param>
        /// <param name="engine">The bundle engine interface.</param>
        /// <param name="bootstrapperCommand">The context of the current run of the bundle.</param>
        public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand)
        {
            Command pCommand = new Command
            {
                cbSize = Marshal.SizeOf(typeof(Command))
            };
            var pEngine = BalUtil.InitializeFromCreateArgs(pArgs, ref pCommand);

            engine = new Engine(pEngine);
            bootstrapperCommand = pCommand.GetBootstrapperCommand();
        }
예제 #2
0
        /// <inheritdoc/>
        public string EscapeString(string input)
        {
            StrUtil.StrHandle handle = new StrUtil.StrHandle();
            try
            {
                int ret = BalUtil.BalEscapeStringFromEngine(this.engine, input, ref handle);
                if (ret != NativeMethods.S_OK)
                {
                    throw new Win32Exception(ret);
                }

                return(handle.ToUniString());
            }
            finally
            {
                handle.Dispose();
            }
        }
예제 #3
0
        /// <inheritdoc/>
        public string GetVariableVersion(string name)
        {
            StrUtil.StrHandle handle = new StrUtil.StrHandle();
            try
            {
                int ret = BalUtil.BalGetVersionVariableFromEngine(this.engine, name, ref handle);
                if (ret != NativeMethods.S_OK)
                {
                    throw new Win32Exception(ret);
                }

                return(handle.ToUniString());
            }
            finally
            {
                handle.Dispose();
            }
        }
 /// <summary>
 /// Registers the BA with the engine using the default mapping between the message based interface and the COM interface.
 /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method.
 /// </summary>
 /// <param name="pResults">The results struct given by the engine when initially creating the BA</param>
 /// <param name="ba">The <see cref="IBootstrapperApplication"/>.</param>
 public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba)
 {
     BalUtil.StoreBAInCreateResults(pResults, ba);
 }
예제 #5
0
 /// <inheritdoc/>
 public bool ContainsVariable(string name)
 {
     return(BalUtil.BalVariableExistsFromEngine(this.engine, name));
 }