Esempio n. 1
0
 private void LoadBlocks()
 {
     BasicElement[] blocks = Utility.LoadBlocks();
     if (blocks.Length > 0)
     {
         foreach (BasicElement element in blocks)
         {
             BlocksListBox.Items.Add(element);
         }
     }
     else
     {
         BasicElement projectNode = new BasicElement("Project");
         BasicProperty prop = new BasicProperty("name", "Octgn test build");
         projectNode.Properties.Add(prop);
         prop = new BasicProperty("default", "Build");
         projectNode.Properties.Add(prop);
         BlocksListBox.Items.Add(projectNode);
     }
 }
Esempio n. 2
0
 public static BasicElement ParseBuildElement(XmlNode node)
 {
     if (node.NodeType == XmlNodeType.CDATA)
     {
         CDataElement  cdata = new CDataElement();
         CDataValue prop = new CDataValue();
         prop.Value = node.InnerText;
         cdata.Properties.Add(prop);
         return (cdata);
     }
     if (node.NodeType == XmlNodeType.Comment)
     {
         BasicElement comment = new BasicElement("Comment");
         BasicProperty prop = new BasicProperty();
         prop.Name = "";
         prop.Value = node.InnerText;
         comment.Properties.Add(prop);
         return (comment);
     }
     BasicElement element = new BasicElement();
     element.ElementName = node.Name;
     if (node.Attributes != null && node.Attributes.Count > 0)
     {
         foreach (XmlAttribute attribute in node.Attributes)
         {
             BasicProperty prop = new BasicProperty();
             prop.Name = attribute.Name;
             prop.Value = attribute.Value;
             element.Properties.Add(prop);
         }
     }
     if (node.HasChildNodes)
     {
         foreach (XmlNode child in node.ChildNodes)
         {
             element.ChildElements.Add(ParseBuildElement(child));
         }
     }
     return (element);
 }
Esempio n. 3
0
 public static BasicElement ParseBuildFile(XmlDocument doc)
 {
     BasicElement root = new BasicElement();
     root.ElementName = doc.DocumentElement.Name;
     if (doc.DocumentElement.HasAttributes)
     {
         foreach (XmlAttribute attribute in doc.DocumentElement.Attributes)
         {
             BasicProperty prop = new BasicProperty();
             prop.Name = attribute.Name;
             prop.Value = attribute.Value;
             root.Properties.Add(prop);
         }
     }
     if (doc.DocumentElement.HasChildNodes)
     {
         foreach (XmlNode child in doc.DocumentElement.ChildNodes)
         {
             root.ChildElements.Add(ParseBuildElement(child));
         }
     }
     return (root);
 }