using System.Text; namespace Renci.SshNet.Messages.Transport { /// /// Represents SSH_MSG_DISCONNECT message. /// [Message("SSH_MSG_DISCONNECT", 1)] public class DisconnectMessage : Message, IKeyExchangedAllowed { /// /// Gets disconnect reason code. /// public DisconnectReason ReasonCode { get; private set; } /// /// Gets disconnect description. /// public string Description { get; private set; } /// /// Gets message language. /// public string Language { get; private set; } /// /// Initializes a new instance of the class. /// public DisconnectMessage() { } /// /// Initializes a new instance of the class. /// /// The reason code. /// The message. public DisconnectMessage(DisconnectReason reasonCode, string message) { this.ReasonCode = reasonCode; this.Description = message; } /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { this.ReasonCode = (DisconnectReason)this.ReadUInt32(); this.Description = this.ReadString(); this.Language = this.ReadString(); } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { this.Write((uint)this.ReasonCode); this.Write(this.Description); this.Write(this.Language ?? "en"); } } }