blob: 264733ac274092e066ba6765e022fb71fd7970ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// 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.Runtime.InteropServices;
public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory
{
public void Create(IntPtr pArgs, IntPtr pResults)
{
InitializeFromCreateArgs(pArgs, out var engine, out var bootstrapperCommand);
var ba = this.Create(engine, bootstrapperCommand);
StoreBAInCreateResults(pResults, ba);
}
protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand);
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();
}
public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba)
{
BalUtil.StoreBAInCreateResults(pResults, ba);
}
}
}
|