Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public virtual void ReadData(GrnBinaryReader reader, int directoryOffset)
        {
            Int32 outputLength = this.GetReadDataLength();

            if (outputLength > 0)
            {
                reader.Seek((int)this.Offset + directoryOffset, System.IO.SeekOrigin.Begin);
                Data = reader.ReadBytes(outputLength);
            }

            for (int i = 0; i < this.ChildNodes.Count; i++)
            {
                this.ChildNodes[i].ReadData(reader, directoryOffset);
            }
        }
Ejemplo n.º 5
0
        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);
        }