using System;
using Renci.SshNet.Sftp.Responses;
namespace Renci.SshNet.Sftp.Requests
{
internal sealed class SftpCloseRequest : SftpRequest
{
public override SftpMessageTypes SftpMessageType
{
get { return SftpMessageTypes.Close; }
}
public byte[] Handle { get; private set; }
///
/// Gets the size of the message in bytes.
///
///
/// The size of the messages in bytes.
///
protected override int BufferCapacity
{
get
{
var capacity = base.BufferCapacity;
capacity += 4; // Handle length
capacity += Handle.Length; // Handle
return capacity;
}
}
public SftpCloseRequest(uint protocolVersion, uint requestId, byte[] handle, Action statusAction)
: base(protocolVersion, requestId, statusAction)
{
Handle = handle;
}
protected override void LoadData()
{
base.LoadData();
Handle = ReadBinary();
}
protected override void SaveData()
{
base.SaveData();
WriteBinaryString(Handle);
}
}
}