Example #1
0
 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);
 }
Example #2
0
 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);
         }
     }
 }
Example #3
0
 public Parameter(Element parent, string name, string value)
 {
     Parent = parent;
     Name = name;
     Value = value;
 }
Example #4
0
 public void Parse(string ttp)
 {
    string filtered = ttp.Replace(" ", "").Replace(System.Environment.NewLine, "");
    current = getElement(filtered, currentChar);
 }
Example #5
0
 public Element(Element parent, string name, string value)
 {
     Name = name;
     Value = value;
     Parent = parent;
 }
Example #6
0
 void parse()
 {
     XDocument xdoc = XDocument.Parse(_data);
     root = new Element(null, "Root", "");
     getcollections(xdoc.Element("Root"), root);
 }
Example #7
0
 internal Parameter(string n, string v, Element p)
 {
     name = n;
     value = v;
     parent = p;
 }
Example #8
0
 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();
     }
 }