mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-24 23:57:12 -05:00
Move files, xmldoc, simplify
External check can call AddLine. The intent is to not allow it to remove previous parse results.
This commit is contained in:
parent
90cfa59102
commit
11f33985c4
|
|
@ -3,12 +3,19 @@
|
|||
|
||||
namespace PKHeX.Core.Bulk;
|
||||
|
||||
/// <summary>
|
||||
/// Provides functionality for managing and localizing external bulk checkers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="BulkAnalysis"/> will automatically use the registered external checkers after its bulk checks are complete.
|
||||
/// </remarks>
|
||||
public static class ExternalBulkCheck
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the collection of external legality checkers indexed by their unique identifier.
|
||||
/// </summary>
|
||||
internal static Dictionary<ushort, IExternalBulkChecker> ExternalCheckers { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Registers an external bulk legality checker for use in validation processes.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public LegalityAnalysis(PKM pk, IPersonalInfo pi, StorageSlotType source = Ignor
|
|||
GetParseMethod()();
|
||||
|
||||
foreach (var ext in ExternalLegalityCheck.ExternalCheckers.Values)
|
||||
ext.Check(Parse, this);
|
||||
ext.Verify(this);
|
||||
|
||||
Valid = Parse.TrueForAll(chk => chk.Valid)
|
||||
&& MoveResult.AllValid(Info.Moves)
|
||||
|
|
@ -270,7 +270,7 @@ private void ParsePK9()
|
|||
/// Adds a new Check parse value.
|
||||
/// </summary>
|
||||
/// <param name="chk">Check result to add.</param>
|
||||
internal void AddLine(CheckResult chk) => Parse.Add(chk);
|
||||
public void AddLine(CheckResult chk) => Parse.Add(chk);
|
||||
|
||||
private void UpdateVCTransferInfo()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -12,7 +10,7 @@ namespace PKHeX.Core;
|
|||
/// with the <see cref="CheckResult.Argument"/> set to the <see cref="Identity"/> of this checker.
|
||||
/// You can still use <see cref="CheckResult.Argument2"/> to store values useful for localization, if you must.
|
||||
/// </remarks>
|
||||
public interface IExternalLegalityChecker
|
||||
public interface IExternalLegalityChecker : ILegalityVerifier
|
||||
{
|
||||
/// <summary>
|
||||
/// Friendly name of the legality check, used for display/internal purposes.
|
||||
|
|
@ -24,13 +22,6 @@ public interface IExternalLegalityChecker
|
|||
/// </summary>
|
||||
public ushort Identity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Runs the legality check against the provided data.
|
||||
/// </summary>
|
||||
/// <param name="results">Results to append to.</param>
|
||||
/// <param name="data">Context data for the legality check, after the regular analysis has concluded.</param>
|
||||
void Check(List<CheckResult> results, LegalityAnalysis data);
|
||||
|
||||
/// <summary>
|
||||
/// Requests a localized string for the given check result.
|
||||
/// </summary>
|
||||
|
|
@ -32,3 +32,12 @@ public abstract class Verifier
|
|||
protected static CheckResult GetInvalid(CheckIdentifier c, LegalityCheckResultCode msg, uint value = 0) => CheckResult.Get(Severity.Invalid, c, msg, value);
|
||||
protected static CheckResult GetInvalid(CheckIdentifier c, LegalityCheckResultCode msg, ushort arg0, ushort arg1 = 0) => GetInvalid(c, msg, arg0 | (uint)arg1 << 16);
|
||||
}
|
||||
|
||||
public interface ILegalityVerifier
|
||||
{
|
||||
/// <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>
|
||||
void Verify(LegalityAnalysis data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user