// 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.Extensibility { using System.Collections.Generic; using WixToolset.Data; using WixToolset.Data.Tuples; using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// /// Base class for creating a preprocessor extension. /// public abstract class BaseWindowsInstallerBackendBinderExtension : IWindowsInstallerBackendBinderExtension { /// /// Context for use by the extension. /// protected IBindContext Context { get; private set; } /// /// Messaging for use by the extension. /// protected IMessaging Messaging { get; private set; } /// /// Backend helper for use by the extension. /// protected IWindowsInstallerBackendHelper BackendHelper { get; private set; } /// /// Optional table definitions to automatically map to tuples. /// protected virtual TableDefinition[] TableDefinitionsForTuples { get; } /// /// Creates a resolved cabinet result. /// protected IResolvedCabinet CreateResolvedCabinet() => this.Context.ServiceProvider.GetService(); public virtual void PreBackendBind(IBindContext context) { this.Context = context; this.Messaging = context.ServiceProvider.GetService(); this.BackendHelper = context.ServiceProvider.GetService(); } public virtual IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable files) { return null; } public virtual string ResolveMedia(MediaTuple mediaRow, string mediaLayoutDirectory, string layoutDirectory) { return null; } public virtual bool TryAddTupleToOutput(IntermediateTuple tuple, Output output) { if (this.TableDefinitionsForTuples != null) { return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, this.TableDefinitionsForTuples); } return false; } public virtual void PostBackendBind(IBindResult result, Pdb pdb) { } } }