From ce51350ca9c020312810447f64a3f40145f749bd Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 24 Oct 2018 20:55:33 -0700 Subject: Fix "binder" names in interfaces and file names --- .../BaseWindowsInstallerBackendBinderExtension.cs | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs (limited to 'src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs') diff --git a/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..c5ee9d1b --- /dev/null +++ b/src/WixToolset.Extensibility/BaseWindowsInstallerBackendBinderExtension.cs @@ -0,0 +1,70 @@ +// 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; } + + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + + 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) + { + } + } +} -- cgit v1.2.3-55-g6feb