/// <summary> /// Parse a UsingTaskParameterGroupElement from the element /// </summary> private UsingTaskParameterGroupElement ParseUsingTaskParameterGroupElement(XmlElementWithLocation element, ProjectElementContainer parent) { // There should be no attributes ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element); UsingTaskParameterGroupElement parameterGroup = new UsingTaskParameterGroupElement(element, parent, _project); HashSet <String> listOfChildElementNames = new HashSet <string>(); foreach (XmlElementWithLocation childElement in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element)) { // The parameter already exists this means there is a duplicate child item. Throw an exception. if (listOfChildElementNames.Contains(childElement.Name)) { ProjectXmlUtilities.ThrowProjectInvalidChildElementDueToDuplicate(childElement); } else { ProjectUsingTaskParameterElement parameter = ParseUsingTaskParameterElement(childElement, parameterGroup); parameterGroup.AppendParentedChildNoChecks(parameter); // Add the name of the child element to the hashset so we can check for a duplicate child element listOfChildElementNames.Add(childElement.Name); } } return(parameterGroup); }
/// <summary> /// Convenience method that picks a location based on a heuristic: /// Adds a new ParameterGroup to the using task to the end of the using task element /// </summary> public UsingTaskParameterGroupElement AddParameterGroup() { UsingTaskParameterGroupElement newParameterGroup = ContainingProject.CreateUsingTaskParameterGroupElement(); PrependChild(newParameterGroup); return(newParameterGroup); }
/// <summary> /// Parse a UsingTaskParameterElement from the element /// </summary> private ProjectUsingTaskParameterElement ParseUsingTaskParameterElement(XmlElementWithLocation element, UsingTaskParameterGroupElement parent) { ProjectXmlUtilities.VerifyThrowProjectAttributes(element, s_validAttributesOnUsingTaskParameter); XmlUtilities.VerifyThrowProjectValidElementName(element); return(new ProjectUsingTaskParameterElement(element, parent, _project)); }
/// <summary> /// Parse a UsingTaskParameterElement from the element /// </summary> private ProjectUsingTaskParameterElement ParseUsingTaskParameterElement(XmlElementWithLocation element, UsingTaskParameterGroupElement parent) { ProjectXmlUtilities.VerifyThrowProjectAttributes(element, s_validAttributesOnUsingTaskParameter); XmlUtilities.VerifyThrowProjectValidElementName(element); return new ProjectUsingTaskParameterElement(element, parent, _project); }
/// <summary> /// Parse a UsingTaskParameterGroupElement from the element /// </summary> private UsingTaskParameterGroupElement ParseUsingTaskParameterGroupElement(XmlElementWithLocation element, ProjectElementContainer parent) { // There should be no attributes ProjectXmlUtilities.VerifyThrowProjectNoAttributes(element); UsingTaskParameterGroupElement parameterGroup = new UsingTaskParameterGroupElement(element, parent, _project); HashSet<String> listOfChildElementNames = new HashSet<string>(); foreach (XmlElementWithLocation childElement in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element)) { // The parameter already exists this means there is a duplicate child item. Throw an exception. if (listOfChildElementNames.Contains(childElement.Name)) { ProjectXmlUtilities.ThrowProjectInvalidChildElementDueToDuplicate(childElement); } else { ProjectUsingTaskParameterElement parameter = ParseUsingTaskParameterElement(childElement, parameterGroup); parameterGroup.AppendParentedChildNoChecks(parameter); // Add the name of the child element to the hashset so we can check for a duplicate child element listOfChildElementNames.Add(childElement.Name); } } return parameterGroup; }
/// <summary> /// Initialize a parented UsingTaskParameterElement instance /// </summary> internal ProjectUsingTaskParameterElement(XmlElementWithLocation xmlElement, UsingTaskParameterGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { ErrorUtilities.VerifyThrowArgumentNull(parent, nameof(parent)); }
/// <summary> /// Initialize a parented UsingTaskParameterElement instance /// </summary> internal ProjectUsingTaskParameterElement(XmlElementWithLocation xmlElement, UsingTaskParameterGroupElement parent, ProjectRootElement containingProject) : base(xmlElement, parent, containingProject) { ErrorUtilities.VerifyThrowArgumentNull(parent, "parent"); }