Example #1
0
 protected DownloaderBase(Item item, IShareFileClient client, DownloaderConfig config = null)
 {
     Client           = client;
     Item             = item ?? throw new ArgumentNullException(nameof(item));
     Config           = config ?? new DownloaderConfig();
     progressReporter = new TransferProgressReporter(
         fileSize: BytesToDownload() ?? 0,
         transferId: "",
         reportInterval: Config.ProgressReportInterval);
 }
Example #2
0
 protected DownloaderBase(DownloadSpecification downloadSpecification, IShareFileClient client, DownloaderConfig config = null)
 {
     Client = client;
     Config = config ?? new DownloaderConfig();
     DownloadSpecification = downloadSpecification ?? throw new ArgumentNullException(nameof(downloadSpecification));
     progressReporter      = new TransferProgressReporter(
         fileSize: BytesToDownload() ?? 0,
         transferId: "",
         reportInterval: Config.ProgressReportInterval);
 }
Example #3
0
        protected UploaderBase(ShareFileClient client, UploadSpecificationRequest uploadSpecificationRequest, Stream stream, FileUploaderConfig config, int?expirationDays)
        {
            Client = client;
            UploadSpecificationRequest = uploadSpecificationRequest;
            FileStream = stream;
            Config     = config ?? new FileUploaderConfig();
            if (uploadSpecificationRequest.FileSize != stream.Length)
            {
                throw new UploadException("Specified file size does not equal file stream length", UploadStatusCode.Unknown);
            }

            ExpirationDays   = expirationDays;
            progressReporter = new TransferProgressReporter(uploadSpecificationRequest.FileSize, Guid.NewGuid().ToString(), Config.ProgressReportInterval);
        }