private static RootIndexBlock ReadRootBlock(IViewableData file, BlockInfoHeader rootBlockInfo) { using (var reader = new BinaryReader(GetBlockView(rootBlockInfo, file))) { return(RootIndexBlock.FromReader(reader)); } }
private static Stream GetBlockView(BlockInfoHeader blockInfo, IViewableData file) { if (blockInfo.Size == 0) { return(null); } return(file.CreateView((long)blockInfo.Offset, (long)blockInfo.Size)); }
/// <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); }
protected Stream GetBlockView(BlockInfoHeader blockInfo) { return(GetBlockView(blockInfo, File)); }