<PackageReference Include="SSH.NET" Version="2016.0.0" />

SftpRealPathRequest

using Renci.SshNet.Sftp.Responses; using System; using System.Text; namespace Renci.SshNet.Sftp.Requests { internal class SftpRealPathRequest : SftpRequest { private byte[] _path; public override SftpMessageTypes SftpMessageType => SftpMessageTypes.RealPath; public string Path { get { return Encoding.GetString(_path, 0, _path.Length); } private set { _path = Encoding.GetBytes(value); } } public Encoding Encoding { get; set; } protected override int BufferCapacity => base.BufferCapacity + 4 + _path.Length; public SftpRealPathRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpNameResponse> nameAction, Action<SftpStatusResponse> statusAction) : base(protocolVersion, requestId, statusAction) { if (nameAction == null) throw new ArgumentNullException("nameAction"); if (statusAction == null) throw new ArgumentNullException("statusAction"); Encoding = encoding; Path = path; SetAction(nameAction); } protected override void SaveData() { base.SaveData(); WriteBinaryString(_path); } } }