using System; namespace Renci.SshNet.Messages.Authentication { /// /// Represents SSH_MSG_USERAUTH_BANNER message. /// [Message("SSH_MSG_USERAUTH_BANNER", 53)] public class BannerMessage : Message { #if TUNING private byte[] _message; private byte[] _language; #endif /// /// Gets banner message. /// #if TUNING public string Message { get { return Utf8.GetString(_message); } } #else public string Message { get; private set; } #endif /// /// Gets banner language. /// #if TUNING public string Language { get { return Utf8.GetString(_language); } } #else public string Language { get; private set; } #endif #if TUNING /// /// 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; // Message length capacity += _message.Length; // Message capacity += 4; // Language length capacity += _language.Length; // Language return capacity; } } #endif /// /// Called when type specific data need to be loaded. /// protected override void LoadData() { #if TUNING _message = ReadBinary(); _language = ReadBinary(); #else Message = ReadString(); Language = ReadString(); #endif } /// /// Called when type specific data need to be saved. /// protected override void SaveData() { #if TUNING WriteBinaryString(_message); WriteBinaryString(_language); #else Write(Message); Write(Language); #endif } } }