// 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 System.Linq; using WixToolset.Data; using WixToolset.Data.Burn; using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; public abstract class BaseBurnBackendExtension : IBurnBackendExtension { /// /// 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 IBurnBackendHelper BackendHelper { get; private set; } /// /// Optional symbol definitions. /// protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); public virtual void BundleFinalize() { } public virtual void PostBackendBind(IBindResult result) { } public virtual void PreBackendBind(IBindContext context) { this.Context = context; this.Messaging = context.ServiceProvider.GetService(); this.BackendHelper = context.ServiceProvider.GetService(); } public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers, BindStage bindStage) { return null; } public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) { return null; } public virtual bool TryAddSymbolToDataManifest(IntermediateSection section, IntermediateSymbol symbol) { if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) { this.BackendHelper.AddBootstrapperApplicationData(symbol); return true; } return false; } } }