PKHeX/PKHeX.Core/Legality/Structures/CheckResult.cs
2021-04-18 11:00:40 -07:00

34 lines
1,018 B
C#

namespace PKHeX.Core
{
/// <summary>
/// Result of a Legality Check
/// </summary>
public class CheckResult
{
public Severity Judgement { get; }
public CheckIdentifier Identifier { get; }
public string Comment { get; }
public bool Valid => Judgement >= Severity.Fishy;
public string Rating => Judgement.Description();
public override string ToString() => $"{Identifier}: {Comment}";
internal CheckResult(CheckIdentifier i)
{
Judgement = Severity.Valid;
Comment = LegalityCheckStrings.L_AValid;
Identifier = i;
}
internal CheckResult(Severity s, string c, CheckIdentifier i)
{
Judgement = s;
Comment = c;
Identifier = i;
}
public string Format(string format) => string.Format(format, Rating, Comment);
public string Format(string format, int index) => string.Format(format, Rating, index, Comment);
}
}