namespace AsterNET.Manager.Event
{
///
/// A LogChannelEvent is triggered when logging is turned on or off.
/// It is implemented in logger.c
///
public class LogChannelEvent : ManagerEvent
{
private string reason;
private int reasonCode;
public LogChannelEvent(ManagerConnection source)
: base(source)
{
}
///
/// Get/Set if logging has been enabled or disabled.
///
public bool Enabled { get; set; }
///
/// Get the textual representation of the reason for disabling logging.
///
public string Reason
{
get { return reason; }
set
{
reason = "";
reasonCode = 0;
if (string.IsNullOrEmpty(value))
return;
int spaceIdx;
if ((spaceIdx = value.IndexOf(' ')) <= 0)
spaceIdx = value.Length;
int.TryParse(value.Substring(0, spaceIdx), out reasonCode);
if (value.Length > spaceIdx + 3)
reason = value.Substring(spaceIdx + 3, value.Length - spaceIdx + 3);
}
}
///
/// Get the reason code for disabling logging.
///
public int ReasonCode
{
get { return reasonCode; }
}
}
}