Esempio n. 1
0
        // constructors
        public GridFSForwardOnlyDownloadStream(
            GridFSBucket bucket,
            FileDocument fileInfo,
            bool checkMD5)
            : base(bucket, fileInfo)
        {
            _checkMD5 = checkMD5;
            if (_checkMD5)
            {
                _md5 = new IncrementalMD5();
            }

            _lastChunkNumber = (int)((fileInfo.Length - 1) / fileInfo.ChunkSize);
            _lastChunkSize   = (int)(fileInfo.Length % fileInfo.ChunkSize);

            if (_lastChunkSize == 0)
            {
                _lastChunkSize = fileInfo.ChunkSize;
            }
        }