PKHeX/PKHeX.Core/Legality/Structures/Severity.cs
Kurt d47bb1d297
Update .NET Runtime to .NET 8.0 (#4082)
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
2023-12-03 20:13:20 -08:00

43 lines
1.1 KiB
C#

using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core;
/// <summary> Severity indication of the associated <see cref="CheckResult"/> </summary>
/// <remarks>
/// Severity &gt;= <see cref="Valid"/> is green
/// Severity == <see cref="Fishy"/> is yellow
/// Severity &lt;= <see cref="Invalid"/> is red
/// </remarks>
public enum Severity : sbyte
{
/// <summary>
/// Definitively not valid.
/// </summary>
Invalid = -1,
/// <summary>
/// Suspicious values, but still valid.
/// </summary>
Fishy = 0,
/// <summary>
/// Values are valid.
/// </summary>
Valid = 1,
}
public static partial class Extensions
{
/// <summary>
/// Converts a Check result Severity determination (Valid/Invalid/etc.) to the localized string.
/// </summary>
/// <param name="s"><see cref="Severity"/> value to convert to string.</param>
/// <returns>Localized <see cref="string"/>.</returns>
public static string Description(this Severity s) => s switch
{
Severity.Invalid => L_SInvalid,
Severity.Fishy => L_SFishy,
Severity.Valid => L_SValid,
_ => L_SNotImplemented,
};
}