Exemplo n.º 1
0
		/// <summary>
		/// Following node.Adn1Node to add subnodes. It is special for paste a node tree.
		/// </summary>
		/// <param name="node">node.</param>
		/// <param name="mask">mask.</param>
		/// <param name="treeView">hosting TreeView control.</param>
		public static void AddSubNode(Asn1TreeNode node, uint mask, TreeView treeView)
		{
			for (int i=0; i<node.ANode.ChildNodeCount; i++)
			{
				Asn1TreeNode tNode = new Asn1TreeNode();
				tNode.asn1Node = node.ANode.GetChildNode(i);
				tNode.Text = tNode.ANode.GetLabel(mask);
				node.Nodes.Add(tNode);
				node.Expand();
				if (treeView != null)
					treeView.SelectedNode = node;
				AddSubNode(tNode, mask, treeView);
			}
		}
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            for (int m = 0; m < 5; m++)
            {

                MemoryStream ms = new MemoryStream(xParser.RawData);
                xParser.LoadData(ms);
                Asn1Parser xparser = new Asn1Parser();
                uint mask = 0;
                int i, j, k, l;
                for (i = 0; i < RootNode.ChildNodeCount; i++)
                {
                    Asn1TreeNode tmpNode = new Asn1TreeNode(RootNode.GetChildNode(i), mask);
                    listBox1.Items.Add(tmpNode.ANode.Path + "|" + tmpNode.ANode.GetDataStr(true));
                    string hexStr = Asn1Unit.ConvertNodeValue(tmpNode.ANode.Path, tmpNode.ANode.GetDataStr(true));
                    listBox2.Items.Add(tmpNode.ANode.TagName + "|" + hexStr);

                    for (j = 0; j < tmpNode.ANode.ChildNodeCount; j++)
                    {
                        Asn1TreeNode tmpNodeChild = new Asn1TreeNode(tmpNode.ANode.GetChildNode(j), mask);
                        listBox1.Items.Add(tmpNodeChild.ANode.Path + "|" + tmpNodeChild.ANode.GetDataStr(true));
                        hexStr = Asn1Unit.ConvertNodeValue(tmpNodeChild.ANode.Path, tmpNodeChild.ANode.GetDataStr(true));
                        listBox2.Items.Add(tmpNodeChild.ANode.TagName + "|" + hexStr);
                        for (k = 0; k < tmpNodeChild.ANode.ChildNodeCount; k++)
                        {
                            Asn1TreeNode tmpNodeChild1 = new Asn1TreeNode(tmpNodeChild.ANode.GetChildNode(k), mask);
                            listBox1.Items.Add(tmpNodeChild1.ANode.Path + "|" + tmpNodeChild1.ANode.GetDataStr(true));
                            hexStr = Asn1Unit.ConvertNodeValue(tmpNodeChild1.ANode.Path, tmpNodeChild1.ANode.GetDataStr(true));
                            listBox2.Items.Add(tmpNodeChild1.ANode.TagName + "|" + hexStr);
                            for (l = 0; l < tmpNodeChild1.ANode.ChildNodeCount; l++)
                            {
                                Asn1TreeNode tmpNodeChild2 = new Asn1TreeNode(tmpNodeChild1.ANode.GetChildNode(l), mask);
                                listBox1.Items.Add(tmpNodeChild2.ANode.Path + "|" + tmpNodeChild2.ANode.GetDataStr(true));
                                hexStr = Asn1Unit.ConvertNodeValue(tmpNodeChild2.ANode.Path, tmpNodeChild2.ANode.GetDataStr(true));
                                listBox2.Items.Add(tmpNodeChild2.ANode.TagName + "|" + hexStr);
                            }
                        }

                    }

                }

            }
        }
Exemplo n.º 3
0
 //运用递归过程遍历treeView的所有的节点
 public void searchNode(Asn1TreeNode tmpNode,TreeNode tn)
 {
     uint mask = 0;
     for (int i = 0; i < tmpNode .ANode .ChildNodeCount ; i++)
     {
         Asn1TreeNode tmpNodeChild = new Asn1TreeNode(tmpNode.ANode.GetChildNode(i), mask);
         string hexStr = Asn1Unit.ConvertNodeValue(tmpNodeChild.ANode.Path, tmpNodeChild.ANode.GetDataStr(true));
         TreeNode tnChild = new TreeNode(tmpNodeChild.ANode.Path + "::" + tmpNodeChild.ANode.GetDataStr(true) + "::"
              + hexStr);
         tn.Nodes.Add(tnChild );
         searchNode(tmpNodeChild, tnChild);
     }
 }