SftpInitRequest.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. namespace Renci.SshNet.Sftp.Requests
  2. {
  3. internal class SftpInitRequest : SftpMessage
  4. {
  5. public override SftpMessageTypes SftpMessageType
  6. {
  7. get { return SftpMessageTypes.Init; }
  8. }
  9. public uint Version { get; private set; }
  10. #if TUNING
  11. /// <summary>
  12. /// Gets the size of the message in bytes.
  13. /// </summary>
  14. /// <value>
  15. /// The size of the messages in bytes.
  16. /// </value>
  17. protected override int BufferCapacity
  18. {
  19. get
  20. {
  21. var capacity = base.BufferCapacity;
  22. capacity += 4; // Version
  23. return capacity;
  24. }
  25. }
  26. #endif
  27. public SftpInitRequest(uint version)
  28. {
  29. this.Version = version;
  30. }
  31. protected override void LoadData()
  32. {
  33. base.LoadData();
  34. this.Version = this.ReadUInt32();
  35. }
  36. protected override void SaveData()
  37. {
  38. base.SaveData();
  39. this.Write(this.Version);
  40. }
  41. }
  42. }