// 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 { using System; using System.Collections.Generic; using System.Linq; using WixToolset.Data; using WixToolset.Data.Bind; using WixToolset.Extensibility; public class BinderFileManagerCore : IBinderFileManagerCore { private Dictionary>[] bindPaths; /// /// Instantiate a new BinderFileManager. /// public BinderFileManagerCore() { this.bindPaths = new Dictionary>[3]; this.bindPaths[(int)BindStage.Normal] = new Dictionary>(); this.bindPaths[(int)BindStage.Target] = new Dictionary>(); this.bindPaths[(int)BindStage.Updated] = new Dictionary>(); } /// /// Gets or sets the path to cabinet cache. /// /// The path to cabinet cache. public string CabCachePath { get; set; } /// /// Gets or sets the active subStorage used for binding. /// /// The subStorage object. //public SubStorage ActiveSubStorage { get; set; } /// /// Gets or sets the output object used for binding. /// /// The output object. public Intermediate Intermediate { get; set; } /// /// Gets or sets the path to the temp files location. /// /// The path to the temp files location. public string TempFilesLocation { get; set; } /// /// Gets the property if re-basing target is true or false /// /// It returns true if target bind path is to be replaced, otherwise false. public bool RebaseTarget { get { return this.bindPaths[(int)BindStage.Target].Any(); } } /// /// Gets the property if re-basing updated build is true or false /// /// It returns true if updated bind path is to be replaced, otherwise false. public bool RebaseUpdated { get { return this.bindPaths[(int)BindStage.Updated].Any(); } } public void AddBindPaths(IEnumerable paths, BindStage stage) { Dictionary> dict = this.bindPaths[(int)stage]; foreach (BindPath bindPath in paths) { List values; if (!dict.TryGetValue(bindPath.Name, out values)) { values = new List(); dict.Add(bindPath.Name, values); } if (!values.Contains(bindPath.Path)) { values.Add(bindPath.Path); } } } public IEnumerable GetBindPaths(BindStage stage = BindStage.Normal, string name = null) { List paths; if (this.bindPaths[(int)stage].TryGetValue(name ?? String.Empty, out paths)) { return paths; } return Enumerable.Empty(); } } }