2014-01-08 14:16:39 +00:00
|
|
|
namespace AsterNET.Manager.Event
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// A LogChannelEvent is triggered when logging is turned on or off.<br />
|
|
|
|
/// It is implemented in <code>logger.c</code><br />
|
|
|
|
/// </summary>
|
|
|
|
public class LogChannelEvent : ManagerEvent
|
|
|
|
{
|
|
|
|
private string reason;
|
|
|
|
private int reasonCode;
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
public LogChannelEvent(ManagerConnection source)
|
|
|
|
: base(source)
|
|
|
|
{
|
|
|
|
}
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Get/Set if logging has been enabled or disabled.
|
|
|
|
/// </summary>
|
|
|
|
public bool Enabled { get; set; }
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Get the textual representation of the reason for disabling logging.
|
|
|
|
/// </summary>
|
|
|
|
public string Reason
|
|
|
|
{
|
|
|
|
get { return reason; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
reason = "";
|
|
|
|
reasonCode = 0;
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
if (string.IsNullOrEmpty(value))
|
|
|
|
return;
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the reason code for disabling logging.
|
|
|
|
/// </summary>
|
|
|
|
public int ReasonCode
|
|
|
|
{
|
|
|
|
get { return reasonCode; }
|
|
|
|
}
|
|
|
|
}
|
2013-01-18 15:55:50 +00:00
|
|
|
}
|