Skip to content

Commit 6e0e5aa

Browse files
committed
Code cleanup + Fix extension methods aren't overriding
1 parent f5ebc3f commit 6e0e5aa

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

SharedStatic.V1Ext.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ internal unsafe delegate HResult GetCurrentDiscordPresenceInfoDelegate(void*
2121
/// <summary>
2222
/// Inherited <see cref="SharedStatic"/> with additional supports for API extensions which require call or property access to derived exports.
2323
/// </summary>
24-
public partial class SharedStaticV1Ext<T> : SharedStaticV1Ext where T : SharedStatic, new()
24+
public partial class SharedStaticV1Ext<T> : SharedStaticV1Ext
25+
where T : SharedStaticV1Ext<T>, new()
2526
{
26-
private static readonly SharedStaticV1Ext<T> ThisExtensionExport;
27+
private static T ThisExtensionExport { get; }
2728

2829
static SharedStaticV1Ext()
2930
{
30-
ThisExtensionExport = new SharedStaticV1Ext<T>();
31+
ThisExtensionExport = new T();
3132

3233
/* ----------------------------------------------------------------------
3334
* Plugin extension exports
3435
* ----------------------------------------------------------------------
3536
* These exports are optional and can be removed if it's not necessarily
3637
* used. These optional exports are included under additional
37-
* functionalities used as a subset of v0.1, which is called "update1"
38-
* feature sets.
38+
* functionalities used as a subset of v0.1 API standard.
3939
*/
4040
InitExtension_Update1Exports();
4141
InitExtension_Update2Exports();

SharedStatic.V1Ext_Update2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ private static unsafe HResult GetCurrentDiscordPresenceInfo(void* presetConfigP,
4040
}
4141

4242
#if MANUALCOM
43-
IPluginPresetConfig? presetConfig = ComWrappers.ComInterfaceDispatch.GetInstance<IPluginPresetConfig>((ComWrappers.ComInterfaceDispatch*)presetConfigP);
43+
IPluginPresetConfig presetConfig = ComWrappers.ComInterfaceDispatch.GetInstance<IPluginPresetConfig>((ComWrappers.ComInterfaceDispatch*)presetConfigP);
4444
#else
4545
IPluginPresetConfig? presetConfig = ComInterfaceMarshaller<IPluginPresetConfig>.ConvertToManaged((void*)presetConfigP);
46-
#endif
4746

4847
if (presetConfig == null)
4948
{
5049
return false;
5150
}
51+
#endif
5252

5353
DiscordPresenceExtension.DiscordPresenceContext context = new(presetConfig);
5454

SharedStatic.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
using Microsoft.Extensions.Logging;
55
using System;
66
using System.Collections.Generic;
7-
using System.Diagnostics;
87
using System.Runtime.InteropServices;
98
using System.Runtime.InteropServices.Marshalling;
10-
using System.Threading;
11-
using System.Threading.Tasks;
12-
13-
using static Hi3Helper.Plugin.Core.Utility.GameManagerExtension;
149

1510
// ReSharper disable CommentTypo
1611

0 commit comments

Comments
 (0)