mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-28 05:17:18 +00:00
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.
22 lines
751 B
C#
22 lines
751 B
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Modifies contents of boxes by using an <see cref="Action"/> to change data.
|
|
/// </summary>
|
|
public sealed class BoxManipModify(BoxManipType type, Action<PKM> Action, Func<SaveFile, bool> Usable)
|
|
: BoxManipBase(type, Usable)
|
|
{
|
|
public BoxManipModify(BoxManipType type, Action<PKM> 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(Action, start, stop);
|
|
}
|
|
}
|