public ImportObjectClass(XmlNode node) { this.error = ErrorClasses.None; XmlAttribute attr = node.Attributes["name"]; this.originalName = attr == null ? string.Empty : attr.Value; attr = node.Attributes["guid"]; this.guid = attr == null?Guid.NewGuid() : new Guid(attr.Value); attr = node.Attributes["base"]; this.baseName = attr == null ? string.Empty : attr.Value; attr = node.Attributes["base_guid"]; this.baseGuid = attr == null ? Guid.Empty : new Guid(attr.Value); // наименование категории attr = node.ParentNode.Attributes["name"]; this.category = attr == null ? string.Empty : attr.Value; this.name = string.Empty; attr = node.Attributes["groupname"]; this.groupName = attr == null ? false : bool.Parse(attr.Value); attr = node.Attributes["creating"]; this.creating = attr == null ? true : bool.Parse(attr.Value); this.dependences = new StringCollection(); this.dependencesGuid = new List <Guid>(); foreach (XmlNode field in node.ChildNodes) { if (field.Name == "field") { XmlAttribute attrRef = field.Attributes["reference"]; if (attrRef != null) { this.dependences.Add(attrRef.Value); } XmlAttribute attrRefGuid = field.Attributes["ref_guid"]; if (attrRefGuid != null) { this.dependencesGuid.Add(new Guid(attrRefGuid.Value)); } } } }
public int CountErrors(ErrorClasses err) { return(this.classes.Count(c => c.Error == err)); }