Inheritance: McbChunk
Exemplo n.º 1
0
        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            bool     breakLoop = false;
            McbChunk thisChunk;

            while (!breakLoop)
            {
                long         streamPos = reader.BaseStream.Position;
                McbChunkType chunkType = (McbChunkType)reader.ReadInt32();
                reader.BaseStream.Position = streamPos;
                thisChunk = null;
                switch (chunkType)
                {
                case McbChunkType.ATT:
                    thisChunk = new AttChunk();
                    break;

                case McbChunkType.CPT:
                    thisChunk = new CptChunk();
                    break;

                case McbChunkType.ACT:
                    thisChunk = new McbChunk();
                    break;

                case McbChunkType.TRK:
                    thisChunk = new TrkChunk();
                    break;

                case McbChunkType.BKT:
                    thisChunk = new McbChunk();
                    break;

                case McbChunkType.RES:
                    // Ran out of chunks
                    break;

                default:
                    System.Diagnostics.Trace.WriteLine("Unknown MCB Chunk type: " + (int)chunkType);
                    break;
                }

                if (thisChunk != null)
                {
                    thisChunk.LoadSection(reader);
                    reader.BaseStream.Position = streamPos + 8 * thisChunk.ChunkBlocks;
                    thisChunk.Parent           = this;
                    this.Children.Add(thisChunk);
                }
                else
                {
                    breakLoop = true;
                }
            }
        }
Exemplo n.º 2
0
        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            bool breakLoop = false;
            McbChunk thisChunk;
            while (!breakLoop)
            {
                long streamPos = reader.BaseStream.Position;
                McbChunkType chunkType = (McbChunkType)reader.ReadInt32();
                reader.BaseStream.Position = streamPos;
                thisChunk = null;
                switch (chunkType)
                {
                    case McbChunkType.ATT:
                        thisChunk = new AttChunk();
                        break;
                    case McbChunkType.CPT:
                        thisChunk = new CptChunk();
                        break;
                    case McbChunkType.ACT:
                        thisChunk = new McbChunk();
                        break;
                    case McbChunkType.TRK:
                        thisChunk = new TrkChunk();
                        break;
                    case McbChunkType.BKT:
                        thisChunk = new McbChunk();
                        break;
                    case McbChunkType.RES:
                        // Ran out of chunks
                        break;
                    default:
                        System.Diagnostics.Trace.WriteLine("Unknown MCB Chunk type: " + (int)chunkType);
                        break;
                }

                if (thisChunk != null)
                {
                    thisChunk.LoadSection(reader);
                    reader.BaseStream.Position = streamPos + 8 * thisChunk.ChunkBlocks;
                    thisChunk.Parent = this;
                    this.Children.Add(thisChunk);
                }
                else
                {
                    breakLoop = true;
                }
            }
        }