aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Compiler.cs')
-rw-r--r--src/WixToolset.Core/Compiler.cs188
1 files changed, 0 insertions, 188 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index 5bd923dd..28290569 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -2319,14 +2319,6 @@ namespace WixToolset.Core
2319 case "Class": 2319 case "Class":
2320 this.ParseClassElement(child, id.Id, YesNoType.NotSet, null, null, null, null); 2320 this.ParseClassElement(child, id.Id, YesNoType.NotSet, null, null, null, null);
2321 break; 2321 break;
2322 case "Condition":
2323 if (null != condition)
2324 {
2325 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2326 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName));
2327 }
2328 condition = this.ParseConditionElement(child, node.Name.LocalName, null, null);
2329 break;
2330 case "CopyFile": 2322 case "CopyFile":
2331 this.ParseCopyFileElement(child, id.Id, null); 2323 this.ParseCopyFileElement(child, id.Id, null);
2332 break; 2324 break;
@@ -3382,17 +3374,12 @@ namespace WixToolset.Core
3382 win64 = true; 3374 win64 = true;
3383 } 3375 }
3384 3376
3385 // get the inner text if any exists
3386 var innerText = this.Core.GetTrimmedInnerText(node);
3387
3388 // if we have an in-lined Script CustomAction ensure no source or target attributes were provided 3377 // if we have an in-lined Script CustomAction ensure no source or target attributes were provided
3389 if (inlineScript) 3378 if (inlineScript)
3390 { 3379 {
3391 if (String.IsNullOrEmpty(scriptFile)) 3380 if (String.IsNullOrEmpty(scriptFile))
3392 { 3381 {
3393 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ScriptFile", "Script")); 3382 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ScriptFile", "Script"));
3394
3395 target = innerText;
3396 } 3383 }
3397 } 3384 }
3398 else if (CustomActionTargetType.VBScript == targetType) // non-inline vbscript 3385 else if (CustomActionTargetType.VBScript == targetType) // non-inline vbscript
@@ -3428,10 +3415,6 @@ namespace WixToolset.Core
3428 { 3415 {
3429 this.Core.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Value", "Directory", "Property", "Error")); 3416 this.Core.Write(ErrorMessages.IllegalAttributeWithoutOtherAttributes(sourceLineNumbers, node.Name.LocalName, "Value", "Directory", "Property", "Error"));
3430 } 3417 }
3431 else if (!String.IsNullOrEmpty(innerText)) // inner text cannot be specified with non-script CAs
3432 {
3433 this.Core.Write(ErrorMessages.CustomActionIllegalInnerText(sourceLineNumbers, node.Name.LocalName, innerText, "Script"));
3434 }
3435 3418
3436 if (!inlineScript && !String.IsNullOrEmpty(scriptFile)) 3419 if (!inlineScript && !String.IsNullOrEmpty(scriptFile))
3437 { 3420 {
@@ -4053,11 +4036,6 @@ namespace WixToolset.Core
4053 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Column")); 4036 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Column"));
4054 } 4037 }
4055 4038
4056 if (String.IsNullOrEmpty(data))
4057 {
4058 data = Common.GetInnerText(child);
4059 }
4060
4061 if (!this.Core.EncounteredError) 4039 if (!this.Core.EncounteredError)
4062 { 4040 {
4063 this.Core.AddTuple(new WixCustomTableCellTuple(childSourceLineNumbers, new Identifier(AccessModifier.Private, tableId, rowId, columnName)) 4041 this.Core.AddTuple(new WixCustomTableCellTuple(childSourceLineNumbers, new Identifier(AccessModifier.Private, tableId, rowId, columnName))
@@ -4864,9 +4842,6 @@ namespace WixToolset.Core
4864 case "Component": 4842 case "Component":
4865 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id.Id, null, CompilerConstants.IntegerNotSet, null, null); 4843 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id.Id, null, CompilerConstants.IntegerNotSet, null, null);
4866 break; 4844 break;
4867 case "Condition":
4868 this.ParseConditionElement(child, node.Name.LocalName, id.Id, null);
4869 break;
4870 case "Feature": 4845 case "Feature":
4871 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id.Id, ref childDisplay); 4846 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id.Id, ref childDisplay);
4872 break; 4847 break;
@@ -5368,11 +5343,6 @@ namespace WixToolset.Core
5368 id = CompilerConstants.IllegalInteger; 5343 id = CompilerConstants.IllegalInteger;
5369 } 5344 }
5370 5345
5371 if (String.IsNullOrEmpty(message))
5372 {
5373 message = Common.GetInnerText(node);
5374 }
5375
5376 this.Core.ParseForExtensionElements(node); 5346 this.Core.ParseForExtensionElements(node);
5377 5347
5378 if (!this.Core.EncounteredError) 5348 if (!this.Core.EncounteredError)
@@ -6232,9 +6202,6 @@ namespace WixToolset.Core
6232 case "ComponentGroup": 6202 case "ComponentGroup":
6233 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, id?.Id); 6203 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, id?.Id);
6234 break; 6204 break;
6235 case "Condition":
6236 this.ParseConditionElement(child, node.Name.LocalName, null, null);
6237 break;
6238 case "Container": 6205 case "Container":
6239 this.ParseContainerElement(child); 6206 this.ParseContainerElement(child);
6240 break; 6207 break;
@@ -6419,161 +6386,6 @@ namespace WixToolset.Core
6419 } 6386 }
6420 6387
6421 /// <summary> 6388 /// <summary>
6422 /// Parses a condition element.
6423 /// </summary>
6424 /// <param name="node">Element to parse.</param>
6425 /// <param name="parentElementLocalName">LocalName of the parent element.</param>
6426 /// <param name="id">Id of the parent element.</param>
6427 /// <param name="dialog">Dialog of the parent element if its a Control.</param>
6428 /// <returns>The condition if one was found.</returns>
6429 private string ParseConditionElement(XElement node, string parentElementLocalName, string id, string dialog)
6430 {
6431 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6432 string action = null;
6433 string condition = null;
6434 var level = CompilerConstants.IntegerNotSet;
6435 string message = null;
6436
6437 foreach (var attrib in node.Attributes())
6438 {
6439 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6440 {
6441 switch (attrib.Name.LocalName)
6442 {
6443 case "Action":
6444 if ("Control" == parentElementLocalName)
6445 {
6446 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6447 switch (action)
6448 {
6449 case "default":
6450 action = "Default";
6451 break;
6452 case "disable":
6453 action = "Disable";
6454 break;
6455 case "enable":
6456 action = "Enable";
6457 break;
6458 case "hide":
6459 action = "Hide";
6460 break;
6461 case "show":
6462 action = "Show";
6463 break;
6464 case "":
6465 break;
6466 default:
6467 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "default", "disable", "enable", "hide", "show"));
6468 break;
6469 }
6470 }
6471 else
6472 {
6473 this.Core.UnexpectedAttribute(node, attrib);
6474 }
6475 break;
6476 case "Level":
6477 if ("Feature" == parentElementLocalName)
6478 {
6479 level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
6480 }
6481 else
6482 {
6483 this.Core.UnexpectedAttribute(node, attrib);
6484 }
6485 break;
6486 case "Message":
6487 if ("Fragment" == parentElementLocalName || "Product" == parentElementLocalName)
6488 {
6489 message = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6490 }
6491 else
6492 {
6493 this.Core.UnexpectedAttribute(node, attrib);
6494 }
6495 break;
6496 default:
6497 this.Core.UnexpectedAttribute(node, attrib);
6498 break;
6499 }
6500 }
6501 else
6502 {
6503 this.Core.ParseExtensionAttribute(node, attrib);
6504 }
6505 }
6506
6507 // get the condition from the inner text of the element
6508 condition = this.Core.GetConditionInnerText(node);
6509
6510 this.Core.ParseForExtensionElements(node);
6511
6512 // the condition should not be empty
6513 if (null == condition || 0 == condition.Length)
6514 {
6515 condition = null;
6516 this.Core.Write(ErrorMessages.ConditionExpected(sourceLineNumbers, node.Name.LocalName));
6517 }
6518
6519 switch (parentElementLocalName)
6520 {
6521 case "Control":
6522 if (null == action)
6523 {
6524 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action"));
6525 }
6526
6527 if (!this.Core.EncounteredError)
6528 {
6529 this.Core.AddTuple(new ControlConditionTuple(sourceLineNumbers)
6530 {
6531 DialogRef = dialog,
6532 ControlRef = id,
6533 Action = action,
6534 Condition = condition,
6535 });
6536 }
6537 break;
6538 case "Feature":
6539 if (CompilerConstants.IntegerNotSet == level)
6540 {
6541 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level"));
6542 level = CompilerConstants.IllegalInteger;
6543 }
6544
6545 if (!this.Core.EncounteredError)
6546 {
6547 this.Core.AddTuple(new ConditionTuple(sourceLineNumbers)
6548 {
6549 FeatureRef = id,
6550 Level = level,
6551 Condition = condition
6552 });
6553 }
6554 break;
6555 case "Fragment":
6556 case "Product":
6557 if (null == message)
6558 {
6559 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message"));
6560 }
6561
6562 if (!this.Core.EncounteredError)
6563 {
6564 this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers)
6565 {
6566 Condition = condition,
6567 Description = message
6568 });
6569 }
6570 break;
6571 }
6572
6573 return condition;
6574 }
6575
6576 /// <summary>
6577 /// Parses a IniFile element. 6389 /// Parses a IniFile element.
6578 /// </summary> 6390 /// </summary>
6579 /// <param name="node">Element to parse.</param> 6391 /// <param name="node">Element to parse.</param>