Example #1
0
        private static void MakeTreenode(ByamlTreeNode node)
        {
            if (node.ByamlNode.NodeType == ByamlNodeType.Array)
            {
                var array = (List <ByamlEntry>)node.ByamlNode.Value;

                for (int i = 0; i < array.Count; i++)
                {
                    if (!ByamlParser.NodeIsValue(array[i].NodeType))
                    {
                        var child = new ByamlTreeNode(array[i], i.ToString());
                        node.Nodes.Add(child);
                        MakeTreenode(child);
                    }
                }
            }
            else if (node.ByamlNode.NodeType == ByamlNodeType.Dictionary)
            {
                var dict = (Dictionary <string, ByamlEntry>)node.ByamlNode.Value;

                foreach (var item in dict)
                {
                    if (!ByamlParser.NodeIsValue(item.Value.NodeType))
                    {
                        var child = new ByamlTreeNode(item.Value, item.Key);
                        node.Nodes.Add(child);
                        MakeTreenode(child);
                    }
                }
            }
        }
Example #2
0
        public ByamlTreeNode GetTreeNode()
        {
            ByamlTreeNode root = new ByamlTreeNode(RootNode, "Root");

            MakeTreenode(root);

            return(root);
        }