Пример #1
0
Файл: Target.cs Проект: 3F/IeXod
        /// <summary>
        /// Sets or removes an attribute from the target element. Marks the target dirty after the update
        /// </summary>
        /// <param name="attributeName"></param>
        /// <param name="attributeValue"></param>
        /// <returns>XmlAttribute which has been updated</returns>
        internal XmlAttribute SetOrRemoveTargetAttribute
        (
            string attributeName,
            string attributeValue
        )
        {
            XmlAttribute updatedAttribute = null;

            // If this Target object is not actually represented by a
            // <Target> element in the parentProject.file, then do not allow
            // the caller to set the condition.
            error.VerifyThrowInvalidOperation(this.targetElement != null, "CannotSetCondition");

            // If this item was imported from another parentProject. we don't allow modifying it.
            error.VerifyThrowInvalidOperation(!this.importedFromAnotherProject, "CannotModifyImportedProjects");

            updatedAttribute = ProjectXmlUtilities.SetOrRemoveAttribute(this.targetElement, attributeName, attributeValue);

            // Mark the project dirty after an attribute has been updated
            this.MarkTargetAsDirty();

            return(updatedAttribute);
        }