@joebigelow / wix / commits / bfd0eedd

WIXFEAT:3815 - use interfaces added in BootstrapperCore.

Sean Hall committed Feb 15, 2019 at 22:01 UTC bfd0eeddbbdec0348f43e47c36dedf4a23e9a927
6 files changed +32 -22
src/WixToolset.WixBA/InstallationViewModel.cs
+5 -5
@@ -403,9 +403,9 @@ namespace WixToolset.WixBA
403 this.Downgrade = true;
404 }
405
406 - if (!WixBA.Model.Bootstrapper.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode))
406 + if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode))
407 {
408 - WixBA.Model.Bootstrapper.BAManifest.Bundle.AddRelatedBundleAsPackage(e);
408 + WixBA.Model.BAManifest.Bundle.AddRelatedBundleAsPackage(e);
409 }
410 }
411
@@ -426,8 +426,8 @@ namespace WixToolset.WixBA
426 if (this.Downgrade)
427 {
428 this.root.DetectState = DetectionState.Newer;
429 - IEnumerable<PackageInfo> relatedPackages = WixBA.Model.Bootstrapper.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle);
430 - Version installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null;
429 + var relatedPackages = WixBA.Model.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle);
430 + var installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null;
431 if (installedVersion != null && installedVersion < new Version(4, 1) && installedVersion.Build > 10)
432 {
433 this.DowngradeMessage = "You must uninstall WiX v" + installedVersion + " before you can install this.";
@@ -641,7 +641,7 @@ namespace WixToolset.WixBA
641 private void ParseCommandLine()
642 {
643 // Get array of arguments based on the system parsing algorithm.
644 - string[] args = WixBA.Model.Command.GetCommandLineArgs();
644 + string[] args = WixBA.Model.Command.CommandLineArgs;
645 for (int i = 0; i < args.Length; ++i)
646 {
647 if (args[i].StartsWith("InstallFolder=", StringComparison.InvariantCultureIgnoreCase))
src/WixToolset.WixBA/Model.cs
+10 -7
@@ -20,27 +20,32 @@ namespace WixToolset.WixBA
20 /// Creates a new model for the BA.
21 /// </summary>
22 /// <param name="bootstrapper">The BA.</param>
23 - public Model(BootstrapperApplication bootstrapper)
23 + public Model(WixBA bootstrapper)
24 {
25 + this.BAManifest = bootstrapper.BAManifest;
26 this.Bootstrapper = bootstrapper;
27 + this.Command = bootstrapper.Command;
28 + this.Engine = bootstrapper.Engine;
29 this.Telemetry = new List<KeyValuePair<string, string>>();
30 this.Version = this.Engine.VersionVariables[BurnBundleVersionVariable];
31 }
32
33 + public IBootstrapperApplicationData BAManifest { get; }
34 +
35 /// <summary>
36 /// Gets the bootstrapper.
37 /// </summary>
33 - public BootstrapperApplication Bootstrapper { get; private set; }
38 + public IDefaultBootstrapperApplication Bootstrapper { get; }
39
40 /// <summary>
41 /// Gets the bootstrapper command-line.
42 /// </summary>
38 - public Command Command { get { return this.Bootstrapper.Command; } }
43 + public IBootstrapperCommand Command { get; }
44
45 /// <summary>
46 /// Gets the bootstrapper engine.
47 /// </summary>
43 - public Engine Engine { get { return this.Bootstrapper.Engine; } }
48 + public IEngine Engine { get; }
49
50 /// <summary>
51 /// Gets the key/value pairs used in telemetry.
@@ -121,9 +126,7 @@ namespace WixToolset.WixBA
126 /// <returns>Display name of the package if found or the package id if not.</returns>
127 public string GetPackageName(string packageId)
128 {
124 - PackageInfo package;
125 -
126 - return this.Bootstrapper.BAManifest.Bundle.Packages.TryGetValue(packageId, out package) ? package.DisplayName : packageId;
129 + return this.BAManifest.Bundle.Packages.TryGetValue(packageId, out var package) ? package.DisplayName : packageId;
130 }
131 }
132 }
src/WixToolset.WixBA/WixBA.cs
+13 -6
@@ -8,23 +8,30 @@ namespace WixToolset.WixBA
8 using System.IO;
9 using System.Net;
10 using System.Text;
11 - using System.Windows.Input;
11 + using WixToolset.BootstrapperCore;
12 +
13 using Threading = System.Windows.Threading;
14 using WinForms = System.Windows.Forms;
15
15 - using WixToolset.BootstrapperCore;
16 -
16 /// <summary>
18 - /// The WiX toolset user experience.
17 + /// The WiX toolset bootstrapper application.
18 /// </summary>
19 public class WixBA : BootstrapperApplication
20 {
22 - public WixBA(Engine engine, Command command)
23 - : base(engine, command)
21 + public WixBA(IEngine engine, IBootstrapperCommand command)
22 + : base(engine)
23 {
24 + this.Command = command;
25
26 + this.BAManifest = new BootstrapperApplicationData();
27 }
28
29 + internal IBootstrapperApplicationData BAManifest { get; }
30 +
31 + internal IBootstrapperCommand Command { get; }
32 +
33 + internal IEngine Engine => this.engine;
34 +
35 /// <summary>
36 /// Gets the global model.
37 /// </summary>
src/WixToolset.WixBA/WixBAFactory.cs
+1 -1
@@ -6,7 +6,7 @@ namespace WixToolset.WixBA
6
7 public class WixBAFactory : BaseBootstrapperApplicationFactory
8 {
9 - protected override IBootstrapperApplication Create(Engine engine, ref Command command)
9 + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand command)
10 {
11 return new WixBA(engine, command);
12 }
src/WixToolset.WixBA/WixToolset.WixBA.csproj
+2 -2
@@ -1,4 +1,4 @@
1 -<?xml version="1.0" encoding="utf-8"?>
1 +<?xml version="1.0" encoding="utf-8"?>
2 <!-- 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. -->
3 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
4 <PropertyGroup>
@@ -57,7 +57,7 @@
57 <Reference Include="System.Xaml" />
58 <Reference Include="WindowsBase" />
59 <Reference Include="WixToolset.BootstrapperCore">
60 - <HintPath>..\..\packages\WixToolset.BootstrapperCore.4.0.4\lib\net20\WixToolset.BootstrapperCore.dll</HintPath>
60 + <HintPath>..\..\packages\WixToolset.BootstrapperCore.4.0.5\lib\net20\WixToolset.BootstrapperCore.dll</HintPath>
61 </Reference>
62 </ItemGroup>
63 <ItemGroup>
src/WixToolset.WixBA/packages.config
+1 -1
@@ -1,5 +1,5 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="net45" developmentDependency="true" />
4 - <package id="WixToolset.BootstrapperCore" version="4.0.4" targetFramework="net45" />
4 + <package id="WixToolset.BootstrapperCore" version="4.0.5" targetFramework="net45" />
5 </packages>
\ No newline at end of file