Exemple #1
0
        public B2Client()
        {
            _uploadConfigsByBucket = new ConcurrentDictionary<string, ConcurrentBag<B2UploadConfiguration>>();
            _uploadConfigsByLargeFile = new ConcurrentDictionary<string, ConcurrentBag<B2UploadPartConfiguration>>();

            BucketCache = new B2BucketCacher();
            Communicator = new B2Communicator();
        }
Exemple #2
0
        public B2File SetUploadProgressHandler(B2Communicator.NotifyProgress handler)
        {
            _uploadNotifyDelegate = handler;

            return this;
        }
Exemple #3
0
        public async Task<Stream> DownloadDataAsync(B2Communicator.NotifyProgress progressHandler = null)
        {
            ThrowIfNot(B2FileState.Present);

            if (Action != B2FileAction.Upload)
                throw new InvalidOperationException("This file is not a file - it's most likely a 'hide' placeholder");

            B2DownloadResult res = await _b2Client.Communicator.DownloadFileContent(FileId, notifyProgress: progressHandler);

            return res.Stream;
        }
Exemple #4
0
 public static Stream DownloadData(this B2File file, B2Communicator.NotifyProgress progressHandler = null)
 {
     return Utility.AsyncRunHelper(() => file.DownloadDataAsync(progressHandler));
 }