Device providers - Let's actually include the SDKs!

Core - Enable exceptions during device provider init so that they can be logged
This commit is contained in:
Robert committed 2020-03-02 23:42:33 +01:00
1 parent c3b2c981da
commit 16b221d2f8
13 files changed
+89 -24

No files matched your search

@@ -15,6 +15,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="x64\CMSDK.dll" />
<None Remove="x86\CMSDK.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="x64\CMSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\CMSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -27,7 +27,6 @@ namespace Artemis.Plugins.Devices.Corsair
public override void DisablePlugin()
{
_rgbService.RemoveDeviceProvider(RgbDeviceProvider);
}
public override void Dispose()
@@ -23,6 +23,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="3.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
<Private>false</Private>
@@ -28,6 +28,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="HidSharp" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj" />
</ItemGroup>
@@ -1,19 +1,26 @@
using System.IO;
using System.Linq;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
using HidSharp;
using RGB.NET.Core;
using RGB.NET.Devices.Logitech;
using Serilog;
using Serilog.Events;
namespace Artemis.Plugins.Devices.Logitech
{
public class LogitechDeviceProvider : DeviceProvider
{
private const int VENDOR_ID = 0x046D;
private readonly ILogger _logger;
private readonly IRgbService _rgbService;
public LogitechDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService) : base(pluginInfo, RGB.NET.Devices.Logitech.LogitechDeviceProvider.Instance)
public LogitechDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, ILogger logger) : base(pluginInfo, RGB.NET.Devices.Logitech.LogitechDeviceProvider.Instance)
{
_rgbService = rgbService;
_logger = logger;
}
public override void EnablePlugin()
@@ -22,6 +29,9 @@ namespace Artemis.Plugins.Devices.Logitech
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "LogitechLedEnginesWrapper.dll"));
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX86NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x86", "LogitechLedEnginesWrapper.dll"));
_rgbService.AddDeviceProvider(RgbDeviceProvider);
if (_logger.IsEnabled(LogEventLevel.Debug))
LogDeviceIds();
}
public override void DisablePlugin()
@@ -31,5 +41,13 @@ namespace Artemis.Plugins.Devices.Logitech
public override void Dispose()
{
}
private void LogDeviceIds()
{
var devices = DeviceList.Local.GetHidDevices(VENDOR_ID).ToList();
_logger.Debug("Found {count} Logitech device(s)", devices.Count);
foreach (var hidDevice in devices)
_logger.Debug("Found Logitech device {name} with PID {pid}", hidDevice.GetFriendlyName(), hidDevice.ProductID);
}
}
}
@@ -15,6 +15,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="x64\MysticLight_SDK.dll" />
<None Remove="x86\MysticLight_SDK.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="x64\MysticLight_SDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\MysticLight_SDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -15,6 +15,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="x64\RzChromaSDK.dll" />
<None Remove="x86\RzChromaSDK.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="x64\RzChromaSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\RzChromaSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -15,6 +15,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<None Remove="x64\RoccatTalkSDKWrapper.dll" />
<None Remove="x86\RoccatTalkSDKWrapper.dll" />
</ItemGroup>
<ItemGroup>
<Content Include="x64\RoccatTalkSDKWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\RoccatTalkSDKWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -23,6 +23,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="3.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
<Private>false</Private>