diff options
Diffstat (limited to 'src/WixToolset.Core/VariableResolver.cs')
-rw-r--r-- | src/WixToolset.Core/VariableResolver.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/WixToolset.Core/VariableResolver.cs b/src/WixToolset.Core/VariableResolver.cs index eb65d3d6..de722613 100644 --- a/src/WixToolset.Core/VariableResolver.cs +++ b/src/WixToolset.Core/VariableResolver.cs | |||
@@ -23,6 +23,7 @@ namespace WixToolset.Core | |||
23 | /// </summary> | 23 | /// </summary> |
24 | internal VariableResolver(IServiceProvider serviceProvider) | 24 | internal VariableResolver(IServiceProvider serviceProvider) |
25 | { | 25 | { |
26 | this.ServiceProvider = serviceProvider; | ||
26 | this.Messaging = serviceProvider.GetService<IMessaging>(); | 27 | this.Messaging = serviceProvider.GetService<IMessaging>(); |
27 | 28 | ||
28 | this.locVariables = new Dictionary<string, BindVariable>(); | 29 | this.locVariables = new Dictionary<string, BindVariable>(); |
@@ -31,6 +32,8 @@ namespace WixToolset.Core | |||
31 | this.Codepage = -1; | 32 | this.Codepage = -1; |
32 | } | 33 | } |
33 | 34 | ||
35 | private IServiceProvider ServiceProvider { get; } | ||
36 | |||
34 | private IMessaging Messaging { get; } | 37 | private IMessaging Messaging { get; } |
35 | 38 | ||
36 | public int Codepage { get; private set; } | 39 | public int Codepage { get; private set; } |
@@ -71,7 +74,7 @@ namespace WixToolset.Core | |||
71 | } | 74 | } |
72 | } | 75 | } |
73 | 76 | ||
74 | public VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly) | 77 | public IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly) |
75 | { | 78 | { |
76 | return this.ResolveVariables(sourceLineNumbers, value, localizationOnly, true); | 79 | return this.ResolveVariables(sourceLineNumbers, value, localizationOnly, true); |
77 | } | 80 | } |
@@ -90,12 +93,14 @@ namespace WixToolset.Core | |||
90 | /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param> | 93 | /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param> |
91 | /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> | 94 | /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> |
92 | /// <returns>The resolved value.</returns> | 95 | /// <returns>The resolved value.</returns> |
93 | internal VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) | 96 | internal IVariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) |
94 | { | 97 | { |
95 | var matches = Common.WixVariableRegex.Matches(value); | 98 | var matches = Common.WixVariableRegex.Matches(value); |
96 | 99 | ||
97 | // the value is the default unless its substituted further down | 100 | // the value is the default unless its substituted further down |
98 | var result = new VariableResolution { IsDefault = true, Value = value }; | 101 | var result = this.ServiceProvider.GetService<IVariableResolution>(); |
102 | result.IsDefault = true; | ||
103 | result.Value = value; | ||
99 | 104 | ||
100 | if (0 < matches.Count) | 105 | if (0 < matches.Count) |
101 | { | 106 | { |