From 177784c9a6d93eeb3c195e6d62b97eb4c1dde32b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 2 Apr 2020 20:45:40 +1000 Subject: Use IWixToolsetServiceProvider and IWixToolsetCoreServiceProvider to expose the more convenient methods from WixToolsetServiceProvider without requiring casting or extension methods. --- .../Bind/BindDatabaseCommand.cs | 2 +- src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs | 4 ++-- .../Bind/CreateCabinetsCommand.cs | 4 ++-- src/WixToolset.Core.WindowsInstaller/UnbindContext.cs | 10 ++++++++-- src/WixToolset.Core.WindowsInstaller/Unbinder.cs | 8 +++++--- 5 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src/WixToolset.Core.WindowsInstaller') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 6878aed5..2ced48ea 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -54,7 +54,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.BackendExtensions = backendExtension; } - public IServiceProvider ServiceProvider { get; } + public IWixToolsetServiceProvider ServiceProvider { get; } private IMessaging Messaging { get; } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs index 79b1c619..189c5f01 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs @@ -15,7 +15,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind public class CabinetResolver { - public CabinetResolver(IServiceProvider serviceProvider, string cabCachePath, IEnumerable backendExtensions) + public CabinetResolver(IWixToolsetServiceProvider serviceProvider, string cabCachePath, IEnumerable backendExtensions) { this.ServiceProvider = serviceProvider; @@ -24,7 +24,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.BackendExtensions = backendExtensions; } - private IServiceProvider ServiceProvider { get; } + private IWixToolsetServiceProvider ServiceProvider { get; } private string CabCachePath { get; } diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs index 50dc7e3f..2536eeac 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs @@ -33,7 +33,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind private Dictionary lastCabinetAddedToMediaTable; // Key is First Cabinet Name, Value is Last Cabinet Added in the Split Sequence - public CreateCabinetsCommand(IServiceProvider serviceProvider, IBackendHelper backendHelper) + public CreateCabinetsCommand(IWixToolsetServiceProvider serviceProvider, IBackendHelper backendHelper) { this.fileTransfers = new List(); @@ -46,7 +46,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.BackendHelper = backendHelper; } - public IServiceProvider ServiceProvider { get; } + public IWixToolsetServiceProvider ServiceProvider { get; } public IBackendHelper BackendHelper { get; } diff --git a/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs b/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs index 2bc4516d..f60a0e1a 100644 --- a/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs +++ b/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs @@ -1,13 +1,19 @@ -// 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. +// 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.Core { using System; using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; internal class UnbindContext : IUnbindContext { - public IServiceProvider ServiceProvider { get; } + internal UnbindContext(IWixToolsetServiceProvider serviceProvider) + { + this.ServiceProvider = serviceProvider; + } + + public IWixToolsetServiceProvider ServiceProvider { get; } public string ExportBasePath { get; set; } diff --git a/src/WixToolset.Core.WindowsInstaller/Unbinder.cs b/src/WixToolset.Core.WindowsInstaller/Unbinder.cs index e8c109d2..2ca0b557 100644 --- a/src/WixToolset.Core.WindowsInstaller/Unbinder.cs +++ b/src/WixToolset.Core.WindowsInstaller/Unbinder.cs @@ -2,11 +2,11 @@ namespace WixToolset.Core { - using System.Collections; + using System.Collections.Generic; using System.IO; using WixToolset.Data; using WixToolset.Extensibility; - using System.Collections.Generic; + using WixToolset.Extensibility.Services; /// /// Unbinder core of the WiX toolset. @@ -21,6 +21,8 @@ namespace WixToolset.Core /// Set to true if the input msi is part of an admin image. public bool IsAdminImage { get; set; } + public IWixToolsetServiceProvider ServiceProvider { get; } + /// /// Gets or sets the option to suppress demodularizing values. /// @@ -64,7 +66,7 @@ namespace WixToolset.Core // if we don't have the temporary files object yet, get one Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there - var context = new UnbindContext(); + var context = new UnbindContext(this.ServiceProvider); context.InputFilePath = file; context.ExportBasePath = exportBasePath; context.IntermediateFolder = this.TempFilesLocation; -- cgit v1.2.3-55-g6feb