WindowChangeRequestInfo.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. namespace Renci.SshNet.Messages.Connection
  2. {
  3. /// <summary>
  4. /// Represents "window-change" type channel request information
  5. /// </summary>
  6. internal class WindowChangeRequestInfo : RequestInfo
  7. {
  8. /// <summary>
  9. /// Channe request name
  10. /// </summary>
  11. public const string NAME = "window-change";
  12. /// <summary>
  13. /// Gets the name of the request.
  14. /// </summary>
  15. /// <value>
  16. /// The name of the request.
  17. /// </value>
  18. public override string RequestName
  19. {
  20. get { return WindowChangeRequestInfo.NAME; }
  21. }
  22. /// <summary>
  23. /// Gets the columns.
  24. /// </summary>
  25. public uint Columns { get; private set; }
  26. /// <summary>
  27. /// Gets the rows.
  28. /// </summary>
  29. public uint Rows { get; private set; }
  30. /// <summary>
  31. /// Gets the width.
  32. /// </summary>
  33. public uint Width { get; private set; }
  34. /// <summary>
  35. /// Gets the height.
  36. /// </summary>
  37. public uint Height { get; private set; }
  38. /// <summary>
  39. /// Initializes a new instance of the <see cref="WindowChangeRequestInfo"/> class.
  40. /// </summary>
  41. public WindowChangeRequestInfo()
  42. {
  43. this.WantReply = false;
  44. }
  45. /// <summary>
  46. /// Initializes a new instance of the <see cref="WindowChangeRequestInfo"/> class.
  47. /// </summary>
  48. /// <param name="columns">The columns.</param>
  49. /// <param name="rows">The rows.</param>
  50. /// <param name="width">The width.</param>
  51. /// <param name="height">The height.</param>
  52. public WindowChangeRequestInfo(uint columns, uint rows, uint width, uint height)
  53. : this()
  54. {
  55. this.Columns = columns;
  56. this.Rows = rows;
  57. this.Width = width;
  58. this.Height = height;
  59. }
  60. /// <summary>
  61. /// Called when type specific data need to be loaded.
  62. /// </summary>
  63. protected override void LoadData()
  64. {
  65. base.LoadData();
  66. this.Columns = this.ReadUInt32();
  67. this.Rows = this.ReadUInt32();
  68. this.Width = this.ReadUInt32();
  69. this.Height = this.ReadUInt32();
  70. }
  71. /// <summary>
  72. /// Called when type specific data need to be saved.
  73. /// </summary>
  74. protected override void SaveData()
  75. {
  76. base.SaveData();
  77. this.Write(this.Columns);
  78. this.Write(this.Rows);
  79. this.Write(this.Width);
  80. this.Write(this.Height);
  81. }
  82. }
  83. }