PKHeX/PKHeX.Core/Editing/Bulk/ComplexSet/ComplexSet.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00

23 lines
813 B
C#

using System;
namespace PKHeX.Core;
/// <inheritdoc cref="IComplexSet"/>
public sealed class ComplexSet : IComplexSet
{
public readonly string PropertyName;
public readonly Func<string, bool> IsValueCompatible = _ => true;
private readonly Action<PKM, StringInstruction> Action;
public ComplexSet(string propertyName, Action<PKM, StringInstruction> modify)
{
PropertyName = propertyName;
Action = modify;
}
public ComplexSet(string propertyName, Func<string, bool> criteria, Action<PKM, StringInstruction> modify) : this(propertyName, modify) => IsValueCompatible = criteria;
public bool IsMatch(string name, string value) => name == PropertyName && IsValueCompatible(value);
public void Modify(PKM pk, StringInstruction instr) => Action(pk, instr);
}