Esempio n. 1
0
        /// <summary>
        /// Opens a stream on an entry.
        /// </summary>
        /// <param name="moduleStream">A stream open on the module file.</param>
        /// <param name="entry">The entry.</param>
        /// <param name="section">The section to open.</param>
        /// <returns>A stream which can be used to read the entry data. It will depend on <paramref name="moduleStream"/>.</returns>
        public ModuleBlockStream OpenEntry(Stream moduleStream, ModuleEntry entry, ModuleEntrySection section)
        {
            AssertContainsEntry(entry);
            var blockCompressor = new ModuleBlockCompressor(moduleStream, DataBaseOffset);

            return(new ModuleBlockStream(blockCompressor, entry, section));
        }
Esempio n. 2
0
        private MemoryStream _currentBlockStream; // Can be null

        public ModuleBlockStream(ModuleBlockCompressor blockCompressor, ModuleEntry entry, ModuleEntrySection section)
        {
            _blockCompressor = blockCompressor;
            _entryOffset     = entry.DataOffset;
            _blocks          = GetBlocks(entry, section);
            if (_blocks.Count > 0)
            {
                _sectionOffset = _blocks[0].UncompressedOffset;
                _entryPosition = _sectionOffset;
                var lastBlock = _blocks[_blocks.Count - 1];
                _sectionLength = lastBlock.UncompressedOffset + lastBlock.UncompressedSize - _sectionOffset;
            }
        }