private void UploadProgressEventCallback(object sender, UploadProgressArgs e) { var totalTransferredBytes = Interlocked.Add(ref _transferredBytes, e.IncrementTransferred - e.CompensationForRetry); int numberOfFilesUploaded = _numberOfFilesUploaded; if (e.TransferredBytes == e.TotalBytes) { numberOfFilesUploaded = Interlocked.Increment(ref _numberOfFilesUploaded); } UploadDirectoryProgressArgs uploadDirectoryProgressArgs = null; if (_request.UploadFilesConcurrently) { // If concurrent upload is enabled, values for current file, // transferred and total bytes for current file are not set. uploadDirectoryProgressArgs = new UploadDirectoryProgressArgs(numberOfFilesUploaded, _totalNumberOfFiles, totalTransferredBytes, _totalBytes, null, 0, 0); } else { uploadDirectoryProgressArgs = new UploadDirectoryProgressArgs(numberOfFilesUploaded, _totalNumberOfFiles, totalTransferredBytes, _totalBytes, e.FilePath, e.TransferredBytes, e.TotalBytes); } _request.OnRaiseProgressEvent(uploadDirectoryProgressArgs); }
private void UploadProgressEvent(object sender, UploadProgressArgs e) { if (this.LogProgress) { _Log.Verbose("{0} ({1}/{2})", this.GetPercent(e).ToString("N2") + "%", (e.TransferredBytes / 1000).ToString("N0"), (e.TotalBytes / 1000).ToString("N0")); } }
private void PutObjectProgressEventCallback(object sender, UploadProgressArgs e) { var progressArgs = new UploadProgressArgs(e.IncrementTransferred, e.TransferredBytes, e.TotalBytes, e.CompensationForRetry, _fileTransporterRequest.FilePath); this._fileTransporterRequest.OnRaiseProgressEvent(progressArgs); }
//create album if not found? void _googlePhotosSvc_UploadProgressEvent(object sender, UploadProgressArgs e) { var str = $"{e.fileName} : {(int)e.uploadedBytes.GetSizeInKB()} of {(int)e.totalBytes.GetSizeInKB()} Kb"; Debug.WriteLine(str); childPBar.Tick((int)e.uploadedBytes, str); }
private void UploadFileProgressCallback(object sender, UploadProgressArgs e) { var uploaded = e.TransferredBytes / Math.Pow(1024, 2); var total = e.TotalBytes / Math.Pow(1024, 2); Console.Write("\r" + Math.Round(uploaded, 2) + "/" + Math.Round(total, 2) + " MB (" + e.PercentDone + "%)"); }
/////////////////////////////////////////////////////////////////////////// /// Callback to display progress of Amazon S3 multipart upload /////////////////////////////////////////////////////////////////////////// private void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { // Process event. //Console.Write("Uploading to S3: {0}/{1}", e.TransferredBytes, e.TotalBytes); //Console.SetCursorPosition(0, Console.CursorTop); SourceFileUploadProgressEvent?.Invoke(this, new SourceFileUploadProgressEventArgs(e.TotalBytes, e.TransferredBytes)); }
private void ProgressUploadStatus(object sender, UploadProgressArgs e) { if (e.PercentDone != this._lastReportedStatus) { this._lastReportedStatus = e.PercentDone; AppendStatusLine($" ... Percent Upload: {e.PercentDone} %"); } }
private void UploadPartProgressEventCallback(object sender, UploadProgressArgs e) { long transferredBytes = Interlocked.Add(ref _totalTransferredBytes, e.IncrementTransferred - e.CompensationForRetry); var progressArgs = new UploadProgressArgs(e.IncrementTransferred, transferredBytes, this._contentLength, e.CompensationForRetry, this._fileTransporterRequest.FilePath); this._fileTransporterRequest.OnRaiseProgressEvent(progressArgs); }
private void UploadRequest_UploadProgressEvent(object sender, UploadProgressArgs e) { if (InvokeRequired) { Invoke((MethodInvoker) delegate { uploadProgress.Value = (int)(((float)e.TransferredBytes / (float)e.TotalBytes) * 100.0f); }); } }
private static void UploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { Console.WriteLine( "Tranfering {0} / {1} KB/s, current file: {2}", e.TransferredBytes / 1024, e.TotalBytes / 1024, e.FilePath ); }
private static void TransferUploadProgressEvent(object sender, UploadProgressArgs e) { if (e.TransferredBytes == e.TotalBytes) { bytesUploaded += e.TotalBytes; filesUploaded++; //var file = e.FilePath; uploading.Remove(e.FilePath); } }
private void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { Console.SetCursorPosition(0, 2); Console.Write(new string(' ', Console.WindowWidth - 1)); Console.SetCursorPosition(0, 3); Console.Write(new string(' ', Console.WindowWidth - 1)); Console.SetCursorPosition(0, 4); Console.Write(new string(' ', Console.WindowWidth - 1)); Console.SetCursorPosition(0, 2); Console.Write("Total bytes: {0:N} \r\nSent bytes : {1:N} \r\n% Done: {2}", e.TotalBytes, e.TransferredBytes, e.PercentDone); Console.SetCursorPosition(38, 7); }
private void uploadProgressEventCallback(object sender, UploadProgressArgs e) { int numberOfFilesUploaded = this._numberOfFilesUploaded; if (e.TransferredBytes == e.TotalBytes) { numberOfFilesUploaded++; } this._request.OnRaiseProgressEvent(numberOfFilesUploaded, this._totalNumberOfFiles, this._currentFile, e.TransferredBytes, e.TotalBytes); }
private void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { Process = e.PercentDone; if (_tokenSource.IsCancellationRequested) { Status = "Afbrudt"; } else { Status = e.PercentDone == 100 ? "Uploaded" : "Uploading.."; } }
private void Request_UploadProgressEvent1(object sender, UploadProgressArgs e) { // Değerlerin Açıklamaları : // e.TransferredBytes : Transferi Gerçekleşen Dosya Boyutu (Byte) // e.TotalBytes : Toplam Transfer Gerçekleşcek Dosya Boyutu (Byte) // e.PercentDone : Transfer Gerçekleşme Yüzdesi (%) // e.FilePath : Transfer Edilen Dosyanın Lokal Yolu // Dosya Yükleme gelişmelerini label'a yazdırıyoruz lblUploadStatus.Text = e.TransferredBytes + " / " + e.TotalBytes; txtUploadFileNameStatus.Text = e.FilePath + " Yükleniyor."; prgUploadStatus.Value = e.PercentDone; }
// Uploading protected async void OnProgress(UploadProgressArgs args) { ShowProgressBarPopup = true; this.info = $"{args.Loaded} of {args.Total} bytes."; this.progress = args.Progress; StateHasChanged(); if (args.Loaded == args.Total) { // Delay to give files time to be saved // before reloading file view await LoadFilesAsync(); } }
private void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { Console.WriteLine("File Name:{0}", filePath_); Console.WriteLine("Total Percent:{0}; Number of Done:{1}", e.PercentDone, numberOfDone_); Console.WriteLine("Transferred:{0}/Total:{1}", e.TransferredBytes, e.TotalBytes); if (e.PercentDone == 100) { if (numberOfDone_ == 1) { System.Threading.Thread.Sleep(300); if (System.IO.File.Exists(filePath_)) { System.IO.File.Copy(filePath_, backupFilePath_, true); System.Threading.Thread.Sleep(300); if (!filePath_.Equals("log.csv")) { System.IO.File.Delete(filePath_); } } if (checkDataFolder() > 0) { transmitDataFolderFiles(); } else if (checkemWaveDataFolder() > 0) { transmitemDataFolderFiles(); } else { Common_Util.safeKillemWave(); if (MessageBox.Show("Transmitting Done", "OK", MessageBoxButtons.OK) == DialogResult.OK) { Common_Util.safeKillemWave(); Environment.Exit(0); } } } else { numberOfDone_++; } } }
public void OnTransferProgress(object sender, StreamTransferProgressArgs e) { var compensationForRetry = 0L; if (_lastProgressArgs != null) { if (_lastProgressArgs.TransferredBytes >= e.TransferredBytes) { // The request was retried compensationForRetry = _lastProgressArgs.TransferredBytes; } } var progressArgs = new UploadProgressArgs(e.IncrementTransferred, e.TransferredBytes, e.TotalBytes, compensationForRetry, null); _callback(this, progressArgs); _lastProgressArgs = e; }
void uploadRequest_UploadPartProgressEvent( object sender, UploadProgressArgs e) { ProgressPercentage = e.PercentDone; if (e.PercentDone == 100) { if (Application.Current.Dispatcher.CheckAccess()) { RequesteUploadComplete(new UploadCompleteEventArgs(this)); } else { Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, new System.Action(() => { RequesteUploadComplete(new UploadCompleteEventArgs(this)); })); } } }
private void OnUploadProcess(object sender, UploadProgressArgs e) { var status = string.Format("{0} MB's / {1} MB's", (e.TransferredBytes / 1024d / 1024d).ToString("0.00"), (e.TotalBytes / 1024d / 1024d).ToString("0.00")); Invoke((Action)(() => { ProcessUpload.Value = e.PercentDone; lbPercentUpload.Text = e.PercentDone.ToString() + "%"; if (e.PercentDone == 100) { status = "Upload Completed"; btnChooseFileUpload.Enabled = false; btnStartUpload.Enabled = false; btnCancelUpload.Enabled = false; txtPathUpload.Text = string.Empty; lbBucketNameUpload.Text = string.Empty; txtBuketKeyUpload.Text = string.Empty; groupBucketInfoUpload.Enabled = true; } lbStatusUpload.Text = status; })); }
protected virtual void RaiseUploadProgressEvent(UploadProgressArgs args) => UploadProgressEvent?.Invoke(this, args);
private void UploadProgressEventCallback(object sender, UploadProgressArgs e) { var totalTransferredBytes = Interlocked.Add(ref _transferredBytes, e.IncrementTransferred - e.CompensationForRetry); int numberOfFilesUploaded = _numberOfFilesUploaded; if (e.TransferredBytes == e.TotalBytes) { numberOfFilesUploaded = Interlocked.Increment(ref _numberOfFilesUploaded); } UploadDirectoryProgressArgs uploadDirectoryProgressArgs = null; if (_request.UploadFilesConcurrently) { // If concurrent upload is enabled, values for current file, // transferred and total bytes for current file are not set. uploadDirectoryProgressArgs = new UploadDirectoryProgressArgs(numberOfFilesUploaded, _totalNumberOfFiles, totalTransferredBytes, _totalBytes, null, 0, 0); } else { uploadDirectoryProgressArgs = new UploadDirectoryProgressArgs(numberOfFilesUploaded, _totalNumberOfFiles, totalTransferredBytes, _totalBytes, e.FilePath, e.TransferredBytes, e.TotalBytes); } _request.OnRaiseProgressEvent(uploadDirectoryProgressArgs); }
static void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { // Process event. Console.WriteLine("{0}/{1}", e.TransferredBytes, e.TotalBytes); }
/// <summary> /// Event handler to check the progress of the multi-part upload. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">The object that contains multi-part upload /// information.</param> public static void UploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { // Process event. Console.WriteLine($"{e.TransferredBytes}/{e.TotalBytes}"); }
public void OnTransferProgress(object sender, StreamTransferProgressArgs e) { var compensationForRetry = 0L; if (_lastProgressArgs != null) { if (_lastProgressArgs.TransferredBytes >= e.TransferredBytes) { // The request was retried compensationForRetry = _lastProgressArgs.TransferredBytes; } } var progressArgs = new UploadProgressArgs(e.IncrementTransferred, e.TransferredBytes, e.TotalBytes, compensationForRetry, null); _callback(this, progressArgs); _lastProgressArgs = e; }
private void UploadPartProgressEventCallback(object sender, UploadProgressArgs e) { long transferredBytes = Interlocked.Add(ref _totalTransferredBytes, e.IncrementTransferred - e.CompensationForRetry); var progressArgs = new UploadProgressArgs(e.IncrementTransferred, transferredBytes, this._contentLength, e.CompensationForRetry, this._fileTransporterRequest.FilePath); this._fileTransporterRequest.OnRaiseProgressEvent(progressArgs); }
protected void OnProgress(UploadProgressArgs args) { this.Progress = args.Progress; }
private void uploadProgressEventCallback(object sender, UploadProgressArgs e) { int numberOfFilesUploaded = this._numberOfFilesUploaded; if (e.TransferredBytes == e.TotalBytes) numberOfFilesUploaded++; this._request.OnRaiseProgressEvent(numberOfFilesUploaded, this._totalNumberOfFiles, this._currentFile, e.TransferredBytes, e.TotalBytes); }
private void Request_UploadObjectProgressEvent(object sender, UploadProgressArgs e) { // show progress System.Diagnostics.Debug.WriteLine("=======UpdateFileProgress======="); }
void uploadRequest_UploadProgressEvent(object sender, UploadProgressArgs e) { Console.WriteLine("{0}/{1}", e.TransferredBytes, e.TotalBytes); Progress = e.PercentDone; }
private void UploadProgress(object sender, UploadProgressArgs e) { //TODO: Show upload progress }
private void PutObjectProgressEventCallback(object sender, UploadProgressArgs e) { var progressArgs = new UploadProgressArgs(e.IncrementTransferred, e.TransferredBytes, e.TotalBytes, e.CompensationForRetry, _fileTransporterRequest.FilePath); this._fileTransporterRequest.OnRaiseProgressEvent(progressArgs); }
private static void uploadRequest_UploadPartProgressEvent(object sender, UploadProgressArgs e) { throw new NotImplementedException(); }
private static void Request_UploadProgressEvent(object sender, UploadProgressArgs e) { Debug.WriteLine($"{e.PercentDone}% done"); }
//private async Task<IActionResult> UploadFileAsync(IFormFile file,string keyName) //{ // try // { // var fileTransferUtility = new TransferUtility(this.s3Client); // var fileTransferUtilityRequest = new TransferUtilityUploadRequest // { // BucketName = bucketName, // InputStream = file.OpenReadStream(), // StorageClass = S3StorageClass.Standard, // //PartSize = 6291456, // 6 MB. // Key = keyName, // CannedACL = S3CannedACL.PublicRead // }; // //fileTransferUtilityRequest.UploadProgressEvent += FileTransferUtilityRequest_UploadProgressEvent; // await fileTransferUtility.UploadAsync(fileTransferUtilityRequest); // return Ok(new ServiceResponse { Status = "success", Message = $"https://s3.ap-south-1.amazonaws.com/{bucketName}/{keyName}" }); // } // catch (Exception e) // { // Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message); // return Ok(new ServiceResponse { Status = "error", Message = "Something Went Wrong When Uploading The File" }); // } //} private void FileTransferUtilityRequest_UploadProgressEvent(object sender, UploadProgressArgs e) { HttpContext.Response.WriteAsync(e.PercentDone.ToString()); }