SftpUploadAsyncResult.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using Renci.SshNet.Common;
  3. namespace Renci.SshNet.Sftp
  4. {
  5. /// <summary>
  6. /// Encapsulates the results of an asynchronous upload operation.
  7. /// </summary>
  8. public class SftpUploadAsyncResult : AsyncResult
  9. {
  10. /// <summary>
  11. /// Gets or sets a value indicating whether to cancel asynchronous upload operation
  12. /// </summary>
  13. /// <value>
  14. /// <c>true</c> if upload operation to be canceled; otherwise, <c>false</c>.
  15. /// </value>
  16. /// <remarks>
  17. /// Upload operation will be canceled after finishing uploading current buffer.
  18. /// </remarks>
  19. public bool IsUploadCanceled { get; set; }
  20. /// <summary>
  21. /// Gets the number of uploaded bytes.
  22. /// </summary>
  23. public ulong UploadedBytes { get; private set; }
  24. /// <summary>
  25. /// Initializes a new instance of the <see cref="SftpUploadAsyncResult"/> class.
  26. /// </summary>
  27. /// <param name="asyncCallback">The async callback.</param>
  28. /// <param name="state">The state.</param>
  29. public SftpUploadAsyncResult(AsyncCallback asyncCallback, Object state)
  30. : base(asyncCallback, state)
  31. {
  32. }
  33. /// <summary>
  34. /// Updates asynchronous operation status information.
  35. /// </summary>
  36. /// <param name="uploadedBytes">Number of uploaded bytes.</param>
  37. internal void Update(ulong uploadedBytes)
  38. {
  39. UploadedBytes = uploadedBytes;
  40. }
  41. }
  42. }