void getelement(XElement xe, Element group) { Element el = new Element(group, xe.Name.LocalName, ""); foreach (XAttribute xa in xe.Attributes()) { el.Parameters.Add(new Parameter(el, xa.Name.LocalName, xa.Value)); } group.Elements.Add(el); }
void getcollections(XElement x, Element parent) { foreach (XElement xele in x.Elements()) { if (xele.Name.LocalName == "Group") { Element p = new Element(parent, xele.Name.LocalName, ""); if (xele.HasAttributes) { p.Parameters.Add(new Parameter(p, "Name", xele.FirstAttribute.Value)); } parent.Elements.Add(p); getcollections(xele, p); } else { getelement(xele, parent); } } }
public Parameter(Element parent, string name, string value) { Parent = parent; Name = name; Value = value; }
public void Parse(string ttp) { string filtered = ttp.Replace(" ", "").Replace(System.Environment.NewLine, ""); current = getElement(filtered, currentChar); }
public Element(Element parent, string name, string value) { Name = name; Value = value; Parent = parent; }
void parse() { XDocument xdoc = XDocument.Parse(_data); root = new Element(null, "Root", ""); getcollections(xdoc.Element("Root"), root); }
internal Parameter(string n, string v, Element p) { name = n; value = v; parent = p; }
public Sphere GetSphere(Element element) { if (element.Name == "Sphere") { return new Sphere(Transform.CreateTranformFromString(element.GetParameter("ObjectToWorld").Value), Transform.CreateTranformFromString(element.GetParameter("WorldToObject").Value), bool.Parse(element.GetParameter("ReverseOrientation").Value), float.Parse(element.GetParameter("Radius").Value), float.Parse(element.GetParameter("ZMin").Value), float.Parse(element.GetParameter("ZMax").Value), float.Parse(element.GetParameter("PhiMax").Value)); } else { throw new Exception(); } }