public bool addFilter(string name, Category parent) { XElement newFilter = new XElement("filter"); newFilter.SetAttributeValue("name", name); newFilter.SetAttributeValue("parent", parent.Name); IEnumerable<XContainer> xParent = from element in this._xmlDocument.Elements().Elements() where element.Attribute("name").Value == parent.Name select element; return this.addElementToNode(newFilter, xParent.First()); }
private Filter newFilter(XElement xmlNode, Filter parent) { Filter newFilter; string filterName = xmlNode.Attribute("name").Value; if (parent == null) { string extention = (xmlNode.Attribute("extentions") != null ? xmlNode.Attribute("extentions").Value : ""); string type = (xmlNode.Attribute("type") != null ? xmlNode.Attribute("type").Value : ""); // string path = Path.ChangeExtension(this._filePath, "") + "_" + filterName + ".xml"; newFilter = new Category(filterName, extention, type); } else { newFilter= new Filter(filterName, parent); } return newFilter; }