| | | 1 | | using System; |
| | | 2 | | using Renci.SshNet.Sftp.Responses; |
| | | 3 | | |
| | | 4 | | namespace Renci.SshNet.Sftp.Requests |
| | | 5 | | { |
| | | 6 | | internal sealed class SftpCloseRequest : SftpRequest |
| | | 7 | | { |
| | | 8 | | public override SftpMessageTypes SftpMessageType |
| | | 9 | | { |
| | 1188 | 10 | | get { return SftpMessageTypes.Close; } |
| | | 11 | | } |
| | | 12 | | |
| | 1188 | 13 | | public byte[] Handle { get; private set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets the size of the message in bytes. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <value> |
| | | 19 | | /// The size of the messages in bytes. |
| | | 20 | | /// </value> |
| | | 21 | | protected override int BufferCapacity |
| | | 22 | | { |
| | | 23 | | get |
| | 393 | 24 | | { |
| | 393 | 25 | | var capacity = base.BufferCapacity; |
| | 393 | 26 | | capacity += 4; // Handle length |
| | 393 | 27 | | capacity += Handle.Length; // Handle |
| | 393 | 28 | | return capacity; |
| | 393 | 29 | | } |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | public SftpCloseRequest(uint protocolVersion, uint requestId, byte[] handle, Action<SftpStatusResponse> statusAc |
| | 399 | 33 | | : base(protocolVersion, requestId, statusAction) |
| | 399 | 34 | | { |
| | 399 | 35 | | Handle = handle; |
| | 399 | 36 | | } |
| | | 37 | | |
| | | 38 | | protected override void LoadData() |
| | 0 | 39 | | { |
| | 0 | 40 | | base.LoadData(); |
| | 0 | 41 | | Handle = ReadBinary(); |
| | 0 | 42 | | } |
| | | 43 | | |
| | | 44 | | protected override void SaveData() |
| | 393 | 45 | | { |
| | 393 | 46 | | base.SaveData(); |
| | 393 | 47 | | WriteBinaryString(Handle); |
| | 393 | 48 | | } |
| | | 49 | | } |
| | | 50 | | } |