ChannelMessage.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Globalization;
  2. namespace Renci.SshNet.Messages.Connection
  3. {
  4. /// <summary>
  5. /// Base class for all channel specific SSH messages.
  6. /// </summary>
  7. public abstract class ChannelMessage : Message
  8. {
  9. /// <summary>
  10. /// Gets or sets the local channel number.
  11. /// </summary>
  12. /// <value>
  13. /// The local channel number.
  14. /// </value>
  15. public uint LocalChannelNumber { get; protected set; }
  16. /// <summary>
  17. /// Called when type specific data need to be loaded.
  18. /// </summary>
  19. protected override void LoadData()
  20. {
  21. LocalChannelNumber = ReadUInt32();
  22. }
  23. /// <summary>
  24. /// Called when type specific data need to be saved.
  25. /// </summary>
  26. protected override void SaveData()
  27. {
  28. Write(LocalChannelNumber);
  29. }
  30. /// <summary>
  31. /// Returns a <see cref="System.String"/> that represents this instance.
  32. /// </summary>
  33. /// <returns>
  34. /// A <see cref="System.String"/> that represents this instance.
  35. /// </returns>
  36. public override string ToString()
  37. {
  38. return string.Format(CultureInfo.CurrentCulture, "{0} : #{1}", base.ToString(), LocalChannelNumber);
  39. }
  40. }
  41. }