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/ExtensibilityServices/PreprocessHelper.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/ExtensibilityServices/PreprocessHelper.cs')
-rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs index bcbd6a67..0e3e0bfd 100644 --- a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs | |||
@@ -42,7 +42,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
42 | { | 42 | { |
43 | if (showWarning) | 43 | if (showWarning) |
44 | { | 44 | { |
45 | context.Messaging.OnMessage(WixWarnings.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue)); | 45 | context.Messaging.Write(WarningMessages.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue)); |
46 | } | 46 | } |
47 | 47 | ||
48 | context.Variables[name] = value; | 48 | context.Variables[name] = value; |
@@ -56,7 +56,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
56 | // Check to make sure there are 2 parts and neither is an empty string. | 56 | // Check to make sure there are 2 parts and neither is an empty string. |
57 | if (2 != prefixParts.Length || 0 >= prefixParts[0].Length || 0 >= prefixParts[1].Length) | 57 | if (2 != prefixParts.Length || 0 >= prefixParts[0].Length || 0 >= prefixParts[1].Length) |
58 | { | 58 | { |
59 | throw new WixException(WixErrors.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, function)); | 59 | throw new WixException(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, function)); |
60 | } | 60 | } |
61 | 61 | ||
62 | var prefix = prefixParts[0]; | 62 | var prefix = prefixParts[0]; |
@@ -65,7 +65,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
65 | // Check to make sure there are 2 parts, neither is an empty string, and the second part ends with a closing paren. | 65 | // Check to make sure there are 2 parts, neither is an empty string, and the second part ends with a closing paren. |
66 | if (2 != functionParts.Length || 0 >= functionParts[0].Length || 0 >= functionParts[1].Length || !functionParts[1].EndsWith(")", StringComparison.Ordinal)) | 66 | if (2 != functionParts.Length || 0 >= functionParts[0].Length || 0 >= functionParts[1].Length || !functionParts[1].EndsWith(")", StringComparison.Ordinal)) |
67 | { | 67 | { |
68 | throw new WixException(WixErrors.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, function)); | 68 | throw new WixException(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, function)); |
69 | } | 69 | } |
70 | 70 | ||
71 | var functionName = functionParts[0]; | 71 | var functionName = functionParts[0]; |
@@ -113,7 +113,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
113 | // Make sure the base version is specified | 113 | // Make sure the base version is specified |
114 | if (args.Length == 0 || String.IsNullOrEmpty(args[0])) | 114 | if (args.Length == 0 || String.IsNullOrEmpty(args[0])) |
115 | { | 115 | { |
116 | throw new WixException(WixErrors.InvalidPreprocessorFunctionAutoVersion(context.CurrentSourceLineNumber)); | 116 | throw new WixException(ErrorMessages.InvalidPreprocessorFunctionAutoVersion(context.CurrentSourceLineNumber)); |
117 | } | 117 | } |
118 | 118 | ||
119 | // Build = days since 1/1/2000; Revision = seconds since midnight / 2 | 119 | // Build = days since 1/1/2000; Revision = seconds since midnight / 2 |
@@ -137,7 +137,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
137 | } | 137 | } |
138 | catch (Exception e) | 138 | catch (Exception e) |
139 | { | 139 | { |
140 | throw new WixException(WixErrors.PreprocessorExtensionEvaluateFunctionFailed(context.CurrentSourceLineNumber, prefix, function, String.Join(",", args), e.Message)); | 140 | throw new WixException(ErrorMessages.PreprocessorExtensionEvaluateFunctionFailed(context.CurrentSourceLineNumber, prefix, function, String.Join(",", args), e.Message)); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | else | 143 | else |
@@ -165,7 +165,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | throw new WixException(WixErrors.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, variable)); | 168 | throw new WixException(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, variable)); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | else | 171 | else |
@@ -185,7 +185,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | throw new WixException(WixErrors.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, variable)); | 188 | throw new WixException(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, variable)); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
@@ -220,7 +220,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
220 | return context.CurrentSourceLineNumber.FileName; | 220 | return context.CurrentSourceLineNumber.FileName; |
221 | 221 | ||
222 | case "PLATFORM": | 222 | case "PLATFORM": |
223 | context.Messaging.OnMessage(WixWarnings.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)")); | 223 | context.Messaging.Write(WarningMessages.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)")); |
224 | 224 | ||
225 | goto case "BUILDARCH"; | 225 | goto case "BUILDARCH"; |
226 | 226 | ||
@@ -260,7 +260,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
260 | } | 260 | } |
261 | catch (Exception e) | 261 | catch (Exception e) |
262 | { | 262 | { |
263 | throw new WixException(WixErrors.PreprocessorExtensionGetVariableValueFailed(context.CurrentSourceLineNumber, prefix, name, e.Message)); | 263 | throw new WixException(ErrorMessages.PreprocessorExtensionGetVariableValueFailed(context.CurrentSourceLineNumber, prefix, name, e.Message)); |
264 | } | 264 | } |
265 | } | 265 | } |
266 | else | 266 | else |
@@ -277,7 +277,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
277 | // Check to make sure there are 2 parts and neither is an empty string. | 277 | // Check to make sure there are 2 parts and neither is an empty string. |
278 | if (2 != prefixParts.Length) | 278 | if (2 != prefixParts.Length) |
279 | { | 279 | { |
280 | throw new WixException(WixErrors.InvalidPreprocessorPragma(context.CurrentSourceLineNumber, pragmaName)); | 280 | throw new WixException(ErrorMessages.InvalidPreprocessorPragma(context.CurrentSourceLineNumber, pragmaName)); |
281 | } | 281 | } |
282 | 282 | ||
283 | var prefix = prefixParts[0]; | 283 | var prefix = prefixParts[0]; |
@@ -285,7 +285,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
285 | 285 | ||
286 | if (String.IsNullOrEmpty(prefix) || String.IsNullOrEmpty(pragma)) | 286 | if (String.IsNullOrEmpty(prefix) || String.IsNullOrEmpty(pragma)) |
287 | { | 287 | { |
288 | throw new WixException(WixErrors.InvalidPreprocessorPragma(context.CurrentSourceLineNumber, pragmaName)); | 288 | throw new WixException(ErrorMessages.InvalidPreprocessorPragma(context.CurrentSourceLineNumber, pragmaName)); |
289 | } | 289 | } |
290 | 290 | ||
291 | switch (prefix) | 291 | switch (prefix) |
@@ -295,7 +295,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
295 | { | 295 | { |
296 | // Add any core defined pragmas here | 296 | // Add any core defined pragmas here |
297 | default: | 297 | default: |
298 | context.Messaging.OnMessage(WixWarnings.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); | 298 | context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); |
299 | break; | 299 | break; |
300 | } | 300 | } |
301 | break; | 301 | break; |
@@ -306,7 +306,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
306 | { | 306 | { |
307 | if (!extension.ProcessPragma(prefix, pragma, args, parent)) | 307 | if (!extension.ProcessPragma(prefix, pragma, args, parent)) |
308 | { | 308 | { |
309 | context.Messaging.OnMessage(WixWarnings.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); | 309 | context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | break; | 312 | break; |
@@ -339,7 +339,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
339 | currentPosition = remainder.IndexOf(')'); | 339 | currentPosition = remainder.IndexOf(')'); |
340 | if (-1 == currentPosition) | 340 | if (-1 == currentPosition) |
341 | { | 341 | { |
342 | context.Messaging.OnMessage(WixErrors.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); | 342 | context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); |
343 | break; | 343 | break; |
344 | } | 344 | } |
345 | 345 | ||
@@ -385,12 +385,12 @@ namespace WixToolset.Core.ExtensibilityServices | |||
385 | { | 385 | { |
386 | if (isFunction) | 386 | if (isFunction) |
387 | { | 387 | { |
388 | context.Messaging.OnMessage(WixErrors.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder)); | 388 | context.Messaging.Write(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder)); |
389 | break; | 389 | break; |
390 | } | 390 | } |
391 | else | 391 | else |
392 | { | 392 | { |
393 | context.Messaging.OnMessage(WixErrors.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); | 393 | context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); |
394 | break; | 394 | break; |
395 | } | 395 | } |
396 | } | 396 | } |
@@ -410,12 +410,12 @@ namespace WixToolset.Core.ExtensibilityServices | |||
410 | { | 410 | { |
411 | if (isFunction) | 411 | if (isFunction) |
412 | { | 412 | { |
413 | context.Messaging.OnMessage(WixErrors.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString)); | 413 | context.Messaging.Write(ErrorMessages.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString)); |
414 | break; | 414 | break; |
415 | } | 415 | } |
416 | else | 416 | else |
417 | { | 417 | { |
418 | context.Messaging.OnMessage(WixErrors.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString)); | 418 | context.Messaging.Write(ErrorMessages.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString)); |
419 | break; | 419 | break; |
420 | } | 420 | } |
421 | } | 421 | } |
@@ -448,7 +448,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
448 | { | 448 | { |
449 | if (!context.Variables.Remove(name)) | 449 | if (!context.Variables.Remove(name)) |
450 | { | 450 | { |
451 | context.Messaging.OnMessage(WixErrors.CannotReundefineVariable(context.CurrentSourceLineNumber, name)); | 451 | context.Messaging.Write(ErrorMessages.CannotReundefineVariable(context.CurrentSourceLineNumber, name)); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||