Added native-unload to all deviceprovider-disposes

This commit is contained in:
DarthAffe committed 2020-03-03 14:30:12 +01:00
1 parent c98ffd2dbf
commit 1cfdeefde1
17 files changed
+60 -29

No files matched your search

@@ -52,7 +52,7 @@ namespace RGB.NET.Devices.Wooting.Native
_arraySetSinglePointer = (ArraySetSinglePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_array_set_single"), typeof(ArraySetSinglePointer));
}
private static void UnloadWootingSDK()
internal static void UnloadWootingSDK()
{
if (_dllHandle == IntPtr.Zero) return;
@@ -91,13 +91,13 @@ namespace RGB.NET.Devices.Wooting.Native
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr GetDeviceInfoPointer();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool KeyboardConnectedPointer();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool ResetPointer();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool ArrayUpdateKeyboardPointer();
@@ -28,13 +28,13 @@ namespace RGB.NET.Devices.Wooting
/// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX86NativePaths { get; } = new List<string> {"x86/wooting-rgb-sdk.dll"};
public static List<string> PossibleX86NativePaths { get; } = new List<string> { "x86/wooting-rgb-sdk.dll" };
/// <summary>
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
/// The first match will be used.
/// </summary>
public static List<string> PossibleX64NativePaths { get; } = new List<string> {"x64/wooting-rgb-sdk64.dll"};
public static List<string> PossibleX64NativePaths { get; } = new List<string> { "x64/wooting-rgb-sdk64.dll" };
/// <inheritdoc />
/// <summary>
@@ -144,9 +144,10 @@ namespace RGB.NET.Devices.Wooting
public void Dispose()
{
try { _WootingSDK.Reset(); }
catch
{ /* Unlucky.. */
}
catch { /* Unlucky.. */ }
try { _WootingSDK.UnloadWootingSDK(); }
catch { /* at least we tried */ }
}
#endregion