2023-04-23 23:04:04 +00:00
|
|
|
namespace PKHeX.Core;
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Verification that provides new <see cref="CheckResult"/> values for a <see cref="LegalityAnalysis"/>.
|
|
|
|
/// </summary>
|
|
|
|
public abstract class Verifier
|
2018-06-24 05:00:01 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
2022-06-18 18:04:24 +00:00
|
|
|
/// <see cref="CheckResult"/> category.
|
2018-06-24 05:00:01 +00:00
|
|
|
/// </summary>
|
2022-06-18 18:04:24 +00:00
|
|
|
protected abstract CheckIdentifier Identifier { get; }
|
2018-06-24 05:00:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
/// <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);
|
2018-06-24 05:00:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
protected CheckResult GetInvalid(string msg) => Get(msg, Severity.Invalid);
|
|
|
|
protected CheckResult GetValid(string msg) => Get(msg, Severity.Valid);
|
2023-04-23 23:04:04 +00:00
|
|
|
protected CheckResult Get(string msg, Severity s) => new(s, Identifier, msg);
|
2018-06-24 05:00:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
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);
|
2023-04-23 23:04:04 +00:00
|
|
|
protected static CheckResult Get(string msg, Severity s, CheckIdentifier c) => new(s, c, msg);
|
2018-06-24 05:00:01 +00:00
|
|
|
}
|