示例#1
0
 //xml转为为nodes
 private void NodesFromXML(CHMNodeList nodes, System.Xml.XmlElement RootElement)
 {
     foreach (System.Xml.XmlNode node in RootElement.ChildNodes)
     {
         if (node.Name == "Node")
         {
             System.Xml.XmlElement element = (System.Xml.XmlElement)node;
             CHMNode NewNode = new CHMNode();
             NewNode.Name     = element.GetAttribute("Name");
             NewNode.Local    = element.GetAttribute("Local");
             NewNode.ImageNo  = element.GetAttribute("ImageNumber");
             NewNode.KeyWords = element.GetAttribute("KeyWords");
             nodes.Add(NewNode);
             foreach (System.Xml.XmlNode node2 in element.ChildNodes)
             {
                 if (node2.Name == "Items")
                 {
                     NodesFromXML(NewNode.Nodes, (System.Xml.XmlElement)node2);
                 }
             }
         }
     }
 }
示例#2
0
 /// <summary>
 /// 节点位于list的索引
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public int IndexOf(CHMNode node)
 {
     return(this.List.IndexOf(node));
 }
示例#3
0
 /// <summary>
 /// 是否包含该节点
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public bool Contains(CHMNode node)
 {
     return(this.List.Contains(node));
 }
示例#4
0
 /// <summary>
 /// 移除第一个匹配的节点
 /// </summary>
 /// <param name="node">待移除的节点</param>
 public void Remove(CHMNode node)
 {
     this.List.Remove(node);
 }
示例#5
0
 /// <summary>
 /// 插入节点
 /// </summary>
 /// <param name="index">位置</param>
 /// <param name="node">待插入的节点</param>
 public void Insert(int index, CHMNode node)
 {
     this.List.Insert(index, node);
 }
示例#6
0
 /// <summary>
 /// 添加节点
 /// </summary>
 /// <param name="node">待添加的节点</param>
 /// <returns></returns>
 public int Add(CHMNode node)
 {
     return(this.List.Add(node));
 }