BreakRequestInfo.cs 1.9 KB

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