Skip to content

Commit

Permalink
chore: reorder constructor arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
moomiji committed Jan 3, 2024
1 parent 0f405d4 commit fbd15af
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public static MaaAdbControllerGrpc ToAdbControllerGrpc(this DeviceInfo info,
string? address = null,
AdbControllerTypes? type = null,
string? adbConfig = null,
CheckStatusOption check = CheckStatusOption.ThrowIfNotSuccess,
LinkOption link = LinkOption.Start)
LinkOption link = LinkOption.Start,
CheckStatusOption check = CheckStatusOption.ThrowIfNotSuccess)
{
ArgumentNullException.ThrowIfNull(info);

Expand All @@ -27,7 +27,7 @@ public static MaaAdbControllerGrpc ToAdbControllerGrpc(this DeviceInfo info,
type ?? info.AdbTypes,
adbConfig ?? info.AdbConfig,
agentPath,
check,
link);
link,
check);
}
}
8 changes: 4 additions & 4 deletions src/MaaFramework.Binding.Grpc/MaaAdbControllerGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public MaaAdbControllerGrpc(GrpcChannel channel, string adbPath, string address,
{
}

/// <inheritdoc cref="MaaAdbControllerGrpc(GrpcChannel, string, string, AdbControllerTypes, string, string, CheckStatusOption, LinkOption)"/>
/// <inheritdoc cref="MaaAdbControllerGrpc(GrpcChannel, string, string, AdbControllerTypes, string, string, LinkOption, CheckStatusOption)"/>
public MaaAdbControllerGrpc(GrpcChannel channel, string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, LinkOption link)
: this(channel, adbPath, address, type, adbConfig, agentPath, CheckStatusOption.ThrowIfNotSuccess, link)
: this(channel, adbPath, address, type, adbConfig, agentPath, link, CheckStatusOption.ThrowIfNotSuccess)
{
}

Expand All @@ -30,11 +30,11 @@ public MaaAdbControllerGrpc(GrpcChannel channel, string adbPath, string address,
/// <param name="type">The AdbControllerTypes including touch type, key type and screencap type.</param>
/// <param name="adbConfig">The path of adb config file.</param>
/// <param name="agentPath">The path of agent directory.</param>
/// <param name="check">Checks LinkStart().Wait() status if true; otherwise, not check.</param>
/// <param name="link">Executes <see cref="MaaControllerGrpc.LinkStart"/> if true; otherwise, not link.</param>
/// <param name="check">Checks LinkStart().Wait() status if true; otherwise, not check.</param>
/// <exception cref="ArgumentException" />
/// <exception cref="MaaJobStatusException" />
public MaaAdbControllerGrpc(GrpcChannel channel, string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, CheckStatusOption check, LinkOption link)
public MaaAdbControllerGrpc(GrpcChannel channel, string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, LinkOption link, CheckStatusOption check)
: base(channel)
{
ArgumentException.ThrowIfNullOrEmpty(adbPath);
Expand Down
2 changes: 1 addition & 1 deletion src/MaaFramework.Binding.Grpc/MaaControllerGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace MaaFramework.Binding;
/// <summary>
/// A wrapper class providing a reference implementation for <see cref="MaaFramework.Binding.Interop.Grpc.Controller"/>.
/// </summary>
public class MaaControllerGrpc : MaaCommonGrpc, IMaaController<string>
public abstract class MaaControllerGrpc : MaaCommonGrpc, IMaaController<string>
{
private ControllerClient _client = default!;

Expand Down
4 changes: 2 additions & 2 deletions src/MaaFramework.Binding.Grpc/MaaInstanceGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public MaaInstanceGrpc(GrpcChannel channel)
}

/// <param name="channel">The channel to use to make remote calls.</param>
/// <param name="resource">The resource.</param>
/// <param name="controller">The controller.</param>
/// <param name="resource">The resource.</param>
/// <param name="disposeOptions">The dispose options.</param>
/// <inheritdoc cref="MaaInstanceGrpc(GrpcChannel)"/>
[SetsRequiredMembers]
public MaaInstanceGrpc(GrpcChannel channel, IMaaResource<string> resource, IMaaController<string> controller, DisposeOptions disposeOptions)
public MaaInstanceGrpc(GrpcChannel channel, IMaaController<string> controller, IMaaResource<string> resource, DisposeOptions disposeOptions)
: this(channel)
{
Resource = resource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public static MaaAdbController ToAdbController(this DeviceInfo info,
string? address = null,
AdbControllerTypes? type = null,
string? adbConfig = null,
CheckStatusOption check = CheckStatusOption.ThrowIfNotSuccess,
LinkOption link = LinkOption.Start)
LinkOption link = LinkOption.Start,
CheckStatusOption check = CheckStatusOption.ThrowIfNotSuccess)
{
ArgumentNullException.ThrowIfNull(info);

Expand All @@ -23,7 +23,7 @@ public static MaaAdbController ToAdbController(this DeviceInfo info,
type ?? info.AdbTypes,
adbConfig ?? info.AdbConfig,
agentPath,
check,
link);
link,
check);
}
}
2 changes: 1 addition & 1 deletion src/MaaFramework.Binding.Native/MaaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace MaaFramework.Binding;
/// <summary>
/// A wrapper class providing a reference implementation for <see cref="MaaFramework.Binding.Interop.Native.MaaController"/>.
/// </summary>
public class MaaController : MaaCommon, IMaaController<nint>
public abstract class MaaController : MaaCommon, IMaaController<nint>
{
/// <summary>
/// Creates a <see cref="MaaController"/> instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public MaaAdbController(string adbPath, string address, AdbControllerTypes type,
{
}

/// <inheritdoc cref="MaaAdbController(string, string, AdbControllerTypes, string, string, CheckStatusOption, LinkOption)"/>
/// <inheritdoc cref="MaaAdbController(string, string, AdbControllerTypes, string, string, LinkOption, CheckStatusOption)"/>
public MaaAdbController(string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, LinkOption link)
: this(adbPath, address, type, adbConfig, agentPath, CheckStatusOption.ThrowIfNotSuccess, link)
: this(adbPath, address, type, adbConfig, agentPath, link, CheckStatusOption.ThrowIfNotSuccess)
{
}

Expand All @@ -27,14 +27,14 @@ public MaaAdbController(string adbPath, string address, AdbControllerTypes type,
/// <param name="type">The AdbControllerTypes including touch type, key type and screencap type.</param>
/// <param name="adbConfig">The path of adb config file.</param>
/// <param name="agentPath">The path of agent directory.</param>
/// <param name="check">Checks LinkStart().Wait() status if true; otherwise, not check.</param>
/// <param name="link">Executes <see cref="MaaController.LinkStart"/> if true; otherwise, not link.</param>
/// <param name="check">Checks LinkStart().Wait() status if true; otherwise, not check.</param>
/// <remarks>
/// Wrapper of <see cref="MaaAdbControllerCreateV2"/>.
/// </remarks>
/// <exception cref="ArgumentException" />
/// <exception cref="MaaJobStatusException" />
public MaaAdbController(string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, CheckStatusOption check, LinkOption link)
public MaaAdbController(string adbPath, string address, AdbControllerTypes type, string adbConfig, string agentPath, LinkOption link, CheckStatusOption check)
{
ArgumentException.ThrowIfNullOrEmpty(adbPath);
ArgumentException.ThrowIfNullOrEmpty(address);
Expand Down
4 changes: 2 additions & 2 deletions src/MaaFramework.Binding.Native/MaaInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public MaaInstance()
SetHandle(handle, needReleased: true);
}

/// <param name="resource">The resource.</param>
/// <param name="controller">The controller.</param>
/// <param name="resource">The resource.</param>
/// <param name="disposeOptions">The dispose options.</param>
/// <inheritdoc cref="MaaInstance()"/>
[SetsRequiredMembers]
public MaaInstance(IMaaResource<nint> resource, IMaaController<nint> controller, DisposeOptions disposeOptions)
public MaaInstance(IMaaController<nint> controller, IMaaResource<nint> resource, DisposeOptions disposeOptions)
: this()
{
Resource = resource;
Expand Down
8 changes: 4 additions & 4 deletions src/MaaFramework.Binding.UnitTests/Test_IMaaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public void CreateInstances()
AdbControllerTypes.InputPresetAdb | AdbControllerTypes.ScreencapEncode,
Common.AdbConfig,
Common.AgentPath,
CheckStatusOption.None,
LinkOption.Start);
LinkOption.Start,
CheckStatusOption.None);

using var grpc1 = new MaaAdbControllerGrpc(
Common.GrpcChannel,
Expand All @@ -108,8 +108,8 @@ public void CreateInstances()
AdbControllerTypes.InputPresetAdb | AdbControllerTypes.ScreencapEncode,
Common.AdbConfig,
Common.AgentPath,
CheckStatusOption.None,
LinkOption.Start);
LinkOption.Start,
CheckStatusOption.None);
}
#pragma warning restore S2699 // Tests should include assertions

Expand Down
4 changes: 2 additions & 2 deletions src/MaaFramework.Binding.UnitTests/Test_IMaaInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ public void CreateInstances()
Controller = nativeController,
DisposeOptions = DisposeOptions.None,
};
using var native2 = new MaaInstance(nativeResource, nativeController, DisposeOptions.None);
using var native2 = new MaaInstance(nativeController, nativeResource, DisposeOptions.None);

using var grpc1 = new MaaInstanceGrpc(Common.GrpcChannel)
{
Resource = grpcResource,
Controller = grpcController,
DisposeOptions = DisposeOptions.None,
};
using var grpc2 = new MaaInstanceGrpc(Common.GrpcChannel, grpcResource, grpcController, DisposeOptions.None);
using var grpc2 = new MaaInstanceGrpc(Common.GrpcChannel, grpcController, grpcResource, DisposeOptions.None);
}
#pragma warning restore S2699 // Tests should include assertions

Expand Down

0 comments on commit fbd15af

Please sign in to comment.