ChannelAsyncResult.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Threading;
  3. namespace Renci.SshNet
  4. {
  5. /// <summary>
  6. /// Provides additional information for asynchronous command execution
  7. /// </summary>
  8. public class CommandAsyncResult : IAsyncResult
  9. {
  10. /// <summary>
  11. /// Gets or sets the command that async result was created for.
  12. /// </summary>
  13. /// <value>The channel.</value>
  14. private SshCommand _command;
  15. /// <summary>
  16. /// Gets or sets the bytes received. If SFTP only file bytes are counted.
  17. /// </summary>
  18. /// <value>Total bytes received.</value>
  19. public int BytesReceived { get; set; }
  20. /// <summary>
  21. /// Gets or sets the bytes sent by SFTP.
  22. /// </summary>
  23. /// <value>Total bytes sent.</value>
  24. public int BytesSent { get; set; }
  25. #region IAsyncResult Members
  26. /// <summary>
  27. /// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
  28. /// </summary>
  29. /// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
  30. public object AsyncState { get; internal set; }
  31. /// <summary>
  32. /// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
  33. /// </summary>
  34. /// <returns>A <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.</returns>
  35. public WaitHandle AsyncWaitHandle { get; internal set; }
  36. /// <summary>
  37. /// Gets a value that indicates whether the asynchronous operation completed synchronously.
  38. /// </summary>
  39. /// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
  40. public bool CompletedSynchronously { get; internal set; }
  41. /// <summary>
  42. /// Gets a value that indicates whether the asynchronous operation has completed.
  43. /// </summary>
  44. /// <returns>true if the operation is complete; otherwise, false.</returns>
  45. public bool IsCompleted { get; internal set; }
  46. #endregion
  47. /// <summary>
  48. /// Initializes a new instance of the <see cref="CommandAsyncResult"/> class.
  49. /// </summary>
  50. /// <param name="command">The command.</param>
  51. internal CommandAsyncResult(SshCommand command)
  52. {
  53. this._command = command;
  54. }
  55. }
  56. }