protected override void Read(GrnBinaryReader reader) { reader.ReadBytes(4); this.Offset = reader.ReadUInt32(); reader.ReadBytes(8); int currentPosition = (Int32)reader.BaseStream.Position; reader.Seek((int)this.Offset, System.IO.SeekOrigin.Begin); this.NumTotalChildNodes = reader.ReadInt32(); reader.ReadBytes(12); int numChildren = this.NumTotalChildNodes; for (int i = 0; i < numChildren; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); numChildren -= childNode.NumTotalChildNodes; if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } reader.Seek(currentPosition, System.IO.SeekOrigin.Begin); }
protected virtual void Read(GrnBinaryReader reader) { this.Offset = reader.ReadUInt32(); this.NumTotalChildNodes = reader.ReadInt32(); int numChildren = this.NumTotalChildNodes; for (int i = 0; i < numChildren; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); numChildren -= childNode.NumTotalChildNodes; if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } }
protected override void Read(GrnBinaryReader reader) { this.NumTotalChildNodes = reader.ReadInt32(); reader.ReadBytes(8); this.FileLength = reader.ReadUInt32(); reader.ReadBytes(12); for (int i = 0; i < NumTotalChildNodes; i++) { GrnNodeType nodeType = (GrnNodeType)reader.ReadInt32(); GrnNode childNode = GrnNode.ReadByNodeType(reader, this, nodeType); this.ChildNodes.Add(childNode); if (i > 0) { childNode.PreviousSibling = this.ChildNodes[i - 1]; childNode.PreviousSibling.NextSibling = childNode; } } this.ReadData(reader, 0); }