2017-05-27 21:17:53 -07:00
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2017-10-23 23:12:58 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Result of a Legality Check
|
|
|
|
|
/// </summary>
|
2017-05-27 21:17:53 -07:00
|
|
|
|
public class CheckResult
|
|
|
|
|
{
|
2018-09-05 21:27:52 -07:00
|
|
|
|
public Severity Judgement { get; }
|
|
|
|
|
public CheckIdentifier Identifier { get; }
|
2021-04-18 11:00:40 -07:00
|
|
|
|
public string Comment { get; }
|
2018-09-05 21:27:52 -07:00
|
|
|
|
|
2017-05-27 21:17:53 -07:00
|
|
|
|
public bool Valid => Judgement >= Severity.Fishy;
|
2017-12-11 16:01:24 -08:00
|
|
|
|
public string Rating => Judgement.Description();
|
2017-05-27 21:17:53 -07:00
|
|
|
|
|
2020-05-31 12:12:20 -07:00
|
|
|
|
public override string ToString() => $"{Identifier}: {Comment}";
|
|
|
|
|
|
2018-09-05 21:27:52 -07:00
|
|
|
|
internal CheckResult(CheckIdentifier i)
|
|
|
|
|
{
|
|
|
|
|
Judgement = Severity.Valid;
|
|
|
|
|
Comment = LegalityCheckStrings.L_AValid;
|
|
|
|
|
Identifier = i;
|
|
|
|
|
}
|
2018-08-02 20:11:42 -07:00
|
|
|
|
|
2017-05-27 21:17:53 -07:00
|
|
|
|
internal CheckResult(Severity s, string c, CheckIdentifier i)
|
|
|
|
|
{
|
|
|
|
|
Judgement = s;
|
|
|
|
|
Comment = c;
|
|
|
|
|
Identifier = i;
|
|
|
|
|
}
|
2019-05-11 10:12:14 -07:00
|
|
|
|
|
|
|
|
|
public string Format(string format) => string.Format(format, Rating, Comment);
|
|
|
|
|
public string Format(string format, int index) => string.Format(format, Rating, index, Comment);
|
2017-05-27 21:17:53 -07:00
|
|
|
|
}
|
|
|
|
|
}
|