PKHeX/PKHeX.Core/Editing/Bulk/ComplexSet/ComplexSet.cs
Kurt d47bb1d297
Update .NET Runtime to .NET 8.0 (#4082)
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
2023-12-03 20:13:20 -08:00

17 lines
668 B
C#

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