Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions AquaMai.Core/Helpers/Shim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ public static byte[] EncryptNetPacketBody(byte[] data)
return (PacketUpsertUserAll)ctor2.Invoke(args);
};
}
else if (type.GetConstructor(new[]
{
typeof(int),
typeof(UserData),
typeof(int),
typeof(Action<int>),
typeof(Action<PacketStatus>)
}) is ConstructorInfo ctor3)
Comment on lines +192 to +199

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了保持代码风格的一致性,建议使用 C# 12 的集合表达式 [] 来代替 new[] { ... }。这与该方法中前面 ctor1ctor2 的获取方式保持一致,且代码更加简洁易读。

        else if (type.GetConstructor([typeof(int), typeof(UserData), typeof(int), typeof(Action<int>), typeof(Action<PacketStatus>)]) is ConstructorInfo ctor3)

{
return (index, src, onDone, onError) =>
{
var maxTrackNo =
src.IsEntry && !Singleton<GamePlayManager>.Instance.IsEmpty()
? Singleton<GamePlayManager>.Instance.GetScoreListCount()
: 0;

var args = new object[] { index, src, maxTrackNo, onDone, onError };
return (PacketUpsertUserAll)ctor3.Invoke(args);
};
}
else
{
throw new MissingMethodException("No matching PacketUpsertUserAll constructor found");
Expand Down
Loading