SftpDownloadAsyncResult.cs 1.6 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 download operation.
  7. /// </summary>
  8. public class SftpDownloadAsyncResult : AsyncResult
  9. {
  10. /// <summary>
  11. /// Gets or sets a value indicating whether to cancel asynchronous download operation.
  12. /// </summary>
  13. /// <value>
  14. /// <c>true</c> if download operation to be canceled; otherwise, <c>false</c>.
  15. /// </value>
  16. /// <remarks>
  17. /// Download operation will be canceled after finishing uploading current buffer.
  18. /// </remarks>
  19. public bool IsDownloadCanceled { get; set; }
  20. /// <summary>
  21. /// Gets the number of downloaded bytes.
  22. /// </summary>
  23. public ulong DownloadedBytes { get; private set; }
  24. /// <summary>
  25. /// Initializes a new instance of the <see cref="SftpDownloadAsyncResult"/> class.
  26. /// </summary>
  27. /// <param name="asyncCallback">The async callback.</param>
  28. /// <param name="state">The state.</param>
  29. public SftpDownloadAsyncResult(AsyncCallback asyncCallback, Object state)
  30. : base(asyncCallback, state)
  31. {
  32. }
  33. /// <summary>
  34. /// Updates asynchronous operation status information.
  35. /// </summary>
  36. /// <param name="downloadedBytes">Number of downloaded bytes.</param>
  37. internal void Update(ulong downloadedBytes)
  38. {
  39. DownloadedBytes = downloadedBytes;
  40. }
  41. }
  42. }