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); } } } }
public ByamlTreeNode GetTreeNode() { ByamlTreeNode root = new ByamlTreeNode(RootNode, "Root"); MakeTreenode(root); return(root); }