PKHeX/PKHeX.Core/Editing/Saves/BoxManip/BoxManipModifyComplex.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

22 lines
826 B
C#

using System;
namespace PKHeX.Core;
/// <summary>
/// Modifies contents of boxes by using an <see cref="Action"/> (referencing a Save File) to change data.
/// </summary>
public sealed class BoxManipModifyComplex(BoxManipType Type, Action<PKM, SaveFile> Action, Func<SaveFile, bool> Usable)
: BoxManipBase(Type, Usable)
{
public BoxManipModifyComplex(BoxManipType Type, Action<PKM, SaveFile> Action) : this(Type, Action, _ => true) { }
public override string GetPrompt(bool all) => string.Empty;
public override string GetFail(bool all) => string.Empty;
public override string GetSuccess(bool all) => string.Empty;
public override int Execute(SaveFile sav, BoxManipParam param)
{
var (start, stop, _) = param;
return sav.ModifyBoxes(pk => Action(pk, sav), start, stop);
}
}