From 271601dfe0990917ef6331fbddcfd1b400882eb2 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 26 Mar 2020 13:31:04 -0400 Subject: Add intermediate levels to track how IR has been lowered. --- src/WixToolset.Data/Intermediate.cs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src/WixToolset.Data/Intermediate.cs') diff --git a/src/WixToolset.Data/Intermediate.cs b/src/WixToolset.Data/Intermediate.cs index 7fc7d6c3..d1c38cf0 100644 --- a/src/WixToolset.Data/Intermediate.cs +++ b/src/WixToolset.Data/Intermediate.cs @@ -29,9 +29,14 @@ namespace WixToolset.Data this.Sections = new List(); } - public Intermediate(string id, IEnumerable sections, IDictionary localizationsByCulture) + public Intermediate(string id, IEnumerable sections, IDictionary localizationsByCulture) : this(id, level: null, sections, localizationsByCulture) + { + } + + public Intermediate(string id, string level, IEnumerable sections, IDictionary localizationsByCulture) { this.Id = id; + this.Level = level; this.localizationsByCulture = (localizationsByCulture != null) ? new Dictionary(localizationsByCulture, StringComparer.OrdinalIgnoreCase) : new Dictionary(StringComparer.OrdinalIgnoreCase); this.Sections = (sections != null) ? new List(sections) : new List(); } @@ -41,6 +46,11 @@ namespace WixToolset.Data /// public string Id { get; } + /// + /// Get the id for the intermediate. + /// + public string Level { get; private set; } + /// /// Get the localizations contained in this intermediate. /// @@ -181,6 +191,25 @@ namespace WixToolset.Data return intermediates; } + /// + /// Updates the intermediate level to the specified level. + /// + /// Intermediate level. + public void UpdateLevel(string level) + { + this.Level = String.IsNullOrEmpty(this.Level) ? level : String.Concat(this.Level, ";", level); + } + + /// + /// Returns whether a specifed intermediate level has been set for this intermediate. + /// + /// Intermediate level. + /// True if the specifed intermediate level has been set for this intermediate. + public bool HasLevel(string level) + { + return this.Level?.Contains(level) == true; + } + /// /// Saves an intermediate to a path on disk. /// @@ -277,6 +306,7 @@ namespace WixToolset.Data private static Intermediate FinalizeLoad(JsonObject json, Uri baseUri, ITupleDefinitionCreator creator) { var id = json.GetValueOrDefault("id"); + var level = json.GetValueOrDefault("level"); var sections = new List(); @@ -296,7 +326,7 @@ namespace WixToolset.Data localizations.Add(localization.Culture, localization); } - return new Intermediate(id, sections, localizations); + return new Intermediate(id, level, sections, localizations); } private void SaveEmbedFiles(WixOutput wixout) @@ -351,6 +381,7 @@ namespace WixToolset.Data var jsonObject = new JsonObject { { "id", this.Id }, + { "level", this.Level }, { "version", Intermediate.CurrentVersion.ToString() } }; -- cgit v1.2.3-55-g6feb