/Microsoft.Build/Microsoft.Build/Microsoft/Build/Construction/ProjectParser.cs
C# | 540 lines | 501 code | 39 blank | 0 comment | 72 complexity | 8ca0b0456833d1085890dc3d0b08fd98 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-3.0
- namespace Microsoft.Build.Construction
- {
- using Microsoft.Build.Evaluation;
- using Microsoft.Build.Internal;
- using Microsoft.Build.Shared;
- using Microsoft.Internal.Performance;
- using System;
- using System.Collections.Generic;
- using System.Xml;
-
- internal class ProjectParser
- {
- private XmlDocumentWithLocation document;
- internal const int MaximumChooseNesting = 50;
- private ProjectRootElement project;
- private bool seenProjectExtensions;
- private static readonly string[] validAttributesOnImport = new string[] { "Condition", "Label", "Project" };
- private static readonly string[] validAttributesOnItem = new string[] { "Condition", "Label", "Include", "Exclude", "Remove" };
- private static readonly string[] validAttributesOnlyConditionAndLabel = new string[] { "Condition", "Label" };
- private static readonly string[] validAttributesOnOnError = new string[] { "Condition", "Label", "ExecuteTargets" };
- private static readonly string[] validAttributesOnOutput = new string[] { "Condition", "Label", "TaskParameter", "ItemName", "PropertyName" };
- private static readonly string[] validAttributesOnTarget = new string[] { "Condition", "Label", "Name", "Inputs", "Outputs", "KeepDuplicateOutputs", "DependsOnTargets", "BeforeTargets", "AfterTargets", "Returns" };
- private static readonly string[] validAttributesOnUsingTask = new string[] { "Condition", "Label", "TaskName", "AssemblyFile", "AssemblyName", "TaskFactory", "RequiredPlatform", "RequiredRuntime" };
- private static readonly string[] validAttributesOnUsingTaskBody = new string[] { "Evaluate" };
- private static readonly string[] validAttributesOnUsingTaskParameter = new string[] { "ParameterType", "Output", "Required" };
-
- private ProjectParser(XmlDocumentWithLocation document, ProjectRootElement project)
- {
- ErrorUtilities.VerifyThrowInternalNull(project, "project");
- ErrorUtilities.VerifyThrowInternalNull(document, "document");
- this.document = document;
- this.project = project;
- }
-
- private void Parse()
- {
- XmlElementWithLocation element = null;
- foreach (XmlNode node in this.document.ChildNodes)
- {
- if (node.NodeType == XmlNodeType.Element)
- {
- element = (XmlElementWithLocation) node;
- break;
- }
- }
- ProjectErrorUtilities.VerifyThrowInvalidProject(element != null, new ElementLocation(this.document.FullPath), "NoRootProjectElement", "Project");
- ProjectErrorUtilities.VerifyThrowInvalidProject(element.Name != "VisualStudioProject", element.Location, "ProjectUpgradeNeeded", this.project.FullPath);
- ProjectErrorUtilities.VerifyThrowInvalidProject(element.LocalName == "Project", element.Location, "UnrecognizedElement", element.Name);
- if ((element.Prefix.Length > 0) || !string.Equals(element.NamespaceURI, "http://schemas.microsoft.com/developer/msbuild/2003", StringComparison.OrdinalIgnoreCase))
- {
- ProjectErrorUtilities.ThrowInvalidProject(element.Location, "ProjectMustBeInMSBuildXmlNamespace", "http://schemas.microsoft.com/developer/msbuild/2003");
- }
- this.ParseProjectElement(element);
- }
-
- internal static void Parse(XmlDocumentWithLocation document, ProjectRootElement projectRootElement)
- {
- using (new Microsoft.Internal.Performance.CodeMarkerStartEnd(Microsoft.Internal.Performance.CodeMarkerEvent.perfMSBuildProjectConstructBegin, Microsoft.Internal.Performance.CodeMarkerEvent.perfMSBuildProjectConstructEnd))
- {
- new ProjectParser(document, projectRootElement).Parse();
- }
- }
-
- private ProjectChooseElement ParseProjectChooseElement(XmlElementWithLocation element, ProjectElementContainer parent, int nestingDepth)
- {
- ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element);
- ProjectChooseElement element2 = new ProjectChooseElement(element, parent, this.project);
- nestingDepth++;
- ProjectErrorUtilities.VerifyThrowInvalidProject(nestingDepth <= 50, element.Location, "ChooseOverflow", 50);
- bool condition = false;
- bool flag2 = false;
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectElement child = null;
- string name = location.Name;
- if (name == null)
- {
- goto Label_00C8;
- }
- if (!(name == "When"))
- {
- if (name == "Otherwise")
- {
- goto Label_00A5;
- }
- goto Label_00C8;
- }
- ProjectErrorUtilities.VerifyThrowInvalidProject(!flag2, location.Location, "WhenNotAllowedAfterOtherwise");
- child = this.ParseProjectWhenElement(location, element2, nestingDepth);
- condition = true;
- goto Label_00DF;
- Label_00A5:
- ProjectErrorUtilities.VerifyThrowInvalidProject(!flag2, location.Location, "MultipleOtherwise");
- flag2 = true;
- child = this.ParseProjectOtherwiseElement(location, element2, nestingDepth);
- goto Label_00DF;
- Label_00C8:
- ProjectXmlUtilities.ThrowProjectInvalidChildElement(location.Name, element.Name, element.Location);
- Label_00DF:
- element2.AppendParentedChildNoChecks(child);
- }
- nestingDepth--;
- ProjectErrorUtilities.VerifyThrowInvalidProject(condition, element.Location, "ChooseMustContainWhen");
- return element2;
- }
-
- private void ParseProjectElement(XmlElementWithLocation element)
- {
- this.project.SetProjectRootElementFromParser(element, this.project);
- this.ParseProjectRootElementChildren(element);
- }
-
- private ProjectExtensionsElement ParseProjectExtensionsElement(XmlElementWithLocation element)
- {
- ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element);
- ProjectErrorUtilities.VerifyThrowInvalidProject(!this.seenProjectExtensions, element.Location, "DuplicateProjectExtensions");
- this.seenProjectExtensions = true;
- return new ProjectExtensionsElement(element, this.project, this.project);
- }
-
- private ProjectImportElement ParseProjectImportElement(XmlElementWithLocation element, ProjectElementContainer parent)
- {
- ProjectErrorUtilities.VerifyThrowInvalidProject((parent is ProjectRootElement) || (parent is ProjectImportGroupElement), element.Location, "UnrecognizedParentElement", parent, element);
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnImport);
- ProjectXmlUtilities.VerifyThrowProjectRequiredAttribute(element, "Project");
- ProjectXmlUtilities.VerifyThrowProjectNoChildElements(element);
- return new ProjectImportElement(element, parent, this.project);
- }
-
- private ProjectImportGroupElement ParseProjectImportGroupElement(XmlElementWithLocation element, ProjectRootElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- ProjectImportGroupElement element2 = new ProjectImportGroupElement(element, parent, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectErrorUtilities.VerifyThrowInvalidProject(location.Name == "Import", location.Location, "UnrecognizedChildElement", location.Name, element.Name);
- ProjectImportElement child = this.ParseProjectImportElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private ProjectItemDefinitionGroupElement ParseProjectItemDefinitionGroupElement(XmlElementWithLocation element)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- ProjectItemDefinitionGroupElement parent = new ProjectItemDefinitionGroupElement(element, this.project, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectItemDefinitionElement child = this.ParseProjectItemDefinitionXml(location, parent);
- parent.AppendParentedChildNoChecks(child);
- }
- return parent;
- }
-
- private ProjectItemDefinitionElement ParseProjectItemDefinitionXml(XmlElementWithLocation element, ProjectItemDefinitionGroupElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- ProjectItemDefinitionElement element2 = new ProjectItemDefinitionElement(element, parent, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectMetadataElement child = this.ParseProjectMetadataElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private ProjectItemElement ParseProjectItemElement(XmlElementWithLocation element, ProjectItemGroupElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnItem);
- bool flag = parent.Parent is ProjectTargetElement;
- string name = element.Name;
- string attribute = element.GetAttribute("Include");
- string str3 = element.GetAttribute("Exclude");
- ProjectXmlUtilities.VerifyThrowProjectInvalidAttribute((element.GetAttribute("Remove").Length == 0) || (flag && (attribute.Length == 0)), (XmlAttributeWithLocation) element.Attributes["Remove"]);
- ProjectErrorUtilities.VerifyThrowInvalidProject((attribute.Length > 0) || flag, element.Location, "MissingRequiredAttribute", "Include", name);
- ProjectXmlUtilities.VerifyThrowProjectInvalidAttribute((str3.Length == 0) || (attribute.Length > 0), (XmlAttributeWithLocation) element.Attributes["Exclude"]);
- ProjectErrorUtilities.VerifyThrowInvalidProject((attribute.Length > 0) || (element.Attributes["Include"] == null), element.Location, "MissingRequiredAttribute", "Include", name);
- XmlUtilities.VerifyThrowProjectValidElementName(element);
- ProjectErrorUtilities.VerifyThrowInvalidProject(XMakeElements.IllegalItemPropertyNames[name] == null, element.Location, "CannotModifyReservedItem", name);
- ProjectItemElement element2 = new ProjectItemElement(element, parent, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectMetadataElement child = this.ParseProjectMetadataElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private ProjectItemGroupElement ParseProjectItemGroupElement(XmlElementWithLocation element, ProjectElementContainer parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- ProjectItemGroupElement element2 = new ProjectItemGroupElement(element, parent, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectItemElement child = this.ParseProjectItemElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private ProjectMetadataElement ParseProjectMetadataElement(XmlElementWithLocation element, ProjectElementContainer parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- XmlUtilities.VerifyThrowProjectValidElementName(element);
- ProjectErrorUtilities.VerifyThrowInvalidProject(!(parent is ProjectItemElement) || (((ProjectItemElement) parent).Remove.Length == 0), element.Location, "ChildElementsBelowRemoveNotAllowed");
- ProjectErrorUtilities.VerifyThrowInvalidProject(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(element.Name), element.Location, "ItemSpecModifierCannotBeCustomMetadata", element.Name);
- ProjectErrorUtilities.VerifyThrowInvalidProject(XMakeElements.IllegalItemPropertyNames[element.Name] == null, element.Location, "CannotModifyReservedItemMetadata", element.Name);
- ProjectMetadataElement element2 = new ProjectMetadataElement(element, parent, this.project);
- if (parent is ProjectItemDefinitionElement)
- {
- ProjectErrorUtilities.VerifyThrowInvalidProject(!Expander<ProjectProperty, ProjectItem>.ExpressionContainsItemVector(element2.Value), element.Location, "MetadataDefinitionCannotContainItemVectorExpression", element2.Value, element2.Name);
- }
- return element2;
- }
-
- private ProjectOnErrorElement ParseProjectOnErrorElement(XmlElementWithLocation element, ProjectTargetElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnOnError);
- ProjectXmlUtilities.VerifyThrowProjectRequiredAttribute(element, "ExecuteTargets");
- ProjectXmlUtilities.VerifyThrowProjectNoChildElements(element);
- return new ProjectOnErrorElement(element, parent, this.project);
- }
-
- private ProjectOtherwiseElement ParseProjectOtherwiseElement(XmlElementWithLocation element, ProjectChooseElement parent, int nestingDepth)
- {
- ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element);
- ProjectOtherwiseElement element2 = new ProjectOtherwiseElement(element, parent, this.project);
- this.ParseWhenOtherwiseChildren(element, element2, nestingDepth);
- return element2;
- }
-
- private ProjectOutputElement ParseProjectOutputElement(XmlElementWithLocation element, ProjectTaskElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnOutput);
- ProjectXmlUtilities.VerifyThrowProjectRequiredAttribute(element, "TaskParameter");
- ProjectXmlUtilities.VerifyThrowProjectNoChildElements(element);
- element.GetAttribute("TaskParameter");
- string attribute = element.GetAttribute("ItemName");
- string str2 = element.GetAttribute("PropertyName");
- ProjectErrorUtilities.VerifyThrowInvalidProject(((attribute.Length > 0) || (str2.Length > 0)) && ((attribute.Length == 0) || (str2.Length == 0)), element.Location, "InvalidTaskOutputSpecification", parent.Name);
- ProjectXmlUtilities.VerifyThrowProjectAttributeEitherMissingOrNotEmpty(element, "ItemName");
- ProjectXmlUtilities.VerifyThrowProjectAttributeEitherMissingOrNotEmpty(element, "PropertyName");
- ProjectErrorUtilities.VerifyThrowInvalidProject(!ReservedPropertyNames.IsReservedProperty(str2), element.Location, "CannotModifyReservedProperty", str2);
- return new ProjectOutputElement(element, parent, this.project);
- }
-
- private ProjectPropertyElement ParseProjectPropertyElement(XmlElementWithLocation element, ProjectPropertyGroupElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- XmlUtilities.VerifyThrowProjectValidElementName(element);
- ProjectErrorUtilities.VerifyThrowInvalidProject((XMakeElements.IllegalItemPropertyNames[element.Name] == null) && !ReservedPropertyNames.IsReservedProperty(element.Name), element.Location, "CannotModifyReservedProperty", element.Name);
- return new ProjectPropertyElement(element, parent, this.project);
- }
-
- private ProjectPropertyGroupElement ParseProjectPropertyGroupElement(XmlElementWithLocation element, ProjectElementContainer parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnlyConditionAndLabel);
- ProjectPropertyGroupElement element2 = new ProjectPropertyGroupElement(element, parent, this.project);
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectPropertyElement child = this.ParseProjectPropertyElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private void ParseProjectRootElementChildren(XmlElementWithLocation element)
- {
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectElement child = null;
- switch (location.Name)
- {
- case "PropertyGroup":
- child = this.ParseProjectPropertyGroupElement(location, this.project);
- break;
-
- case "ItemGroup":
- child = this.ParseProjectItemGroupElement(location, this.project);
- break;
-
- case "ImportGroup":
- child = this.ParseProjectImportGroupElement(location, this.project);
- break;
-
- case "Import":
- child = this.ParseProjectImportElement(location, this.project);
- break;
-
- case "UsingTask":
- child = this.ParseProjectUsingTaskElement(location);
- break;
-
- case "Target":
- child = this.ParseProjectTargetElement(location);
- break;
-
- case "ItemDefinitionGroup":
- child = this.ParseProjectItemDefinitionGroupElement(location);
- break;
-
- case "Choose":
- child = this.ParseProjectChooseElement(location, this.project, 0);
- break;
-
- case "ProjectExtensions":
- child = this.ParseProjectExtensionsElement(location);
- break;
-
- case "Error":
- case "Warning":
- case "Message":
- ProjectErrorUtilities.ThrowInvalidProject(location.Location, "ErrorWarningMessageNotSupported", location.Name);
- break;
-
- default:
- ProjectXmlUtilities.ThrowProjectInvalidChildElement(location.Name, location.ParentNode.Name, location.Location);
- break;
- }
- this.project.AppendParentedChildNoChecks(child);
- }
- }
-
- private ProjectTargetElement ParseProjectTargetElement(XmlElementWithLocation element)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnTarget);
- ProjectXmlUtilities.VerifyThrowProjectRequiredAttribute(element, "Name");
- string str = EscapingUtilities.UnescapeAll(ProjectXmlUtilities.GetAttributeValue(element, "Name"));
- int num = str.IndexOfAny(XMakeElements.illegalTargetNameCharacters);
- if (num >= 0)
- {
- ProjectErrorUtilities.ThrowInvalidProject(element.GetAttributeLocation("Name"), "NameInvalid", str, str[num]);
- }
- ProjectTargetElement parent = new ProjectTargetElement(element, this.project, this.project);
- ProjectOnErrorElement element3 = null;
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectElement child = null;
- string name = location.Name;
- if (name == null)
- {
- goto Label_0168;
- }
- if (!(name == "PropertyGroup"))
- {
- if (name == "ItemGroup")
- {
- goto Label_010E;
- }
- if (name == "OnError")
- {
- goto Label_013F;
- }
- if (name == "ItemDefinitionGroup")
- {
- goto Label_014E;
- }
- goto Label_0168;
- }
- if (element3 != null)
- {
- ProjectErrorUtilities.ThrowInvalidProject(element3.Location, "NodeMustBeLastUnderElement", "OnError", "Target", location.Name);
- }
- child = this.ParseProjectPropertyGroupElement(location, parent);
- goto Label_0197;
- Label_010E:
- if (element3 != null)
- {
- ProjectErrorUtilities.ThrowInvalidProject(element3.Location, "NodeMustBeLastUnderElement", "OnError", "Target", location.Name);
- }
- child = this.ParseProjectItemGroupElement(location, parent);
- goto Label_0197;
- Label_013F:
- element3 = this.ParseProjectOnErrorElement(location, parent);
- child = element3;
- goto Label_0197;
- Label_014E:
- ProjectErrorUtilities.ThrowInvalidProject(location.Location, "ItemDefinitionGroupNotLegalInsideTarget", location.Name);
- goto Label_0197;
- Label_0168:
- if (element3 != null)
- {
- ProjectErrorUtilities.ThrowInvalidProject(element3.Location, "NodeMustBeLastUnderElement", "OnError", "Target", location.Name);
- }
- child = this.ParseProjectTaskElement(location, parent);
- Label_0197:
- parent.AppendParentedChildNoChecks(child);
- }
- return parent;
- }
-
- private ProjectTaskElement ParseProjectTaskElement(XmlElementWithLocation element, ProjectTargetElement parent)
- {
- foreach (XmlAttributeWithLocation location in element.Attributes)
- {
- ProjectErrorUtilities.VerifyThrowInvalidProject(!XMakeAttributes.IsBadlyCasedSpecialTaskAttribute(location.Name), location.Location, "BadlyCasedSpecialTaskAttribute", location.Name, element.Name, element.Name);
- }
- ProjectTaskElement element2 = new ProjectTaskElement(element, parent, this.project);
- foreach (XmlElementWithLocation location2 in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectErrorUtilities.VerifyThrowInvalidProject(location2.Name == "Output", location2.Location, "UnrecognizedChildElement", location2.Name, element2.Name);
- ProjectOutputElement child = this.ParseProjectOutputElement(location2, element2);
- element2.AppendParentedChildNoChecks(child);
- }
- return element2;
- }
-
- private ProjectUsingTaskElement ParseProjectUsingTaskElement(XmlElementWithLocation element)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnUsingTask);
- ProjectErrorUtilities.VerifyThrowInvalidProject(element.GetAttribute("TaskName").Length > 0, element.Location, "ProjectTaskNameEmpty");
- string attribute = element.GetAttribute("AssemblyName");
- string str2 = element.GetAttribute("AssemblyFile");
- ProjectErrorUtilities.VerifyThrowInvalidProject((attribute.Length > 0) ^ (str2.Length > 0), element.Location, "UsingTaskAssemblySpecification", "UsingTask", "AssemblyName", "AssemblyFile");
- ProjectXmlUtilities.VerifyThrowProjectAttributeEitherMissingOrNotEmpty(element, "AssemblyName");
- ProjectXmlUtilities.VerifyThrowProjectAttributeEitherMissingOrNotEmpty(element, "AssemblyFile");
- ProjectUsingTaskElement parent = new ProjectUsingTaskElement(element, this.project, this.project);
- bool flag = false;
- bool flag2 = false;
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectElement child = null;
- string name = location.Name;
- if (name == null)
- {
- goto Label_0126;
- }
- if (!(name == "ParameterGroup"))
- {
- if (name == "Task")
- {
- goto Label_010D;
- }
- goto Label_0126;
- }
- if (flag2)
- {
- ProjectXmlUtilities.ThrowProjectInvalidChildElementDueToDuplicate(location);
- }
- child = this.ParseUsingTaskParameterGroupElement(location, parent);
- flag2 = true;
- goto Label_013E;
- Label_010D:
- if (flag)
- {
- ProjectXmlUtilities.ThrowProjectInvalidChildElementDueToDuplicate(location);
- }
- child = this.ParseUsingTaskBodyElement(location, parent);
- flag = true;
- goto Label_013E;
- Label_0126:
- ProjectXmlUtilities.ThrowProjectInvalidChildElement(location.Name, element.Name, element.Location);
- Label_013E:
- parent.AppendParentedChildNoChecks(child);
- }
- return parent;
- }
-
- private ProjectWhenElement ParseProjectWhenElement(XmlElementWithLocation element, ProjectChooseElement parent, int nestingDepth)
- {
- ProjectXmlUtilities.VerifyThrowProjectRequiredAttribute(element, "Condition");
- ProjectWhenElement element2 = new ProjectWhenElement(element, parent, this.project);
- this.ParseWhenOtherwiseChildren(element, element2, nestingDepth);
- return element2;
- }
-
- private ProjectUsingTaskBodyElement ParseUsingTaskBodyElement(XmlElementWithLocation element, ProjectUsingTaskElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnUsingTaskBody);
- XmlUtilities.VerifyThrowProjectValidElementName(element);
- return new ProjectUsingTaskBodyElement(element, parent, this.project);
- }
-
- private ProjectUsingTaskParameterElement ParseUsingTaskParameterElement(XmlElementWithLocation element, UsingTaskParameterGroupElement parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectAttributes(element, validAttributesOnUsingTaskParameter);
- XmlUtilities.VerifyThrowProjectValidElementName(element);
- return new ProjectUsingTaskParameterElement(element, parent, this.project);
- }
-
- private UsingTaskParameterGroupElement ParseUsingTaskParameterGroupElement(XmlElementWithLocation element, ProjectElementContainer parent)
- {
- ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element);
- UsingTaskParameterGroupElement element2 = new UsingTaskParameterGroupElement(element, parent, this.project);
- HashSet<string> set = new HashSet<string>();
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- if (set.Contains(location.Name))
- {
- ProjectXmlUtilities.ThrowProjectInvalidChildElementDueToDuplicate(location);
- }
- else
- {
- ProjectUsingTaskParameterElement child = this.ParseUsingTaskParameterElement(location, element2);
- element2.AppendParentedChildNoChecks(child);
- set.Add(location.Name);
- }
- }
- return element2;
- }
-
- private void ParseWhenOtherwiseChildren(XmlElementWithLocation element, ProjectElementContainer parent, int nestingDepth)
- {
- foreach (XmlElementWithLocation location in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
- {
- ProjectElement child = null;
- string name = location.Name;
- if (name == null)
- {
- goto Label_006D;
- }
- if (!(name == "PropertyGroup"))
- {
- if (name == "ItemGroup")
- {
- goto Label_0056;
- }
- if (name == "Choose")
- {
- goto Label_0061;
- }
- goto Label_006D;
- }
- child = this.ParseProjectPropertyGroupElement(location, parent);
- goto Label_0084;
- Label_0056:
- child = this.ParseProjectItemGroupElement(location, parent);
- goto Label_0084;
- Label_0061:
- child = this.ParseProjectChooseElement(location, parent, nestingDepth);
- goto Label_0084;
- Label_006D:
- ProjectXmlUtilities.ThrowProjectInvalidChildElement(location.Name, element.Name, element.Location);
- Label_0084:
- parent.AppendParentedChildNoChecks(child);
- }
- }
- }
- }
-