Exemple #1
0
        /// <summary>
        /// 在本DataStore中新建数据节点
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public DataNode New(string type)
        {
            type = type.ToLower();
            string   tag     = this.GetTag(type, false);
            XmlNode  pnode   = this.XmlEle.SelectSingleNode(tag);
            XmlNode  node    = null;
            DataNode nodeobj = null;

            if (pnode == null)
            {
                pnode = this.XmlDoc.CreateElement(tag);
                this.XmlEle.AppendChild(pnode);
            }
            switch (type)
            {
            case "form":
                node = this.XmlDoc.CreateElement("Form");
                pnode.AppendChild(node);
                nodeobj = new DataForm(this.XmlDoc, (XmlElement)node);
                break;

            case "list":
                node = (XmlElement)this.XmlDoc.CreateElement("List");
                pnode.AppendChild(node);
                nodeobj = new DataList(this.XmlDoc, (XmlElement)node);
                break;

            case "enum":
                node = (XmlElement)this.XmlDoc.CreateElement("Enum");
                pnode.AppendChild(node);
                nodeobj = new DataEnum(this.XmlDoc, (XmlElement)node);
                break;

            case "param":
                node = (XmlElement)this.XmlDoc.CreateElement("Param");
                pnode.AppendChild(node);
                nodeobj = new DataParam(this.XmlDoc, (XmlElement)node);
                break;
            }
            return(nodeobj);
        }
Exemple #2
0
 /// <summary>
 /// 根据DataEnum构造新的DataEnum
 /// </summary>
 /// <param name="ele"></param>
 public DataEnum(DataEnum dataEnum) : base(dataEnum.ToString())
 {
     this.NodeType = "Enum";
 }