ChannelRequestMessage
using Renci.SshNet.Sftp.Responses;
using System;
using System.Text;
using Renci.SshNet.Sftp.Responses;
using System;
using System.Text;
namespace Renci.SshNet.Sftp.Requests
{
internal sealed class PosixRenameRequest : SftpExtendedRequest
{
private byte[] _oldPath;
private byte[] _newPath;
public string OldPath {
get {
return Encoding.GetString(_oldPath, 0, _oldPath.Length);
}
private set {
_oldPath = Encoding.GetBytes(value);
}
} = oldPath;
public string NewPath {
get {
return Encoding.GetString(_newPath, 0, _newPath.Length);
}
private set {
_newPath = Encoding.GetBytes(value);
}
} = newPath;
public Encoding Encoding { get; } = encoding;
protected override int BufferCapacity => base.BufferCapacity + 4 + _oldPath.Length + 4 + _newPath.Length;
public PosixRenameRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Encoding encoding, Action<SftpStatusResponse> statusAction)
: base(protocolVersion, requestId, statusAction, "posix-rename@openssh.com")
{
}
protected override void SaveData()
{
base.SaveData();
WriteBinaryString(_oldPath);
WriteBinaryString(_newPath);
}
}
}