/// <summary> /// Adds custom attributes to the quality level. /// </summary> /// <param name="reader">The xml reader.</param> /// <param name="qualityLevel">The quality level.</param> private static void AddCustomAttributes(XmlReader reader, QualityLevel qualityLevel) { if (!reader.IsEmptyElement) { while (reader.Read()) { if (reader.Name == "CustomAttributes" && reader.NodeType == XmlNodeType.Element) { while (reader.Read()) { if ((reader.Name == "Attribute") && (reader.NodeType == XmlNodeType.Element)) { string attribute = reader.GetAttribute("Name"); if (!string.IsNullOrEmpty(attribute)) { qualityLevel.AddCustomAttribute(attribute, reader.GetAttribute("Value")); } } if ((reader.Name == "CustomAttributes") && (reader.NodeType == XmlNodeType.EndElement)) { return; } } } if (reader.Name == "QualityLevel" && reader.NodeType == XmlNodeType.EndElement) { return; } } } }
/// <summary> /// Creates a clone instance of this QualityLevel object. /// </summary> /// <returns>A copy of the QualityLevel object.</returns> public QualityLevel Clone() { QualityLevel clone = new QualityLevel(); foreach (KeyValuePair <string, string> attributeValuePair in this.Attributes) { clone.AddAttribute(attributeValuePair.Key, attributeValuePair.Value); } foreach (KeyValuePair <string, string> customAttributeValuePair in this.CustomAttributes) { clone.AddCustomAttribute(customAttributeValuePair.Key, customAttributeValuePair.Value); } return(clone); }