예제 #1
0
 private static RootIndexBlock ReadRootBlock(IViewableData file, BlockInfoHeader rootBlockInfo)
 {
     using (var reader = new BinaryReader(GetBlockView(rootBlockInfo, file)))
     {
         return(RootIndexBlock.FromReader(reader));
     }
 }
예제 #2
0
 private static Stream GetBlockView(BlockInfoHeader blockInfo, IViewableData file)
 {
     if (blockInfo.Size == 0)
     {
         return(null);
     }
     return(file.CreateView((long)blockInfo.Offset, (long)blockInfo.Size));
 }
예제 #3
0
        /// <summary>
        /// </summary>
        /// <returns>Index block number</returns>
        private static BlockInfoHeader[] ReadBlockPointers(
            IViewableData file, ArchiveHeader header)
        {
            var blockPointers = new BlockInfoHeader[header.DataHeader.BlockCount];
            var startPosition = header.DataHeader.BlockTableOffset;
            var length        = header.DataHeader.BlockCount * Marshal.SizeOf <BlockInfoHeader>();

            using (var reader = new BinaryReader(file.CreateView((long)startPosition, length)))
            {
                for (var x = 0; x < header.DataHeader.BlockCount; x++)
                {
                    blockPointers[x] = BlockInfoHeader.FromReader(reader);
                }
            }

            return(blockPointers);
        }
예제 #4
0
 protected Stream GetBlockView(BlockInfoHeader blockInfo)
 {
     return(GetBlockView(blockInfo, File));
 }