FileStatusCommand.cs 850 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Renci.SshClient.Sftp.Messages;
  6. namespace Renci.SshClient.Sftp
  7. {
  8. internal class FileStatusCommand : SftpCommand
  9. {
  10. private string _path;
  11. public SftpFile SftpFile { get; private set; }
  12. public FileStatusCommand(SftpSession sftpSession, string path)
  13. : base(sftpSession)
  14. {
  15. this._path = path;
  16. }
  17. protected override void OnExecute()
  18. {
  19. this.SendStatMessage(this._path);
  20. }
  21. protected override void OnAttributes(Attributes attributes)
  22. {
  23. base.OnAttributes(attributes);
  24. this.SftpFile = new SftpFile(this._path, attributes);
  25. this.CompleteExecution();
  26. }
  27. }
  28. }