mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
e29cf2a903
Checks.cs initially started out small, but over the years it has grown to handle multiple types of checks. With all these checks next to eachother, it's hard to see the overall groups. Splitting them up (potentially further?) allows for more focused maintenance & understanding. Not sure if I'm happy with the overall bandaids used (checks no longer done within LegalityAnalysis so variable repointing is excessively used), but I'm happier the way it is now compared to the huge Checks.cs
27 lines
1.3 KiB
C#
27 lines
1.3 KiB
C#
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Verification that provides new <see cref="CheckResult"/> values for a <see cref="LegalityAnalysis"/>.
|
|
/// </summary>
|
|
public abstract class Verifier
|
|
{
|
|
/// <summary>
|
|
/// <see cref="CheckResult"/> category.
|
|
/// </summary>
|
|
protected abstract CheckIdentifier Identifier { get; }
|
|
|
|
/// <summary>
|
|
/// Processes the <see cref="data"/> and adds any relevant <see cref="CheckResult"/> values to the <see cref="LegalityAnalysis.Parse"/>.
|
|
/// </summary>
|
|
/// <param name="data">Analysis data to process</param>
|
|
public abstract void Verify(LegalityAnalysis data);
|
|
|
|
protected CheckResult GetInvalid(string msg) => Get(msg, Severity.Invalid);
|
|
protected CheckResult GetValid(string msg) => Get(msg, Severity.Valid);
|
|
protected CheckResult Get(string msg, Severity s) => new CheckResult(s, msg, Identifier);
|
|
|
|
protected static CheckResult GetInvalid(string msg, CheckIdentifier c) => Get(msg, Severity.Invalid, c);
|
|
protected static CheckResult GetValid(string msg, CheckIdentifier c) => Get(msg, Severity.Valid, c);
|
|
protected static CheckResult Get(string msg, Severity s, CheckIdentifier c) => new CheckResult(s, msg, c);
|
|
}
|
|
}
|