예제 #1
0
        private System.Windows.Forms.TreeNode CreateTreeViewNode(TreeNode node)
        {
            if (node == null)
            {
                return(new System.Windows.Forms.TreeNode("Parser Error"));
            }
            System.Windows.Forms.TreeNode res     = new System.Windows.Forms.TreeNode(node.getLabel());
            System.Windows.Forms.TreeNode attribs = new System.Windows.Forms.TreeNode("CompilerAttributes");

            bool empty = true;

            if (node.Attributes.ContainsKey(Parser.Attribute.Value))
            {
                empty = false;
                string Temp = "";
                foreach (var i in ((List <string>)node.Attributes[Parser.Attribute.Value]))
                {
                    Temp += i + " ";
                }
                attribs.Nodes.Add(Temp);
            }

            if (node.Attributes.ContainsKey(Parser.Attribute.Datatype))
            {
                empty = false;
                attribs.Nodes.Add(((Datatype)node.Attributes[Parser.Attribute.Datatype]).ToString());
            }

            if (!empty)
            {
                res.Nodes.Add(attribs);
            }


            foreach (var child in node.Children)
            {
                res.Nodes.Add(CreateTreeViewNode(child));
            }

            return(res);
        }
예제 #2
0
        private System.Windows.Forms.TreeNode CreateTreeViewNode(TreeNode node)
        {
            if (node == null)
            {
                return(new System.Windows.Forms.TreeNode("Parser Error"));
            }
            System.Windows.Forms.TreeNode res = new System.Windows.Forms.TreeNode(node.getLabel());

            if (node.Attributes.ContainsKey(Parser.Attribute.Value))
            {
                string Temp = "";
                foreach (var i in ((List <string>)node.Attributes[Parser.Attribute.Value]))
                {
                    Temp += i + " ";
                }
                Values.Add(res, Temp);
            }
            else
            {
                Values.Add(res, "N/A");
            }

            if (node.Attributes.ContainsKey(Parser.Attribute.Datatype))
            {
                Datatypes.Add(res, ((Datatype)node.Attributes[Parser.Attribute.Datatype]).ToString());
            }
            else
            {
                Datatypes.Add(res, "N/A");
            }


            foreach (var child in node.Children)
            {
                res.Nodes.Add(CreateTreeViewNode(child));
            }

            return(res);
        }