using System.Globalization; namespace Renci.SshNet.Messages.Connection { /// /// Base class for all channel specific SSH messages. /// public abstract class ChannelMessage : Message { /// /// Gets or sets the local channel number. /// /// /// The local channel number. /// public uint LocalChannelNumber { get; protected set; } /// /// Gets the size of the message in bytes. /// /// /// The size of the messages in bytes. /// protected override int BufferCapacity { get { var capacity = base.BufferCapacity; capacity += 4; // LocalChannelNumber return capacity; } } /// /// Initializes a new . /// protected ChannelMessage() { } /// /// Initializes a new with the specified local channel number. /// /// The local channel number. protected ChannelMessage(uint localChannelNumber) { LocalChannelNumber = localChannelNumber; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { LocalChannelNumber = ReadUInt32(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { Write(LocalChannelNumber); } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return string.Format(CultureInfo.CurrentCulture, "{0} : #{1}", base.ToString(), LocalChannelNumber); } } }