| | | 1 | | namespace Renci.SshNet.Messages.Connection |
| | | 2 | | { |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents "window-change" type channel request information. |
| | | 5 | | /// </summary> |
| | | 6 | | internal sealed class WindowChangeRequestInfo : RequestInfo |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Channe request name. |
| | | 10 | | /// </summary> |
| | | 11 | | public const string Name = "window-change"; |
| | | 12 | | |
| | | 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 | | { |
| | 0 | 21 | | get { return Name; } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets the columns. |
| | | 26 | | /// </summary> |
| | 0 | 27 | | public uint Columns { get; private set; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets the rows. |
| | | 31 | | /// </summary> |
| | 0 | 32 | | public uint Rows { get; private set; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets the width. |
| | | 36 | | /// </summary> |
| | 0 | 37 | | public uint Width { get; private set; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets the height. |
| | | 41 | | /// </summary> |
| | 0 | 42 | | public uint Height { get; private set; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets the size of the message in bytes. |
| | | 46 | | /// </summary> |
| | | 47 | | /// <value> |
| | | 48 | | /// The size of the messages in bytes. |
| | | 49 | | /// </value> |
| | | 50 | | protected override int BufferCapacity |
| | | 51 | | { |
| | | 52 | | get |
| | 0 | 53 | | { |
| | 0 | 54 | | var capacity = base.BufferCapacity; |
| | 0 | 55 | | capacity += 4; // Columns |
| | 0 | 56 | | capacity += 4; // Rows |
| | 0 | 57 | | capacity += 4; // Width |
| | 0 | 58 | | capacity += 4; // Height |
| | 0 | 59 | | return capacity; |
| | 0 | 60 | | } |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Initializes a new instance of the <see cref="WindowChangeRequestInfo"/> class. |
| | | 65 | | /// </summary> |
| | 2804 | 66 | | public WindowChangeRequestInfo() |
| | 2804 | 67 | | { |
| | 2804 | 68 | | WantReply = false; |
| | 2804 | 69 | | } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// Initializes a new instance of the <see cref="WindowChangeRequestInfo"/> class. |
| | | 73 | | /// </summary> |
| | | 74 | | /// <param name="columns">The columns.</param> |
| | | 75 | | /// <param name="rows">The rows.</param> |
| | | 76 | | /// <param name="width">The width.</param> |
| | | 77 | | /// <param name="height">The height.</param> |
| | | 78 | | public WindowChangeRequestInfo(uint columns, uint rows, uint width, uint height) |
| | 0 | 79 | | : this() |
| | 0 | 80 | | { |
| | 0 | 81 | | Columns = columns; |
| | 0 | 82 | | Rows = rows; |
| | 0 | 83 | | Width = width; |
| | 0 | 84 | | Height = height; |
| | 0 | 85 | | } |
| | | 86 | | |
| | | 87 | | /// <summary> |
| | | 88 | | /// Called when type specific data need to be loaded. |
| | | 89 | | /// </summary> |
| | | 90 | | protected override void LoadData() |
| | 0 | 91 | | { |
| | 0 | 92 | | base.LoadData(); |
| | | 93 | | |
| | 0 | 94 | | Columns = ReadUInt32(); |
| | 0 | 95 | | Rows = ReadUInt32(); |
| | 0 | 96 | | Width = ReadUInt32(); |
| | 0 | 97 | | Height = ReadUInt32(); |
| | 0 | 98 | | } |
| | | 99 | | |
| | | 100 | | /// <summary> |
| | | 101 | | /// Called when type specific data need to be saved. |
| | | 102 | | /// </summary> |
| | | 103 | | protected override void SaveData() |
| | 0 | 104 | | { |
| | 0 | 105 | | base.SaveData(); |
| | | 106 | | |
| | 0 | 107 | | Write(Columns); |
| | 0 | 108 | | Write(Rows); |
| | 0 | 109 | | Write(Width); |
| | 0 | 110 | | Write(Height); |
| | 0 | 111 | | } |
| | | 112 | | } |
| | | 113 | | } |