diff options
author | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
commit | 155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch) | |
tree | 59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core/WixVariableResolver.cs | |
parent | 6f1665ed759b31bd095f186f9239232c653597cd (diff) | |
download | wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2 wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip |
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core/WixVariableResolver.cs')
-rw-r--r-- | src/WixToolset.Core/WixVariableResolver.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/WixToolset.Core/WixVariableResolver.cs b/src/WixToolset.Core/WixVariableResolver.cs index c4572d33..f8bccef0 100644 --- a/src/WixToolset.Core/WixVariableResolver.cs +++ b/src/WixToolset.Core/WixVariableResolver.cs | |||
@@ -11,6 +11,7 @@ namespace WixToolset.Core | |||
11 | using WixToolset.Data; | 11 | using WixToolset.Data; |
12 | using WixToolset.Data.Tuples; | 12 | using WixToolset.Data.Tuples; |
13 | using WixToolset.Extensibility; | 13 | using WixToolset.Extensibility; |
14 | using WixToolset.Extensibility.Services; | ||
14 | 15 | ||
15 | /// <summary> | 16 | /// <summary> |
16 | /// WiX variable resolver. | 17 | /// WiX variable resolver. |
@@ -22,16 +23,15 @@ namespace WixToolset.Core | |||
22 | /// <summary> | 23 | /// <summary> |
23 | /// Instantiate a new WixVariableResolver. | 24 | /// Instantiate a new WixVariableResolver. |
24 | /// </summary> | 25 | /// </summary> |
25 | public WixVariableResolver(Localizer localizer = null) | 26 | public WixVariableResolver(IMessaging messaging, Localizer localizer = null) |
26 | { | 27 | { |
27 | this.wixVariables = new Dictionary<string, string>(); | 28 | this.wixVariables = new Dictionary<string, string>(); |
29 | this.Messaging = messaging; | ||
28 | this.Localizer = localizer; | 30 | this.Localizer = localizer; |
29 | } | 31 | } |
30 | 32 | ||
31 | /// <summary> | 33 | private IMessaging Messaging { get; } |
32 | /// Gets or sets the localizer. | 34 | |
33 | /// </summary> | ||
34 | /// <value>The localizer.</value> | ||
35 | private Localizer Localizer { get; } | 35 | private Localizer Localizer { get; } |
36 | 36 | ||
37 | /// <summary> | 37 | /// <summary> |
@@ -52,7 +52,7 @@ namespace WixToolset.Core | |||
52 | } | 52 | } |
53 | catch (ArgumentException) | 53 | catch (ArgumentException) |
54 | { | 54 | { |
55 | Messaging.Instance.OnMessage(WixErrors.WixVariableCollision(null, name)); | 55 | this.Messaging.Write(ErrorMessages.WixVariableCollision(null, name)); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
@@ -70,7 +70,7 @@ namespace WixToolset.Core | |||
70 | { | 70 | { |
71 | if (!wixVariableRow.Overridable) // collision | 71 | if (!wixVariableRow.Overridable) // collision |
72 | { | 72 | { |
73 | Messaging.Instance.OnMessage(WixErrors.WixVariableCollision(wixVariableRow.SourceLineNumbers, wixVariableRow.WixVariable)); | 73 | this.Messaging.Write(ErrorMessages.WixVariableCollision(wixVariableRow.SourceLineNumbers, wixVariableRow.WixVariable)); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
@@ -153,7 +153,7 @@ namespace WixToolset.Core | |||
153 | // localization variables to not support inline default values | 153 | // localization variables to not support inline default values |
154 | if ("loc" == variableNamespace) | 154 | if ("loc" == variableNamespace) |
155 | { | 155 | { |
156 | Messaging.Instance.OnMessage(WixErrors.IllegalInlineLocVariable(sourceLineNumbers, variableId, variableDefaultValue)); | 156 | this.Messaging.Write(ErrorMessages.IllegalInlineLocVariable(sourceLineNumbers, variableId, variableDefaultValue)); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
@@ -183,7 +183,7 @@ namespace WixToolset.Core | |||
183 | // warn about deprecated syntax of $(loc.var) | 183 | // warn about deprecated syntax of $(loc.var) |
184 | if ('$' == sb[matches[i].Index]) | 184 | if ('$' == sb[matches[i].Index]) |
185 | { | 185 | { |
186 | Messaging.Instance.OnMessage(WixWarnings.DeprecatedLocalizationVariablePrefix(sourceLineNumbers, variableId)); | 186 | this.Messaging.Write(WarningMessages.DeprecatedLocalizationVariablePrefix(sourceLineNumbers, variableId)); |
187 | } | 187 | } |
188 | 188 | ||
189 | resolvedValue = this.Localizer?.GetLocalizedValue(variableId); | 189 | resolvedValue = this.Localizer?.GetLocalizedValue(variableId); |
@@ -193,7 +193,7 @@ namespace WixToolset.Core | |||
193 | // illegal syntax of $(wix.var) | 193 | // illegal syntax of $(wix.var) |
194 | if ('$' == sb[matches[i].Index]) | 194 | if ('$' == sb[matches[i].Index]) |
195 | { | 195 | { |
196 | Messaging.Instance.OnMessage(WixErrors.IllegalWixVariablePrefix(sourceLineNumbers, variableId)); | 196 | this.Messaging.Write(ErrorMessages.IllegalWixVariablePrefix(sourceLineNumbers, variableId)); |
197 | } | 197 | } |
198 | else | 198 | else |
199 | { | 199 | { |
@@ -225,11 +225,11 @@ namespace WixToolset.Core | |||
225 | } | 225 | } |
226 | else if ("loc" == variableNamespace && errorOnUnknown) // unresolved loc variable | 226 | else if ("loc" == variableNamespace && errorOnUnknown) // unresolved loc variable |
227 | { | 227 | { |
228 | Messaging.Instance.OnMessage(WixErrors.LocalizationVariableUnknown(sourceLineNumbers, variableId)); | 228 | this.Messaging.Write(ErrorMessages.LocalizationVariableUnknown(sourceLineNumbers, variableId)); |
229 | } | 229 | } |
230 | else if (!localizationOnly && "wix" == variableNamespace && errorOnUnknown) // unresolved wix variable | 230 | else if (!localizationOnly && "wix" == variableNamespace && errorOnUnknown) // unresolved wix variable |
231 | { | 231 | { |
232 | Messaging.Instance.OnMessage(WixErrors.WixVariableUnknown(sourceLineNumbers, variableId)); | 232 | this.Messaging.Write(ErrorMessages.WixVariableUnknown(sourceLineNumbers, variableId)); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | } | 235 | } |
@@ -321,7 +321,7 @@ namespace WixToolset.Core | |||
321 | } | 321 | } |
322 | else | 322 | else |
323 | { | 323 | { |
324 | throw new WixException(WixErrors.UnresolvedBindReference(sourceLineNumbers, value)); | 324 | throw new WixException(ErrorMessages.UnresolvedBindReference(sourceLineNumbers, value)); |
325 | } | 325 | } |
326 | } | 326 | } |
327 | } | 327 | } |