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

ProtocolVersionExchange

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 SftpStatRequest : SftpRequest { private readonly Action<SftpAttrsResponse> _attrsAction = attrsAction; private byte[] _path; public override SftpMessageTypes SftpMessageType => SftpMessageTypes.Stat; public string Path { get { return Encoding.GetString(_path, 0, _path.Length); } private set { _path = Encoding.GetBytes(value); } } = path; public Encoding Encoding { get; } = encoding; protected override int BufferCapacity => base.BufferCapacity + 4 + _path.Length; public SftpStatRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpAttrsResponse> attrsAction, Action<SftpStatusResponse> statusAction) : base(protocolVersion, requestId, statusAction) { } protected override void LoadData() { base.LoadData(); _path = ReadBinary(); } protected override void SaveData() { base.SaveData(); WriteBinaryString(_path); } public override void Complete(SftpResponse response) { SftpAttrsResponse sftpAttrsResponse = response as SftpAttrsResponse; SftpAttrsResponse sftpAttrsResponse; if (sftpAttrsResponse != null) _attrsAction(sftpAttrsResponse); else base.Complete(response); } } }