public void Read(object sourceFile)
        {
            try
            {
                using (FileStream fileToBeCompressed = new FileStream(sourceFile.ToString(), FileMode.Open))
                {
                    _fileProcessData.LastBlockId = Convert.ToInt32(fileToBeCompressed.Length / Constants.BlockSize);
                    while (fileToBeCompressed.Position < fileToBeCompressed.Length && !_fileProcessData.Cancelled)
                    {
                        int  bytesToRead;
                        long readingFileBlock = fileToBeCompressed.Length - fileToBeCompressed.Position;
                        if (readingFileBlock <= Constants.BlockSize)
                        {
                            bytesToRead = (int)(readingFileBlock);
                        }
                        else
                        {
                            bytesToRead = Constants.BlockSize;
                        }

                        var lastBuffer = new byte[bytesToRead];
                        fileToBeCompressed.Read(lastBuffer, 0, bytesToRead);
                        _queueReader.EnqueueForCompressing(lastBuffer);
                        _gZipProgress.ProcessProgress(fileToBeCompressed.Position, fileToBeCompressed.Length);
                    }
                    _queueReader.Stop();
                }
            }
            catch (Exception ex)
            {
                _fileProcessData.Cancelled = true;
                throw new Exception(ex.Message);
            }
        }
        public void Read(object sourceFile)
        {
            try
            {
                int blockId = 0;
                using (FileStream compressedFile = new FileStream(sourceFile.ToString(), FileMode.Open))
                {
                    while (compressedFile.Position < compressedFile.Length)
                    {
                        var lengthBuffer = new byte[Constants.FirstByteCountToDecompress];
                        compressedFile.Read(lengthBuffer, 0, lengthBuffer.Length);
                        int blockLength    = BitConverter.ToInt32(lengthBuffer, 4);
                        var compressedData = new byte[blockLength];
                        lengthBuffer.CopyTo(compressedData, 0);

                        compressedFile.Read(compressedData, Constants.FirstByteCountToDecompress, blockLength - Constants.FirstByteCountToDecompress);
                        int       dataSize   = BitConverter.ToInt32(compressedData, blockLength - 4);
                        byte[]    lastBuffer = new byte[dataSize];
                        ByteBlock block      = new ByteBlock
                        {
                            Id               = blockId,
                            Buffer           = lastBuffer,
                            CompressedBuffer = compressedData
                        };
                        _queueReader.EnqueueForDecompressing(block);
                        if ((compressedFile.Length - compressedFile.Position) / Constants.BlockSize == 0)
                        {
                            _fileProcessData.LastBlockId = blockId;
                        }

                        blockId++;
                        _gZipProgress.ProcessProgress(compressedFile.Position, compressedFile.Length);
                    }
                    _queueReader.Stop();
                }
            }
            catch (Exception ex)
            {
                _fileProcessData.Cancelled = true;
                throw new Exception(ex.Message);
            }
        }