/// <summary> /// Deserialize the block with the given id. /// </summary> /// <param name="blockId"></param> /// <returns></returns> private CHBlock DeserializeBlock(uint blockId) { int blockOffset; int blockSize; uint blockIdx = blockId / _blockSize; if (blockIdx == 0) { // the block idx zero. blockOffset = _startOfBlocks; blockSize = _blocksIndex.LocationIndex[blockIdx]; } else { // need to calculate offset and size. blockOffset = _startOfBlocks + _blocksIndex.LocationIndex[blockIdx - 1]; blockSize = _blocksIndex.LocationIndex[blockIdx] - _blocksIndex.LocationIndex[blockIdx - 1]; } return(_serializer.DeserializeBlock(_stream, blockOffset, blockSize, true)); }