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/Converter.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/Converter.cs')
-rw-r--r-- | src/WixToolset.Core/Converter.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/WixToolset.Core/Converter.cs b/src/WixToolset.Core/Converter.cs index c0297758..fd925f7a 100644 --- a/src/WixToolset.Core/Converter.cs +++ b/src/WixToolset.Core/Converter.cs | |||
@@ -10,6 +10,7 @@ namespace WixToolset.Core | |||
10 | using System.Xml; | 10 | using System.Xml; |
11 | using System.Xml.Linq; | 11 | using System.Xml.Linq; |
12 | using WixToolset.Data; | 12 | using WixToolset.Data; |
13 | using WixToolset.Extensibility.Services; | ||
13 | 14 | ||
14 | /// <summary> | 15 | /// <summary> |
15 | /// WiX source code converter. | 16 | /// WiX source code converter. |
@@ -64,7 +65,7 @@ namespace WixToolset.Core | |||
64 | /// <param name="indentationAmount">Indentation value to use when validating leading whitespace.</param> | 65 | /// <param name="indentationAmount">Indentation value to use when validating leading whitespace.</param> |
65 | /// <param name="errorsAsWarnings">Test errors to display as warnings.</param> | 66 | /// <param name="errorsAsWarnings">Test errors to display as warnings.</param> |
66 | /// <param name="ignoreErrors">Test errors to ignore.</param> | 67 | /// <param name="ignoreErrors">Test errors to ignore.</param> |
67 | public Converter(int indentationAmount, IEnumerable<string> errorsAsWarnings = null, IEnumerable<string> ignoreErrors = null) | 68 | public Converter(IMessaging messaging, int indentationAmount, IEnumerable<string> errorsAsWarnings = null, IEnumerable<string> ignoreErrors = null) |
68 | { | 69 | { |
69 | this.ConvertElementMapping = new Dictionary<XName, Action<XElement>>() | 70 | this.ConvertElementMapping = new Dictionary<XName, Action<XElement>>() |
70 | { | 71 | { |
@@ -77,6 +78,8 @@ namespace WixToolset.Core | |||
77 | { WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace }, | 78 | { WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace }, |
78 | }; | 79 | }; |
79 | 80 | ||
81 | this.Messaging = messaging; | ||
82 | |||
80 | this.IndentationAmount = indentationAmount; | 83 | this.IndentationAmount = indentationAmount; |
81 | 84 | ||
82 | this.ErrorsAsWarnings = new HashSet<ConverterTestType>(this.YieldConverterTypes(errorsAsWarnings)); | 85 | this.ErrorsAsWarnings = new HashSet<ConverterTestType>(this.YieldConverterTypes(errorsAsWarnings)); |
@@ -90,6 +93,8 @@ namespace WixToolset.Core | |||
90 | 93 | ||
91 | private HashSet<ConverterTestType> IgnoreErrors { get; set; } | 94 | private HashSet<ConverterTestType> IgnoreErrors { get; set; } |
92 | 95 | ||
96 | private IMessaging Messaging { get; } | ||
97 | |||
93 | private int IndentationAmount { get; set; } | 98 | private int IndentationAmount { get; set; } |
94 | 99 | ||
95 | private string SourceFile { get; set; } | 100 | private string SourceFile { get; set; } |
@@ -528,9 +533,9 @@ namespace WixToolset.Core | |||
528 | bool warning = this.ErrorsAsWarnings.Contains(converterTestType); | 533 | bool warning = this.ErrorsAsWarnings.Contains(converterTestType); |
529 | string display = String.Format(CultureInfo.CurrentCulture, message, args); | 534 | string display = String.Format(CultureInfo.CurrentCulture, message, args); |
530 | 535 | ||
531 | WixGenericMessageEventArgs ea = new WixGenericMessageEventArgs(sourceLine, (int)converterTestType, warning ? MessageLevel.Warning : MessageLevel.Error, "{0} ({1})", display, converterTestType.ToString()); | 536 | var msg = new Message(sourceLine, warning ? MessageLevel.Warning : MessageLevel.Error, (int)converterTestType, "{0} ({1})", display, converterTestType.ToString()); |
532 | 537 | ||
533 | Messaging.Instance.OnMessage(ea); | 538 | this.Messaging.Write(msg); |
534 | 539 | ||
535 | return true; | 540 | return true; |
536 | } | 541 | } |