Skip to content

Commit 4fa224b

Browse files
committed
[Breaking change] chore: improve readability for methods of MaaOptionExtensions
1 parent 55ab55e commit 4fa224b

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/MaaFramework.Binding.UnitTests/Test_Common.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public static void InitializeAssembly(TestContext testContext)
5252
{
5353
ArgumentNullException.ThrowIfNull(testContext);
5454

55-
_ = MaaUtility.Shared.SetOptionLogDir(DebugPath);
56-
_ = MaaUtility.Shared.SetOptionStdoutLevel(LoggingLevel.Off);
55+
_ = MaaUtility.Shared.SetOption_LogDir(DebugPath);
56+
_ = MaaUtility.Shared.SetOption_StdoutLevel(LoggingLevel.Off);
5757

5858
InitializeInfo(testContext);
5959
}

src/MaaFramework.Binding.UnitTests/Test_IMaaController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void InitializeData(AdbInputMethods inputPreset)
6363
.Wait()
6464
.ThrowIfNot(MaaJobStatus.Succeeded);
6565
Assert.IsTrue(
66-
data.SetOption(ControllerOption.ScreenshotTargetShortSide, 720));
66+
data.SetOption_ScreenshotTargetShortSide(720));
6767
}
6868
}
6969
}

src/MaaFramework.Binding.UnitTests/Test_IMaaResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void InitializeClass(TestContext context)
3232
data.Callback += Common.NotificationHandlerRegistry.OnCallback;
3333
data.Callback += Common.OnResourceLoading.ToCallback();
3434

35-
_ = data.SetOption(ResourceOption.InferenceDevice, InferenceDevice.CPU);
35+
_ = data.SetOption_InferenceDevice(InferenceDevice.CPU);
3636
}
3737
}
3838

src/MaaFramework.Binding.UnitTests/Test_IMaaTasker.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public static void InitializeClass(TestContext context)
5252
.Wait()
5353
.ThrowIfNot(MaaJobStatus.Succeeded);
5454
_ = data.Resource
55-
.SetOption(ResourceOption.InferenceDevice, InferenceDevice.CPU);
55+
.SetOption_InferenceDevice(InferenceDevice.CPU);
5656
_ = data.Resource
57-
.SetOption(ResourceOption.InferenceExecutionProvider, InferenceExecutionProvider.CPU);
57+
.SetOption_InferenceExecutionProvider(InferenceExecutionProvider.CPU);
5858
_ = data.Controller
5959
.LinkStart()
6060
.Wait()
6161
.ThrowIfNot(MaaJobStatus.Succeeded);
6262
_ = data.Controller
63-
.SetOption(ControllerOption.ScreenshotTargetShortSide, 720);
63+
.SetOption_ScreenshotTargetShortSide(720);
6464
Assert.IsTrue(data.IsInitialized);
6565
}
6666
}
@@ -328,7 +328,7 @@ public void MaaTaskJob_Query(MaaTypes type, IMaaTasker maaTasker, string taskEnt
328328
{
329329
Assert.IsNotNull(maaTasker);
330330
Assert.IsTrue(
331-
maaTasker.Utility.SetOption(GlobalOption.DebugMode, debugMode));
331+
maaTasker.Utility.SetOption_DebugMode(debugMode));
332332

333333
var job =
334334
maaTasker.AppendTask(taskEntryName, diff);
@@ -358,7 +358,7 @@ public void MaaTaskJob_Query(MaaTypes type, IMaaTasker maaTasker, string taskEnt
358358
}
359359

360360
Assert.IsTrue(
361-
maaTasker.Utility.SetOption(GlobalOption.DebugMode, false));
361+
maaTasker.Utility.SetOption_DebugMode(false));
362362
}
363363

364364
[TestMethod]

src/MaaFramework.Binding/Extensions/MaaOptionExtensions.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,54 @@ namespace MaaFramework.Binding;
1010
public static class MaaOptionExtensions
1111
{
1212
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
13-
public static bool SetOptionScreenshotTargetLongSide(this IMaaOption<ControllerOption>? opt, int value)
13+
public static bool SetOption_ScreenshotTargetLongSide(this IMaaOption<ControllerOption>? opt, int value)
1414
=> opt?.SetOption(ControllerOption.ScreenshotTargetLongSide, value) ?? throw new ArgumentNullException(nameof(opt));
1515

1616
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
17-
public static bool SetOptionScreenshotTargetShortSide(this IMaaOption<ControllerOption>? opt, int value)
17+
public static bool SetOption_ScreenshotTargetShortSide(this IMaaOption<ControllerOption>? opt, int value)
1818
=> opt?.SetOption(ControllerOption.ScreenshotTargetShortSide, value) ?? throw new ArgumentNullException(nameof(opt));
1919

2020
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
21-
public static bool SetOptionScreenshotUseRawSize(this IMaaOption<ControllerOption>? opt, bool value)
21+
public static bool SetOption_ScreenshotUseRawSize(this IMaaOption<ControllerOption>? opt, bool value)
2222
=> opt?.SetOption(ControllerOption.ScreenshotUseRawSize, value) ?? throw new ArgumentNullException(nameof(opt));
2323

2424
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
25-
public static bool SetOptionRecording(this IMaaOption<ControllerOption>? opt, bool value)
25+
public static bool SetOption_Recording(this IMaaOption<ControllerOption>? opt, bool value)
2626
=> opt?.SetOption(ControllerOption.Recording, value) ?? throw new ArgumentNullException(nameof(opt));
2727

2828
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
29-
public static bool SetOptionLogDir(this IMaaOption<GlobalOption>? opt, string value)
29+
public static bool SetOption_LogDir(this IMaaOption<GlobalOption>? opt, string value)
3030
=> opt?.SetOption(GlobalOption.LogDir, value) ?? throw new ArgumentNullException(nameof(opt));
3131

3232
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
33-
public static bool SetOptionSaveDraw(this IMaaOption<GlobalOption>? opt, bool value)
33+
public static bool SetOption_SaveDraw(this IMaaOption<GlobalOption>? opt, bool value)
3434
=> opt?.SetOption(GlobalOption.SaveDraw, value) ?? throw new ArgumentNullException(nameof(opt));
3535

3636
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
37-
public static bool SetOptionRecording(this IMaaOption<GlobalOption>? opt, bool value)
37+
public static bool SetOption_Recording(this IMaaOption<GlobalOption>? opt, bool value)
3838
=> opt?.SetOption(GlobalOption.Recording, value) ?? throw new ArgumentNullException(nameof(opt));
3939

4040
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
41-
public static bool SetOptionStdoutLevel(this IMaaOption<GlobalOption>? opt, LoggingLevel value)
41+
public static bool SetOption_StdoutLevel(this IMaaOption<GlobalOption>? opt, LoggingLevel value)
4242
=> opt?.SetOption(GlobalOption.StdoutLevel, value) ?? throw new ArgumentNullException(nameof(opt));
4343

4444
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
45-
public static bool SetOptionShowHitDraw(this IMaaOption<GlobalOption>? opt, bool value)
45+
public static bool SetOption_ShowHitDraw(this IMaaOption<GlobalOption>? opt, bool value)
4646
=> opt?.SetOption(GlobalOption.ShowHitDraw, value) ?? throw new ArgumentNullException(nameof(opt));
4747

4848
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
49-
public static bool SetOptionDebugMode(this IMaaOption<GlobalOption>? opt, bool value)
49+
public static bool SetOption_DebugMode(this IMaaOption<GlobalOption>? opt, bool value)
5050
=> opt?.SetOption(GlobalOption.DebugMode, value) ?? throw new ArgumentNullException(nameof(opt));
5151

5252
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
53-
public static bool SetOptionInferenceDevice(this IMaaOption<ResourceOption>? opt, InferenceDevice value)
53+
public static bool SetOption_InferenceDevice(this IMaaOption<ResourceOption>? opt, InferenceDevice value)
5454
=> opt?.SetOption(ResourceOption.InferenceDevice, value) ?? throw new ArgumentNullException(nameof(opt));
5555

5656
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
57-
public static bool SetOptionInferenceDevice(this IMaaOption<ResourceOption>? opt, int value)
57+
public static bool SetOption_InferenceDevice(this IMaaOption<ResourceOption>? opt, int value)
5858
=> opt?.SetOption(ResourceOption.InferenceDevice, value) ?? throw new ArgumentNullException(nameof(opt));
5959

6060
/// <inheritdoc cref="IMaaOption{T}.SetOption{T}"/>
61-
public static bool SetOptionInferenceDevice(this IMaaOption<ResourceOption>? opt, InferenceExecutionProvider value)
61+
public static bool SetOption_InferenceExecutionProvider(this IMaaOption<ResourceOption>? opt, InferenceExecutionProvider value)
6262
=> opt?.SetOption(ResourceOption.InferenceExecutionProvider, value) ?? throw new ArgumentNullException(nameof(opt));
6363
}

0 commit comments

Comments
 (0)