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