mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-20 09:23:17 +00:00
69fafcab83
* Reuses move parse result objects for each encounter parsed in a LegalityCheck attempt, instead of creating a new object. * Ensures the objects are never-null, and makes cleanup easier. Slightly adjusts some other parts of the moveset validation to reduce allocations.
16 lines
669 B
C#
16 lines
669 B
C#
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Result of a Legality Check
|
|
/// </summary>
|
|
public sealed record CheckResult(Severity Judgement, string Comment, CheckIdentifier Identifier) : ICheckResult
|
|
{
|
|
public bool Valid => Judgement >= Severity.Fishy;
|
|
public string Rating => Judgement.Description();
|
|
|
|
internal CheckResult(CheckIdentifier i) : this(Severity.Valid, LegalityCheckStrings.L_AValid, i) { }
|
|
|
|
public override string ToString() => $"{Identifier}: {Comment}";
|
|
public string Format(string format) => string.Format(format, Rating, Comment);
|
|
public string Format(string format, int index) => string.Format(format, Rating, index, Comment);
|
|
}
|