public Task OnProgressAsync(UploadProgressEvent @event, CancellationToken ct) { var assetEvent = new AssetUploadProgressEvent(@event.FileId, @event.Progress, @event.BytesWritten, @event.BytesTotal); return(inner.OnProgressAsync(assetEvent, ct)); }
private void ProgressEventCallback(object sender, StreamTransferProgressArgs e) { double percentDone = Math.Round(((double)(e.TransferredBytes + CurrentTransferredBytes) * 100) / ContentTotalBytes); percentDone = percentDone >= 100 ? 100 : percentDone; long transferredBytes = (e.TransferredBytes + CurrentTransferredBytes) > ContentTotalBytes ? ContentTotalBytes : e.TransferredBytes + CurrentTransferredBytes; UploadProgressEvent?.Invoke(this, new S3ProgressArgs { TransferredBytes = transferredBytes, TotalBytes = ContentTotalBytes, PercentDone = (int)percentDone }); }
private void ProgressEventCallback(object sender, TransferProgressArgs e) { double percentDone = Math.Round(((double)(e.TransferredBytes) * 100) / e.TotalBytes); percentDone = percentDone >= 100 ? 100 : percentDone; long transferredBytes = e.TransferredBytes > e.TotalBytes ? e.TotalBytes : e.TransferredBytes; if ((PreviousReportBytes + this.ProgressUpdateInterval) < transferredBytes || transferredBytes == e.TotalBytes) { if (transferredBytes != e.TotalBytes) { PreviousReportBytes = transferredBytes; } UploadProgressEvent?.Invoke(this, new S3ProgressArgs { TransferredBytes = transferredBytes, TotalBytes = e.TotalBytes, PercentDone = (int)e.PercentDone }); } }
protected virtual void RaiseUploadProgressEvent(UploadProgressArgs args) => UploadProgressEvent?.Invoke(this, args);