Skip to content

Commit 9a205b0

Browse files
committed
[Breaking change] feat(IMaaCustomAction): add results parameter to Run method
1 parent 3cfc08d commit 9a205b0

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/MaaFramework.Binding.Native/Interop/MaaCustomExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ nint transArg
4444
ActionParam: customActionParam,
4545
RecognitionDetail: recognitionDetail,
4646
RecognitionBox: new MaaRectBuffer(boxHandle)
47-
)
47+
),
48+
new RunResults()
4849
);
4950
};
5051
return callback;

src/MaaFramework.Binding.UnitTests/Test_Custom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ internal sealed class TestAction : IMaaCustomAction
9898
{
9999
public string Name { get; set; } = nameof(TestAction);
100100

101-
public bool Run(in IMaaContext context, in RunArgs args)
101+
public bool Run(in IMaaContext context, in RunArgs args, in RunResults results)
102102
{
103103
Assert.AreEqual(NodeName, args.NodeName);
104104
Assert.AreEqual(ActionParam, args.ActionParam);

src/MaaFramework.Binding/Custom/IMaaCustomAction.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public interface IMaaCustomAction : IMaaCustomResource
1313
/// </summary>
1414
/// <param name="context">The context.</param>
1515
/// <param name="args">The run args.</param>
16+
/// <param name="results">The run results.</param>
1617
/// <returns><see langword="true"/> if the operation was executed successfully; otherwise, <see langword="false"/>.</returns>
17-
bool Run(in IMaaContext context, in RunArgs args);
18+
bool Run(in IMaaContext context, in RunArgs args, in RunResults results);
1819
}
1920

2021
/// <summary>
@@ -27,3 +28,10 @@ public interface IMaaCustomAction : IMaaCustomResource
2728
/// <param name="RecognitionDetail">Gets the recognition detail.</param>
2829
/// <param name="RecognitionBox">Gets the recognition box.</param>
2930
public sealed record RunArgs(string NodeName, TaskDetail TaskDetail, string ActionName, [StringSyntax("Json")] string ActionParam, RecognitionDetail RecognitionDetail, IMaaRectBuffer RecognitionBox);
31+
32+
#pragma warning disable S2094 // Classes should not be empty
33+
/// <summary>
34+
/// The action run results.
35+
/// </summary>
36+
public sealed record RunResults;
37+
#pragma warning restore S2094 // Classes should not be empty

0 commit comments

Comments
 (0)