Skip to content

Commit fbc625c

Browse files
committed
Code QA
1 parent bffce16 commit fbc625c

File tree

5 files changed

+33
-35
lines changed

5 files changed

+33
-35
lines changed

Management/PresetConfig/IPluginPresetConfig.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using Hi3Helper.Plugin.Core.Management.Api;
1+
using Hi3Helper.Plugin.Core.Management.Api;
32
using System.Runtime.InteropServices;
43
using System.Runtime.InteropServices.Marshalling;
54

SharedStatic.Generic.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ public static unsafe int LaunchGameFromGameManagerAsync(nint gameManagerP, nint
5353
try
5454
{
5555
#if MANUALCOM
56-
IPlugin? plugin = ComWrappers.ComInterfaceDispatch.GetInstance<IPlugin>((ComWrappers.ComInterfaceDispatch*)pluginP);
56+
IPlugin? plugin = ComWrappers.ComInterfaceDispatch.GetInstance<IPlugin>((ComWrappers.ComInterfaceDispatch*)pluginP);
5757
IGameManager? gameManager = ComWrappers.ComInterfaceDispatch.GetInstance<IGameManager>((ComWrappers.ComInterfaceDispatch*)gameManagerP);
5858
IPluginPresetConfig? presetConfig = ComWrappers.ComInterfaceDispatch.GetInstance<IPluginPresetConfig>((ComWrappers.ComInterfaceDispatch*)presetConfigP);
5959
#else
60-
IPlugin? plugin = ComInterfaceMarshaller<IPlugin>.ConvertToManaged((void*)pluginP);
60+
IPlugin? plugin = ComInterfaceMarshaller<IPlugin>.ConvertToManaged((void*)pluginP);
6161
IGameManager? gameManager = ComInterfaceMarshaller<IGameManager>.ConvertToManaged((void*)gameManagerP);
6262
IPluginPresetConfig? presetConfig = ComInterfaceMarshaller<IPluginPresetConfig>.ConvertToManaged((void*)presetConfigP);
6363
#endif
@@ -97,11 +97,11 @@ public static unsafe int LaunchGameFromGameManagerAsync(nint gameManagerP, nint
9797

9898
RunGameFromGameManagerContext context = new RunGameFromGameManagerContext
9999
{
100-
GameManager = gameManager,
101-
Plugin = plugin,
102-
PresetConfig = presetConfig,
100+
GameManager = gameManager,
101+
PresetConfig = presetConfig,
102+
Plugin = plugin,
103103
PrintGameLogCallback = null!,
104-
PluginHandle = nint.Zero
104+
PluginHandle = nint.Zero
105105
};
106106

107107
taskResult = ThisPluginExport
@@ -147,11 +147,11 @@ public static unsafe int IsGameRunning(nint gameManagerP, nint presetConfigP, ou
147147

148148
RunGameFromGameManagerContext context = new RunGameFromGameManagerContext
149149
{
150-
GameManager = gameManager,
151-
Plugin = null!,
152-
PresetConfig = presetConfig,
150+
GameManager = gameManager,
151+
PresetConfig = presetConfig,
152+
Plugin = null!,
153153
PrintGameLogCallback = null!,
154-
PluginHandle = nint.Zero
154+
PluginHandle = nint.Zero
155155
};
156156

157157
bool isSupported = ThisPluginExport.IsGameRunningCore(context, out bool isGameRunning);
@@ -176,11 +176,11 @@ public static unsafe int WaitRunningGameAsync(nint gameManagerP, nint pluginP, n
176176
try
177177
{
178178
#if MANUALCOM
179-
IPlugin? plugin = ComWrappers.ComInterfaceDispatch.GetInstance<IPlugin>((ComWrappers.ComInterfaceDispatch*)pluginP);
179+
IPlugin? plugin = ComWrappers.ComInterfaceDispatch.GetInstance<IPlugin>((ComWrappers.ComInterfaceDispatch*)pluginP);
180180
IGameManager? gameManager = ComWrappers.ComInterfaceDispatch.GetInstance<IGameManager>((ComWrappers.ComInterfaceDispatch*)gameManagerP);
181181
IPluginPresetConfig? presetConfig = ComWrappers.ComInterfaceDispatch.GetInstance<IPluginPresetConfig>((ComWrappers.ComInterfaceDispatch*)presetConfigP);
182182
#else
183-
IPlugin? plugin = ComInterfaceMarshaller<IPlugin>.ConvertToManaged((void*)pluginP);
183+
IPlugin? plugin = ComInterfaceMarshaller<IPlugin>.ConvertToManaged((void*)pluginP);
184184
IGameManager? gameManager = ComInterfaceMarshaller<IGameManager>.ConvertToManaged((void*)gameManagerP);
185185
IPluginPresetConfig? presetConfig = ComInterfaceMarshaller<IPluginPresetConfig>.ConvertToManaged((void*)presetConfigP);
186186
#endif
@@ -213,11 +213,11 @@ public static unsafe int WaitRunningGameAsync(nint gameManagerP, nint pluginP, n
213213

214214
RunGameFromGameManagerContext context = new RunGameFromGameManagerContext
215215
{
216-
GameManager = gameManager,
217-
Plugin = plugin,
218-
PresetConfig = presetConfig,
216+
GameManager = gameManager,
217+
PresetConfig = presetConfig,
218+
Plugin = plugin,
219219
PrintGameLogCallback = null!,
220-
PluginHandle = nint.Zero
220+
PluginHandle = nint.Zero
221221
};
222222

223223
taskResult = ThisPluginExport
@@ -263,11 +263,11 @@ public static unsafe int KillRunningGame(nint gameManagerP, nint presetConfigP,
263263

264264
RunGameFromGameManagerContext context = new RunGameFromGameManagerContext
265265
{
266-
GameManager = gameManager,
267-
Plugin = null!,
268-
PresetConfig = presetConfig,
266+
GameManager = gameManager,
267+
PresetConfig = presetConfig,
268+
Plugin = null!,
269269
PrintGameLogCallback = null!,
270-
PluginHandle = nint.Zero
270+
PluginHandle = nint.Zero
271271
};
272272

273273
bool isSupported = ThisPluginExport.KillRunningGameCore(context, out bool wasGameRunning);

Update/PluginManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public class PluginManifestAssetInfo
195195
public long Size { get; set; }
196196

197197
/// <summary>
198-
/// Hash of the asset file in <see cref="MD5"/> format.
198+
/// Hash of the asset file in <see cref="System.Security.Cryptography.MD5"/> format.
199199
/// </summary>
200200
public required byte[] FileHash { get; set; }
201201
}

Utility/GameManagerExtension.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ public class RunGameFromGameManagerContext
125125
/// Returns <c>false</c> if the plugin doesn't have game launch mechanism (or API Standard is equal or lower than v0.1.0).<br/>
126126
/// Otherwise, <c>true</c> if the plugin supports game launch mechanism.
127127
/// </returns>
128-
public static bool IsGameRunning(this RunGameFromGameManagerContext context,
129-
out bool isGameRunning,
130-
[NotNullWhen(false)] out Exception? errorException)
128+
public static bool IsGameRunning(this RunGameFromGameManagerContext context,
129+
out bool isGameRunning,
130+
[NotNullWhen(false)] out Exception? errorException)
131131
{
132132
ArgumentNullException.ThrowIfNull(context, nameof(context));
133133
isGameRunning = false;
@@ -139,7 +139,7 @@ public static bool IsGameRunning(this RunGameFromGameManagerContext context,
139139
return false;
140140
}
141141

142-
nint gameManagerP = GetPointerFromInterface(context.GameManager);
142+
nint gameManagerP = GetPointerFromInterface(context.GameManager);
143143
nint presetConfigP = GetPointerFromInterface(context.PresetConfig);
144144

145145
if (gameManagerP == nint.Zero)
@@ -180,16 +180,16 @@ public static bool IsGameRunning(this RunGameFromGameManagerContext context,
180180
/// </returns>
181181
public static async Task<(bool IsSuccess, Exception? Error)>
182182
WaitRunningGameAsync(this RunGameFromGameManagerContext context,
183-
CancellationToken token)
183+
CancellationToken token)
184184
{
185185
ArgumentNullException.ThrowIfNull(context, nameof(context));
186186
if (!context.PluginHandle.TryGetExport("WaitRunningGameAsync", out SharedStatic.WaitRunningGameAsyncDelegate waitRunningGameAsyncCallback))
187187
{
188188
return (false, new NotSupportedException("Plugin doesn't have WaitRunningGameAsync export in its API definition!"));
189189
}
190190

191-
nint gameManagerP = GetPointerFromInterface(context.GameManager);
192-
nint pluginP = GetPointerFromInterface(context.Plugin);
191+
nint gameManagerP = GetPointerFromInterface(context.GameManager);
192+
nint pluginP = GetPointerFromInterface(context.Plugin);
193193
nint presetConfigP = GetPointerFromInterface(context.PresetConfig);
194194

195195
if (gameManagerP == nint.Zero)
@@ -235,9 +235,9 @@ public static bool IsGameRunning(this RunGameFromGameManagerContext context,
235235
/// Returns <c>false</c> if the plugin doesn't have game launch mechanism (or API Standard is equal or lower than v0.1.0).<br/>
236236
/// Otherwise, <c>true</c> if the plugin supports game launch mechanism.
237237
/// </returns>
238-
public static bool KillRunningGame(this RunGameFromGameManagerContext context,
239-
out bool wasGameRunning,
240-
[NotNullWhen(false)] out Exception? errorException)
238+
public static bool KillRunningGame(this RunGameFromGameManagerContext context,
239+
out bool wasGameRunning,
240+
[NotNullWhen(false)] out Exception? errorException)
241241
{
242242
ArgumentNullException.ThrowIfNull(context, nameof(context));
243243
errorException = null;
@@ -249,7 +249,7 @@ public static bool KillRunningGame(this RunGameFromGameManagerContext context,
249249
return false;
250250
}
251251

252-
nint gameManagerP = GetPointerFromInterface(context.GameManager);
252+
nint gameManagerP = GetPointerFromInterface(context.GameManager);
253253
nint presetConfigP = GetPointerFromInterface(context.PresetConfig);
254254

255255
if (gameManagerP == nint.Zero)

Utility/Json/JsonSerializerExtension.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#if !USELIGHTWEIGHTJSONPARSER
22

33
using System;
4-
using System.Text.Json;
54
using System.Text.Json.Nodes;
65

76
using System.Text.Json.Serialization.Metadata;

0 commit comments

Comments
 (0)