diff options
Diffstat (limited to 'src/WixToolset.Converters/WixConverter.cs')
-rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index 7ac64710..86a1bfba 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
@@ -416,8 +416,9 @@ namespace WixToolset.Converters | |||
416 | 416 | ||
417 | private void ConvertControlElement(XElement element) | 417 | private void ConvertControlElement(XElement element) |
418 | { | 418 | { |
419 | var xCondition = element.Element(ConditionElementName); | 419 | var remove = new List<XElement>(); |
420 | if (xCondition != null) | 420 | |
421 | foreach (var xCondition in element.Elements(ConditionElementName)) | ||
421 | { | 422 | { |
422 | var action = UppercaseFirstChar(xCondition.Attribute("Action")?.Value); | 423 | var action = UppercaseFirstChar(xCondition.Attribute("Action")?.Value); |
423 | if (!String.IsNullOrEmpty(action) && | 424 | if (!String.IsNullOrEmpty(action) && |
@@ -425,9 +426,14 @@ namespace WixToolset.Converters | |||
425 | this.OnError(ConverterTestType.InnerTextDeprecated, element, "Using {0} element text is deprecated. Use the '{1}Condition' attribute instead.", xCondition.Name.LocalName, action)) | 426 | this.OnError(ConverterTestType.InnerTextDeprecated, element, "Using {0} element text is deprecated. Use the '{1}Condition' attribute instead.", xCondition.Name.LocalName, action)) |
426 | { | 427 | { |
427 | element.Add(new XAttribute(action + "Condition", text)); | 428 | element.Add(new XAttribute(action + "Condition", text)); |
428 | xCondition.Remove(); | 429 | remove.Add(xCondition); |
429 | } | 430 | } |
430 | } | 431 | } |
432 | |||
433 | for (var i = remove.Count - 1; i >= 0; i--) | ||
434 | { | ||
435 | remove[i].Remove(); | ||
436 | } | ||
431 | } | 437 | } |
432 | 438 | ||
433 | private void ConvertComponentElement(XElement element) | 439 | private void ConvertComponentElement(XElement element) |
@@ -517,8 +523,9 @@ namespace WixToolset.Converters | |||
517 | 523 | ||
518 | private void ConvertFragmentElement(XElement element) | 524 | private void ConvertFragmentElement(XElement element) |
519 | { | 525 | { |
520 | var xCondition = element.Element(ConditionElementName); | 526 | var remove = new List<XElement>(); |
521 | if (xCondition != null) | 527 | |
528 | foreach (var xCondition in element.Elements(ConditionElementName)) | ||
522 | { | 529 | { |
523 | var message = xCondition.Attribute("Message")?.Value; | 530 | var message = xCondition.Attribute("Message")?.Value; |
524 | 531 | ||
@@ -530,9 +537,14 @@ namespace WixToolset.Converters | |||
530 | new XAttribute("Condition", text), | 537 | new XAttribute("Condition", text), |
531 | new XAttribute("Message", message) | 538 | new XAttribute("Message", message) |
532 | )); | 539 | )); |
533 | xCondition.Remove(); | 540 | remove.Add(xCondition); |
534 | } | 541 | } |
535 | } | 542 | } |
543 | |||
544 | for (var i = remove.Count - 1; i >= 0; i--) | ||
545 | { | ||
546 | remove[i].Remove(); | ||
547 | } | ||
536 | } | 548 | } |
537 | 549 | ||
538 | private void ConvertEmbeddedChainerElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Condition"); | 550 | private void ConvertEmbeddedChainerElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Condition"); |