diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-09-09 16:03:29 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-09-09 21:14:27 -0500 |
| commit | a1307cd4e76a89598c53cb68309358a7012db553 (patch) | |
| tree | f79cf181b49f0b754afcd4ec25487bf2b284d45e /src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs | |
| parent | f61479585d865372645cb18c982aa708dd975da3 (diff) | |
| download | wix-a1307cd4e76a89598c53cb68309358a7012db553.tar.gz wix-a1307cd4e76a89598c53cb68309358a7012db553.tar.bz2 wix-a1307cd4e76a89598c53cb68309358a7012db553.zip | |
Move `Bundle/@CommandLineVariables` into Bal.wixext.
Implements 6858
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs')
| -rw-r--r-- | src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs b/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs index 148acb34..121c6aee 100644 --- a/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs +++ b/src/api/burn/WixToolset.Mba.Core/OverridableVariables.cs | |||
| @@ -29,37 +29,43 @@ namespace WixToolset.Mba.Core | |||
| 29 | { | 29 | { |
| 30 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); | 30 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); |
| 31 | namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); | 31 | namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); |
| 32 | XPathNavigator commandLineNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:CommandLine", namespaceManager); | 32 | XPathNavigator commandLineNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:WixStdbaCommandLine", namespaceManager); |
| 33 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixStdbaOverridableVariable", namespaceManager); | 33 | XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixStdbaOverridableVariable", namespaceManager); |
| 34 | 34 | ||
| 35 | var overridableVariables = new OverridableVariablesInfo(); | 35 | var overridableVariables = new OverridableVariablesInfo(); |
| 36 | IEqualityComparer<string> variableNameComparer; | ||
| 36 | 37 | ||
| 37 | if (commandLineNode == null) | 38 | if (commandLineNode == null) |
| 38 | { | 39 | { |
| 39 | throw new Exception("Failed to select command line information."); | ||
| 40 | } | ||
| 41 | |||
| 42 | string variablesValue = BootstrapperApplicationData.GetAttribute(commandLineNode, "Variables"); | ||
| 43 | |||
| 44 | if (variablesValue == null) | ||
| 45 | { | ||
| 46 | throw new Exception("Failed to get command line variable type."); | ||
| 47 | } | ||
| 48 | |||
| 49 | if (variablesValue.Equals("upperCase", StringComparison.InvariantCulture)) | ||
| 50 | { | ||
| 51 | overridableVariables.CommandLineType = VariableCommandLineType.UpperCase; | ||
| 52 | } | ||
| 53 | else if (variablesValue.Equals("caseSensitive", StringComparison.InvariantCulture)) | ||
| 54 | { | ||
| 55 | overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; | 40 | overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; |
| 41 | variableNameComparer = StringComparer.InvariantCulture; | ||
| 56 | } | 42 | } |
| 57 | else | 43 | else |
| 58 | { | 44 | { |
| 59 | throw new Exception(string.Format("Unknown command line variable type: '{0}'", variablesValue)); | 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 | } | ||
| 60 | } | 66 | } |
| 61 | 67 | ||
| 62 | overridableVariables.Variables = new Dictionary<string, IOverridableVariableInfo>(); | 68 | overridableVariables.Variables = new Dictionary<string, IOverridableVariableInfo>(variableNameComparer); |
| 63 | 69 | ||
| 64 | foreach (XPathNavigator node in nodes) | 70 | foreach (XPathNavigator node in nodes) |
| 65 | { | 71 | { |
