static void TextDumpNodes(TypeTreeIterator it, TextWriter writer) { while (!it.IsNull) { var node = it.GetNode(); if (node->Index < 0) { goto Next; } for (int j = 0; j < node->Level; j++) { writer.Write(" "); } writer.WriteLine(string.Format("{0} {1} // ByteSize{{{2}}}, Index{{{3}}}, IsArray{{{4}}}, MetaFlag{{{5}}}", it.Type, it.Name, node->ByteSize.ToString("x"), node->Index.ToString("x"), (byte)node->TypeFlags, ((int)node->MetaFlag).ToString("x") )); Next: TextDumpNodes(it.GetChildren(), writer); it = it.GetNext(); } }
static void WriteNodes(TypeTreeIterator it, BinaryWriter writer) { while (!it.IsNull) { it.Node.Write(writer); WriteNodes(it.GetChildren(), writer); it = it.GetNext(); } }
static void BinaryDumpNodes(TypeTreeIterator it, BinaryWriter writer) { while (!it.IsNull) { var node = it.GetNode(); writer.Write(node->Version); writer.Write(node->Level); writer.Write((byte)node->TypeFlags); writer.Write(node->TypeStrOffset); writer.Write(node->NameStrOffset); writer.Write(node->ByteSize); writer.Write(node->Index); writer.Write((int)node->MetaFlag); BinaryDumpNodes(it.GetChildren(), writer); it = it.GetNext(); } }