diff options
| author | Rob Mensching <rob@firegiant.com> | 2024-03-06 14:48:10 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2024-03-07 10:55:57 -0800 |
| commit | 3d2d46f62fc01e2653d0251ad9703090574e7c41 (patch) | |
| tree | ffdf7dce6c646f38b5e3ad8325c2ce78ca891a1a /src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs | |
| parent | a8504dc4eb1c2d09965b0858699ac737336ef3c1 (diff) | |
| download | wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.gz wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.tar.bz2 wix-3d2d46f62fc01e2653d0251ad9703090574e7c41.zip | |
Better .nupkg names
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs b/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs deleted file mode 100644 index 121c6aee..00000000 --- a/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Mba.Core | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Xml; | ||
| 8 | using System.Xml.XPath; | ||
| 9 | |||
| 10 | /// <summary> | ||
| 11 | /// Default implementation of <see cref="IOverridableVariables"/>. | ||
| 12 | /// </summary> | ||
| 13 | public class OverridableVariablesInfo : IOverridableVariables | ||
| 14 | { | ||
| 15 | /// <inheritdoc /> | ||
| 16 | public VariableCommandLineType CommandLineType { get; internal set; } | ||
| 17 | |||
| 18 | /// <inheritdoc /> | ||
| 19 | public IDictionary<string, IOverridableVariableInfo> Variables { get; internal set; } | ||
| 20 | |||
| 21 | internal OverridableVariablesInfo() { } | ||
| 22 | |||
| 23 | /// <summary> | ||
| 24 | /// Parses the overridable variable info from the BA manifest. | ||
| 25 | /// </summary> | ||
| 26 | /// <param name="root">XML root</param> | ||
| 27 | /// <returns>The parsed information.</returns> | ||
| 28 | public static IOverridableVariables ParseFromXml(XPathNavigator root) | ||
| 29 | { | ||
| 30 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); | ||
| 31 | namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); | ||
| 32 | XPathNavigator commandLineNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:WixStdbaCommandLine", namespaceManager); | ||
| 33 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixStdbaOverridableVariable", namespaceManager); | ||
| 34 | |||
| 35 | var overridableVariables = new OverridableVariablesInfo(); | ||
| 36 | IEqualityComparer<string> variableNameComparer; | ||
| 37 | |||
| 38 | if (commandLineNode == null) | ||
| 39 | { | ||
| 40 | overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; | ||
| 41 | variableNameComparer = StringComparer.InvariantCulture; | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | string variablesValue = BootstrapperApplicationData.GetAttribute(commandLineNode, "Variables"); | ||
| 46 | |||
| 47 | if (variablesValue == null) | ||
| 48 | { | ||
| 49 | throw new Exception("Failed to get command line variable type."); | ||
| 50 | } | ||
| 51 | |||
| 52 | if (variablesValue.Equals("caseInsensitive", StringComparison.InvariantCulture)) | ||
| 53 | { | ||
| 54 | overridableVariables.CommandLineType = VariableCommandLineType.CaseInsensitive; | ||
| 55 | variableNameComparer = StringComparer.InvariantCultureIgnoreCase; | ||
| 56 | } | ||
| 57 | else if (variablesValue.Equals("caseSensitive", StringComparison.InvariantCulture)) | ||
| 58 | { | ||
| 59 | overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; | ||
| 60 | variableNameComparer = StringComparer.InvariantCulture; | ||
| 61 | } | ||
| 62 | else | ||
| 63 | { | ||
| 64 | throw new Exception(String.Format("Unknown command line variable type: '{0}'", variablesValue)); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | overridableVariables.Variables = new Dictionary<string, IOverridableVariableInfo>(variableNameComparer); | ||
| 69 | |||
| 70 | foreach (XPathNavigator node in nodes) | ||
| 71 | { | ||
| 72 | var variable = new OverridableVariableInfo(); | ||
| 73 | |||
| 74 | string name = BootstrapperApplicationData.GetAttribute(node, "Name"); | ||
| 75 | if (name == null) | ||
| 76 | { | ||
| 77 | throw new Exception("Failed to get name for overridable variable."); | ||
| 78 | } | ||
| 79 | variable.Name = name; | ||
| 80 | |||
| 81 | overridableVariables.Variables.Add(variable.Name, variable); | ||
| 82 | } | ||
| 83 | |||
| 84 | return overridableVariables; | ||
| 85 | } | ||
| 86 | } | ||
| 87 | } | ||
