///<summary> ///Iterates over the complete file, parses the files information ///and stores it in individual chunk classes. ///</summary> private void processMainChunks(Chunk Parent) { //Parse Headers and setup local variables int chunkID = _bw.ReadInt32(); int currentChunkLength = _bw.ReadInt32() & 0x7FFFFFFF; int endLength = (int)_bw.BaseStream.Position + currentChunkLength; // Lookup and create the new chunk class Chunk chk = _chkMap.getChunk(chunkID); //If chunk class exists parse it, if not skip it. if (chk != null) { // Parse the newly created chunk. chk.parse(_bw, _chkMap, _debug, currentChunkLength); Parent.addSubChunk(chk); } else { //if(_debug) Console.Out.WriteLine("File: " + _filename + "\t : \tSkipping Chunk: \t " + chunkID); //Chunk will be skipped if its not initialized in the chunkmap _bw.BaseStream.Seek(currentChunkLength, SeekOrigin.Current); //Advance to the next chunk } while (_bw.BaseStream.Position < endLength) { processMainChunks(chk); } } // End of processMainChunks
///<summary> ///Iterates over the complete file, parses the files information ///and stores it in individual chunk classes. ///</summary> private void processChunks(Chunk Parent) { //Parse Headers and setup local variables int chunkID = br.ReadInt32(); int currentChunkLength = br.ReadInt32() & 0x7FFFFFFF; int endLength = (int) br.BaseStream.Position + currentChunkLength; // Lookup and create the new chunk class Chunk chk = chkMap.getChunk(chunkID); //If chunk class exists parse it, if not skip it. if (chk != null) { // Parse the newly created chunk. chk.parse(br, chkMap, debugText, currentChunkLength); Parent.addSubChunk(chk); } else { if(debugText) Console.Out.WriteLine("File: " + _filename + "\t : \tSkipping Chunk: \t " + chunkID); //Chunk will be skipped if its not initialized in the chunkmap br.BaseStream.Seek(currentChunkLength, SeekOrigin.Current); //Advance to the next chunk } // Parse any sub chunks while (br.BaseStream.Position < endLength) { processChunks(chk); } }