Exemple #1
0
        public void Load(System.IO.Stream stream)
        {
            _stream = stream;
            using (var reader = new Toolbox.Library.IO.FileReader(stream, true))
            {
                reader.SetByteOrder(true);
                var header = reader.ReadStruct <MSBTHeader>();

                Text = FileName;

                //parse the data
                int index = 0;
                while (!reader.EndOfStream)
                {
                    CChunkDescriptor chunk    = reader.ReadStruct <CChunkDescriptor>();
                    long             startPos = reader.Position;

                    reader.SeekBegin(startPos + (int)chunk.DataOffset);
                    var subStream = new SubStream(_stream, reader.Position, (long)chunk.DataSize);
                    Nodes.Add(new MessageEntry(subStream, index++, chunk.ChunkType));

                    reader.SeekBegin(startPos + (int)chunk.DataOffset + (int)chunk.DataSize);
                }
            }
        }