public BitmapBlockManager(Stream bitmap, ulong storageBlockCount, uint blockSize) { if (bitmap == null) { throw new ArgumentNullException("bitmap"); } var xExpectedBitmapSize = storageBlockCount * blockSize; if ((ulong)bitmap.Length != xExpectedBitmapSize) { throw new Exception(string.Format("Wrong Bitmap stream size! (Expected = {0}, Actual = {1})", xExpectedBitmapSize, bitmap.Length)); } if (xExpectedBitmapSize < blockSize) { mBitmap = new FileBitmap(bitmap, 1, (uint)xExpectedBitmapSize); } else { mBitmap = new FileBitmap(bitmap, storageBlockCount, blockSize); } }
public BitmapBlockManager(IBlockStore baseStore, Stream bitmap) { if (baseStore == null) { throw new ArgumentNullException("baseStore"); } if (bitmap == null) { throw new ArgumentNullException("bitmap"); } var xExpectedBitmapSize = ((baseStore.BlockCount * baseStore.BlockSize) / 8U); if ((ulong)bitmap.Length != xExpectedBitmapSize) { throw new Exception(string.Format("Wrong Bitmap stream size! (Expected = {0}, Actual = {1})", xExpectedBitmapSize, bitmap.Length)); } if (xExpectedBitmapSize < baseStore.BlockSize) { mBitmap = new FileBitmap(bitmap, 1, (uint)xExpectedBitmapSize); } else { mBitmap = new FileBitmap(bitmap, baseStore.BlockCount / 8, baseStore.BlockSize); } }