public Task OnProgressAsync(UploadProgressEvent @event,
                                    CancellationToken ct)
        {
            var assetEvent = new AssetUploadProgressEvent(@event.FileId, @event.Progress, @event.BytesWritten, @event.BytesTotal);

            return(inner.OnProgressAsync(assetEvent, ct));
        }
Esempio n. 2
0
        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
            });
        }
Esempio n. 3
0
        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
                });
            }
        }
Esempio n. 4
0
 protected virtual void RaiseUploadProgressEvent(UploadProgressArgs args) => UploadProgressEvent?.Invoke(this, args);