From bfd0eeddbbdec0348f43e47c36dedf4a23e9a927 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 15 Feb 2019 22:01:57 -0600 Subject: WIXFEAT:3815 - use interfaces added in BootstrapperCore. --- src/WixToolset.WixBA/InstallationViewModel.cs | 10 +++++----- src/WixToolset.WixBA/Model.cs | 17 ++++++++++------- src/WixToolset.WixBA/WixBA.cs | 19 +++++++++++++------ src/WixToolset.WixBA/WixBAFactory.cs | 2 +- src/WixToolset.WixBA/WixToolset.WixBA.csproj | 4 ++-- src/WixToolset.WixBA/packages.config | 2 +- 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/WixToolset.WixBA/InstallationViewModel.cs b/src/WixToolset.WixBA/InstallationViewModel.cs index 35510db4..33b14810 100644 --- a/src/WixToolset.WixBA/InstallationViewModel.cs +++ b/src/WixToolset.WixBA/InstallationViewModel.cs @@ -403,9 +403,9 @@ namespace WixToolset.WixBA this.Downgrade = true; } - if (!WixBA.Model.Bootstrapper.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) + if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) { - WixBA.Model.Bootstrapper.BAManifest.Bundle.AddRelatedBundleAsPackage(e); + WixBA.Model.BAManifest.Bundle.AddRelatedBundleAsPackage(e); } } @@ -426,8 +426,8 @@ namespace WixToolset.WixBA if (this.Downgrade) { this.root.DetectState = DetectionState.Newer; - IEnumerable relatedPackages = WixBA.Model.Bootstrapper.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); - Version installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null; + var relatedPackages = WixBA.Model.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); + var installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null; if (installedVersion != null && installedVersion < new Version(4, 1) && installedVersion.Build > 10) { this.DowngradeMessage = "You must uninstall WiX v" + installedVersion + " before you can install this."; @@ -641,7 +641,7 @@ namespace WixToolset.WixBA private void ParseCommandLine() { // Get array of arguments based on the system parsing algorithm. - string[] args = WixBA.Model.Command.GetCommandLineArgs(); + string[] args = WixBA.Model.Command.CommandLineArgs; for (int i = 0; i < args.Length; ++i) { if (args[i].StartsWith("InstallFolder=", StringComparison.InvariantCultureIgnoreCase)) diff --git a/src/WixToolset.WixBA/Model.cs b/src/WixToolset.WixBA/Model.cs index 25415e0f..fda8eab2 100644 --- a/src/WixToolset.WixBA/Model.cs +++ b/src/WixToolset.WixBA/Model.cs @@ -20,27 +20,32 @@ namespace WixToolset.WixBA /// Creates a new model for the BA. /// /// The BA. - public Model(BootstrapperApplication bootstrapper) + public Model(WixBA bootstrapper) { + this.BAManifest = bootstrapper.BAManifest; this.Bootstrapper = bootstrapper; + this.Command = bootstrapper.Command; + this.Engine = bootstrapper.Engine; this.Telemetry = new List>(); this.Version = this.Engine.VersionVariables[BurnBundleVersionVariable]; } + public IBootstrapperApplicationData BAManifest { get; } + /// /// Gets the bootstrapper. /// - public BootstrapperApplication Bootstrapper { get; private set; } + public IDefaultBootstrapperApplication Bootstrapper { get; } /// /// Gets the bootstrapper command-line. /// - public Command Command { get { return this.Bootstrapper.Command; } } + public IBootstrapperCommand Command { get; } /// /// Gets the bootstrapper engine. /// - public Engine Engine { get { return this.Bootstrapper.Engine; } } + public IEngine Engine { get; } /// /// Gets the key/value pairs used in telemetry. @@ -121,9 +126,7 @@ namespace WixToolset.WixBA /// Display name of the package if found or the package id if not. public string GetPackageName(string packageId) { - PackageInfo package; - - return this.Bootstrapper.BAManifest.Bundle.Packages.TryGetValue(packageId, out package) ? package.DisplayName : packageId; + return this.BAManifest.Bundle.Packages.TryGetValue(packageId, out var package) ? package.DisplayName : packageId; } } } diff --git a/src/WixToolset.WixBA/WixBA.cs b/src/WixToolset.WixBA/WixBA.cs index 6b64b252..b82a86ae 100644 --- a/src/WixToolset.WixBA/WixBA.cs +++ b/src/WixToolset.WixBA/WixBA.cs @@ -8,23 +8,30 @@ namespace WixToolset.WixBA using System.IO; using System.Net; using System.Text; - using System.Windows.Input; + using WixToolset.BootstrapperCore; + using Threading = System.Windows.Threading; using WinForms = System.Windows.Forms; - using WixToolset.BootstrapperCore; - /// - /// The WiX toolset user experience. + /// The WiX toolset bootstrapper application. /// public class WixBA : BootstrapperApplication { - public WixBA(Engine engine, Command command) - : base(engine, command) + public WixBA(IEngine engine, IBootstrapperCommand command) + : base(engine) { + this.Command = command; + this.BAManifest = new BootstrapperApplicationData(); } + internal IBootstrapperApplicationData BAManifest { get; } + + internal IBootstrapperCommand Command { get; } + + internal IEngine Engine => this.engine; + /// /// Gets the global model. /// diff --git a/src/WixToolset.WixBA/WixBAFactory.cs b/src/WixToolset.WixBA/WixBAFactory.cs index 66012521..0c219f17 100644 --- a/src/WixToolset.WixBA/WixBAFactory.cs +++ b/src/WixToolset.WixBA/WixBAFactory.cs @@ -6,7 +6,7 @@ namespace WixToolset.WixBA public class WixBAFactory : BaseBootstrapperApplicationFactory { - protected override IBootstrapperApplication Create(Engine engine, ref Command command) + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand command) { return new WixBA(engine, command); } diff --git a/src/WixToolset.WixBA/WixToolset.WixBA.csproj b/src/WixToolset.WixBA/WixToolset.WixBA.csproj index 083d4e6e..881996e4 100644 --- a/src/WixToolset.WixBA/WixToolset.WixBA.csproj +++ b/src/WixToolset.WixBA/WixToolset.WixBA.csproj @@ -1,4 +1,4 @@ - + @@ -57,7 +57,7 @@ - ..\..\packages\WixToolset.BootstrapperCore.4.0.4\lib\net20\WixToolset.BootstrapperCore.dll + ..\..\packages\WixToolset.BootstrapperCore.4.0.5\lib\net20\WixToolset.BootstrapperCore.dll diff --git a/src/WixToolset.WixBA/packages.config b/src/WixToolset.WixBA/packages.config index 3ca82077..24cbf46f 100644 --- a/src/WixToolset.WixBA/packages.config +++ b/src/WixToolset.WixBA/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file -- cgit v1.2.3-55-g6feb