// 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.Bind; using WixToolset.Data.Tuples; using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility.Services; /// /// Base class for creating a preprocessor extension. /// public abstract class BaseWindowsInstallerBackendExtension : IWindowsInstallerBackendExtension { /// /// Context for use by the extension. /// protected IBindContext Context { 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; } public virtual void PreBackendBind(IBindContext context) { this.Context = context; this.BackendHelper = context.ServiceProvider.GetService(); } public virtual ResolvedCabinet 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(BindResult result, Pdb pdb) { } } }