void m_initialize(Asn1Reader asn) { asn.BuildOffsetMap(); RootNode = new Asn1Node(asn, this); if (asn.NextOffset == 0) { return; } buildTree(asn, RootNode, this); }
static void buildTree(Asn1Reader asn, Asn1Node node, Asn1Tree rootTree) { asn.MoveNext(); List <Int32> subNodeIndexes = new List <Int32>(); Int32 index = 0; do { node.AddUnsafe(new Asn1Node(asn, rootTree)); if (asn.IsConstructed) { subNodeIndexes.Add(index); } index++; } while (asn.MoveNextCurrentLevel()); asn.Reset(); foreach (Int32 subNodeIndex in subNodeIndexes) { Asn1Node subNode = node.Children[subNodeIndex]; asn.MoveToPoisition(subNode.Offset); buildTree(asn, subNode, rootTree); } }