BreakRequestInfo.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. namespace Renci.SshNet.Messages.Connection
  3. {
  4. /// <summary>
  5. /// Represents "break" type channel request information
  6. /// </summary>
  7. internal class BreakRequestInfo : RequestInfo
  8. {
  9. /// <summary>
  10. /// Channel request name
  11. /// </summary>
  12. public const string NAME = "break";
  13. /// <summary>
  14. /// Gets the name of the request.
  15. /// </summary>
  16. /// <value>
  17. /// The name of the request.
  18. /// </value>
  19. public override string RequestName
  20. {
  21. get { return NAME; }
  22. }
  23. /// <summary>
  24. /// Gets break length in milliseconds.
  25. /// </summary>
  26. public UInt32 BreakLength { get; private set; }
  27. /// <summary>
  28. /// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
  29. /// </summary>
  30. public BreakRequestInfo()
  31. {
  32. this.WantReply = true;
  33. }
  34. /// <summary>
  35. /// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
  36. /// </summary>
  37. /// <param name="breakLength">Length of the break.</param>
  38. public BreakRequestInfo(UInt32 breakLength)
  39. : this()
  40. {
  41. this.BreakLength = breakLength;
  42. }
  43. /// <summary>
  44. /// Called when type specific data need to be loaded.
  45. /// </summary>
  46. protected override void LoadData()
  47. {
  48. base.LoadData();
  49. this.BreakLength = this.ReadUInt32();
  50. }
  51. /// <summary>
  52. /// Called when type specific data need to be saved.
  53. /// </summary>
  54. protected override void SaveData()
  55. {
  56. base.SaveData();
  57. this.Write(this.BreakLength);
  58. }
  59. }
  60. }