SftpRealPathRequest.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Renci.SshNet.Sftp.Responses;
  6. namespace Renci.SshNet.Sftp.Requests
  7. {
  8. internal class SftpRealPathRequest : SftpRequest
  9. {
  10. public override SftpMessageTypes SftpMessageType
  11. {
  12. get { return SftpMessageTypes.RealPath; }
  13. }
  14. public string Path { get; private set; }
  15. public Encoding Encoding { get; private set; }
  16. public SftpRealPathRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpNameResponse> nameAction, Action<SftpStatusResponse> statusAction)
  17. : base(protocolVersion, requestId, statusAction)
  18. {
  19. if (nameAction == null)
  20. throw new ArgumentNullException("name");
  21. if (statusAction == null)
  22. throw new ArgumentNullException("status");
  23. this.Path = path;
  24. this.Encoding = encoding;
  25. this.SetAction(nameAction);
  26. }
  27. protected override void SaveData()
  28. {
  29. base.SaveData();
  30. this.Write(this.Path, this.Encoding);
  31. }
  32. }
  33. }