public void Debug(KVNode start, int depth = 0) { foreach (KVNode node in start.FindNodes()) { for (int i = 0; i < depth; i++) { Console.Write("="); } if (node.Type == KVNode.KVNodeType.Parent) { Console.WriteLine(node.KeyName); Debug(node, depth + 1); } else { Console.WriteLine(String.Format("{0} {1}", node.KeyName, node.GetValue())); } } }
private static void NodeToFullFormatString(KVNode node, StringBuilder sb, int depth = 0) { if (node.Type == KVNode.KVNodeType.Root || node.Type == KVNode.KVNodeType.Parent) { sb.Append(' ', depth); sb.AppendFormat("{0}\n", node.KeyName); sb.Append(' ', depth); sb.Append("{\n"); foreach (var n in node.FindNodes()) { NodeToFullFormatString(n, sb, depth + 1); } sb.Append('\n'); sb.Append(' ', depth); sb.Append("}"); } else { sb.Append(' ', depth); sb.AppendFormat("\"{0}\" \"{1}\"", node.KeyName, node.GetValue().ToString()); } }