📄 level.cs
字号:
/// <summary>
/// Returns a value indicating whether a specified <see cref="Level" />
/// is greater than another specified <see cref="Level" />.
/// </summary>
/// <param name="l">A <see cref="Level" /></param>
/// <param name="r">A <see cref="Level" /></param>
/// <returns>
/// <c>true</c> if <paramref name="l" /> is greater than
/// <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator > (Level l, Level r)
{
return l.m_levelValue > r.m_levelValue;
}
/// <summary>
/// Returns a value indicating whether a specified <see cref="Level" />
/// is less than another specified <see cref="Level" />.
/// </summary>
/// <param name="l">A <see cref="Level" /></param>
/// <param name="r">A <see cref="Level" /></param>
/// <returns>
/// <c>true</c> if <paramref name="l" /> is less than
/// <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator < (Level l, Level r)
{
return l.m_levelValue < r.m_levelValue;
}
/// <summary>
/// Returns a value indicating whether a specified <see cref="Level" />
/// is greater than or equal to another specified <see cref="Level" />.
/// </summary>
/// <param name="l">A <see cref="Level" /></param>
/// <param name="r">A <see cref="Level" /></param>
/// <returns>
/// <c>true</c> if <paramref name="l" /> is greater than or equal to
/// <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator >= (Level l, Level r)
{
return l.m_levelValue >= r.m_levelValue;
}
/// <summary>
/// Returns a value indicating whether a specified <see cref="Level" />
/// is less than or equal to another specified <see cref="Level" />.
/// </summary>
/// <param name="l">A <see cref="Level" /></param>
/// <param name="r">A <see cref="Level" /></param>
/// <returns>
/// <c>true</c> if <paramref name="l" /> is less than or equal to
/// <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator <= (Level l, Level r)
{
return l.m_levelValue <= r.m_levelValue;
}
/// <summary>
/// Returns a value indicating whether two specified <see cref="Level" />
/// objects have the same value.
/// </summary>
/// <param name="l">A <see cref="Level" /> or <see langword="null" />.</param>
/// <param name="r">A <see cref="Level" /> or <see langword="null" />.</param>
/// <returns>
/// <c>true</c> if the value of <paramref name="l" /> is the same as the
/// value of <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator == (Level l, Level r)
{
if (((object)l) != null && ((object)r) != null)
{
return l.m_levelValue == r.m_levelValue;
}
else
{
return ((object) l) == ((object) r);
}
}
/// <summary>
/// Returns a value indicating whether two specified <see cref="Level" />
/// objects have different values.
/// </summary>
/// <param name="l">A <see cref="Level" /> or <see langword="null" />.</param>
/// <param name="r">A <see cref="Level" /> or <see langword="null" />.</param>
/// <returns>
/// <c>true</c> if the value of <paramref name="l" /> is different from
/// the value of <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static bool operator != (Level l, Level r)
{
return !(l==r);
}
#endregion Operators
#region Public Static Methods
/// <summary>
/// Compares two specified <see cref="Level"/> instances.
/// </summary>
/// <param name="l">The first <see cref="Level"/> to compare.</param>
/// <param name="r">The second <see cref="Level"/> to compare.</param>
/// <returns>
/// A 32-bit signed integer that indicates the relative order of the
/// two values compared. The return value has these meanings:
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <description>Meaning</description>
/// </listheader>
/// <item>
/// <term>Less than zero</term>
/// <description><paramref name="l" /> is less than <paramref name="r" />.</description>
/// </item>
/// <item>
/// <term>Zero</term>
/// <description><paramref name="l" /> is equal to <paramref name="r" />.</description>
/// </item>
/// <item>
/// <term>Greater than zero</term>
/// <description><paramref name="l" /> is greater than <paramref name="r" />.</description>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// Compares two levels.
/// </para>
/// </remarks>
public static int Compare(Level l, Level r)
{
// Reference equals
if ((object)l == (object)r)
{
return 0;
}
if (l == null && r == null)
{
return 0;
}
if (l == null)
{
return -1;
}
if (r == null)
{
return 1;
}
return l.m_levelValue - r.m_levelValue;
}
#endregion Public Static Methods
#region Public Static Fields
/// <summary>
/// The <see cref="Off" /> level designates a higher level than all the rest.
/// </summary>
public readonly static Level Off = new Level(int.MaxValue, "OFF");
/// <summary>
/// The <see cref="Emergency" /> level designates very severe error events.
/// System unusable, emergencies.
/// </summary>
public readonly static Level Emergency = new Level(120000, "EMERGENCY");
/// <summary>
/// The <see cref="Fatal" /> level designates very severe error events
/// that will presumably lead the application to abort.
/// </summary>
public readonly static Level Fatal = new Level(110000, "FATAL");
/// <summary>
/// The <see cref="Alert" /> level designates very severe error events.
/// Take immediate action, alerts.
/// </summary>
public readonly static Level Alert = new Level(100000, "ALERT");
/// <summary>
/// The <see cref="Critical" /> level designates very severe error events.
/// Critical condition, critical.
/// </summary>
public readonly static Level Critical = new Level(90000, "CRITICAL");
/// <summary>
/// The <see cref="Severe" /> level designates very severe error events.
/// </summary>
public readonly static Level Severe = new Level(80000, "SEVERE");
/// <summary>
/// The <see cref="Error" /> level designates error events that might
/// still allow the application to continue running.
/// </summary>
public readonly static Level Error = new Level(70000, "ERROR");
/// <summary>
/// The <see cref="Warn" /> level designates potentially harmful
/// situations.
/// </summary>
public readonly static Level Warn = new Level(60000, "WARN");
/// <summary>
/// The <see cref="Notice" /> level designates informational messages
/// that highlight the progress of the application at the highest level.
/// </summary>
public readonly static Level Notice = new Level(50000, "NOTICE");
/// <summary>
/// The <see cref="Info" /> level designates informational messages that
/// highlight the progress of the application at coarse-grained level.
/// </summary>
public readonly static Level Info = new Level(40000, "INFO");
/// <summary>
/// The <see cref="Debug" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Debug = new Level(30000, "DEBUG");
/// <summary>
/// The <see cref="Fine" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Fine = new Level(30000, "FINE");
/// <summary>
/// The <see cref="Trace" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Trace = new Level(20000, "TRACE");
/// <summary>
/// The <see cref="Finer" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Finer = new Level(20000, "FINER");
/// <summary>
/// The <see cref="Verbose" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Verbose = new Level(10000, "VERBOSE");
/// <summary>
/// The <see cref="Finest" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
public readonly static Level Finest = new Level(10000, "FINEST");
/// <summary>
/// The <see cref="All" /> level designates the lowest level possible.
/// </summary>
public readonly static Level All = new Level(int.MinValue, "ALL");
#endregion Public Static Fields
#region Private Instance Fields
private readonly int m_levelValue;
private readonly string m_levelName;
private readonly string m_levelDisplayName;
#endregion Private Instance Fields
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -