SftpRenameRequest.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 SftpRenameRequest : SftpRequest
  9. {
  10. public override SftpMessageTypes SftpMessageType
  11. {
  12. get { return SftpMessageTypes.Rename; }
  13. }
  14. public string OldPath { get; private set; }
  15. public string NewPath { get; private set; }
  16. public Encoding Encoding { get; private set; }
  17. public SftpRenameRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Encoding encoding, Action<SftpStatusResponse> statusAction)
  18. : base(protocolVersion, requestId, statusAction)
  19. {
  20. this.OldPath = oldPath;
  21. this.NewPath = newPath;
  22. this.Encoding = encoding;
  23. }
  24. protected override void LoadData()
  25. {
  26. base.LoadData();
  27. this.OldPath = this.ReadString(this.Encoding);
  28. this.NewPath = this.ReadString(this.Encoding);
  29. }
  30. protected override void SaveData()
  31. {
  32. base.SaveData();
  33. this.Write(this.OldPath, this.Encoding);
  34. this.Write(this.NewPath, this.Encoding);
  35. }
  36. }
  37. }