mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge pull request #94 from DarthAffe/development
Update to CUE.NET v1.0.3 (using the new SDK-checks)
This commit is contained in:
commit
4ec3640fbd
@ -144,8 +144,8 @@
|
|||||||
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath>
|
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="CUE.NET, Version=1.0.2.2, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="CUE.NET, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\CUE.NET.1.0.2.2\lib\net45\CUE.NET.dll</HintPath>
|
<HintPath>..\packages\CUE.NET.1.0.3\lib\net45\CUE.NET.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="GongSolutions.Wpf.DragDrop, Version=0.1.4.3, Culture=neutral, PublicKeyToken=d19974ea350ccea1, processorArchitecture=MSIL">
|
<Reference Include="GongSolutions.Wpf.DragDrop, Version=0.1.4.3, Culture=neutral, PublicKeyToken=d19974ea350ccea1, processorArchitecture=MSIL">
|
||||||
@ -613,7 +613,9 @@
|
|||||||
<None Include="NLog.xsd">
|
<None Include="NLog.xsd">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<AppDesigner Include="Properties\" />
|
<AppDesigner Include="Properties\" />
|
||||||
<Resource Include="Resources\bow.png" />
|
<Resource Include="Resources\bow.png" />
|
||||||
<Content Include="logo.ico">
|
<Content Include="logo.ico">
|
||||||
@ -793,12 +795,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\CUE.NET.1.0.2.2\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.0.2.2\build\net45\CUE.NET.targets')" />
|
<Import Project="..\packages\CUE.NET.1.0.3\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.0.3\build\net45\CUE.NET.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\CUE.NET.1.0.2.2\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.0.2.2\build\net45\CUE.NET.targets'))" />
|
<Error Condition="!Exists('..\packages\CUE.NET.1.0.3\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.0.3\build\net45\CUE.NET.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using CUE.NET;
|
using CUE.NET;
|
||||||
using CUE.NET.Devices.Generic.Enums;
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
using CUE.NET.Exceptions;
|
|
||||||
using Ninject.Extensions.Logging;
|
using Ninject.Extensions.Logging;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Corsair
|
namespace Artemis.DeviceProviders.Corsair
|
||||||
@ -24,8 +22,8 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
public override bool TryEnable()
|
public override bool TryEnable()
|
||||||
{
|
{
|
||||||
CanUse = CanInitializeSdk();
|
CanUse = CanInitializeSdk();
|
||||||
if (CanUse)
|
if (CanUse && !CueSDK.IsInitialized)
|
||||||
CueSDK.HeadsetSDK.UpdateMode = UpdateMode.Manual;
|
CueSDK.Initialize();
|
||||||
|
|
||||||
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse);
|
||||||
return CanUse;
|
return CanUse;
|
||||||
@ -33,7 +31,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
CueSDK.Reinitialize();
|
CueSDK.Reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var leds = CueSDK.HeadsetSDK.Leds.Count();
|
var leds = CueSDK.HeadsetSDK.Leds.Count();
|
||||||
var rect = new Rect(new Size(leds*20, leds*20));
|
var rect = new Rect(new Size(leds * 20, leds * 20));
|
||||||
var img = brush.Dispatcher.Invoke(() =>
|
var img = brush.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
var visual = new DrawingVisual();
|
var visual = new DrawingVisual();
|
||||||
@ -58,37 +56,26 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
{
|
{
|
||||||
corsairLed.Color = ledIndex == 0
|
corsairLed.Color = ledIndex == 0
|
||||||
? img.GetPixel(0, 0)
|
? img.GetPixel(0, 0)
|
||||||
: img.GetPixel((ledIndex + 1)*20 - 1, (ledIndex + 1)*20 - 1);
|
: img.GetPixel((ledIndex + 1) * 20 - 1, (ledIndex + 1) * 20 - 1);
|
||||||
ledIndex++;
|
ledIndex++;
|
||||||
}
|
}
|
||||||
CueSDK.HeadsetSDK.Update(true);
|
|
||||||
|
CueSDK.HeadsetSDK.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CanInitializeSdk()
|
private static bool CanInitializeSdk()
|
||||||
{
|
{
|
||||||
// If already initialized, return result right away
|
// This will skip the check-loop if the SDK is initialized
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
return CueSDK.HeadsetSDK != null;
|
return CueSDK.IsSDKAvailable(CorsairDeviceType.Headset);
|
||||||
|
|
||||||
// Else try to enable the SDK
|
|
||||||
for (var tries = 0; tries < 9; tries++)
|
for (var tries = 0; tries < 9; tries++)
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Headset))
|
||||||
break;
|
return true;
|
||||||
|
Thread.Sleep(2000);
|
||||||
try
|
|
||||||
{
|
|
||||||
CueSDK.Initialize();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if (CueSDK.ProtocolDetails == null)
|
|
||||||
return false;
|
|
||||||
return CueSDK.HeadsetSDK != null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
@ -23,8 +22,8 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
public override bool TryEnable()
|
public override bool TryEnable()
|
||||||
{
|
{
|
||||||
CanUse = CanInitializeSdk();
|
CanUse = CanInitializeSdk();
|
||||||
if (CanUse)
|
if (CanUse && !CueSDK.IsInitialized)
|
||||||
CueSDK.MouseSDK.UpdateMode = UpdateMode.Manual;
|
CueSDK.Initialize();
|
||||||
|
|
||||||
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
Logger.Debug("Attempted to enable Corsair mice. CanUse: {0}", CanUse);
|
||||||
return CanUse;
|
return CanUse;
|
||||||
@ -32,7 +31,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
CueSDK.Reinitialize();
|
CueSDK.Reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var leds = CueSDK.MouseSDK.Leds.Count();
|
var leds = CueSDK.MouseSDK.Leds.Count();
|
||||||
var rect = new Rect(new Size(leds*20, leds*20));
|
var rect = new Rect(new Size(leds * 20, leds * 20));
|
||||||
var img = brush.Dispatcher.Invoke(() =>
|
var img = brush.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
var visual = new DrawingVisual();
|
var visual = new DrawingVisual();
|
||||||
@ -57,38 +56,26 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
{
|
{
|
||||||
corsairLed.Color = ledIndex == 0
|
corsairLed.Color = ledIndex == 0
|
||||||
? img.GetPixel(0, 0)
|
? img.GetPixel(0, 0)
|
||||||
: img.GetPixel((ledIndex + 1)*20 - 1, (ledIndex + 1)*20 - 1);
|
: img.GetPixel((ledIndex + 1) * 20 - 1, (ledIndex + 1) * 20 - 1);
|
||||||
ledIndex++;
|
ledIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CueSDK.MouseSDK.Update(true);
|
CueSDK.MouseSDK.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CanInitializeSdk()
|
private static bool CanInitializeSdk()
|
||||||
{
|
{
|
||||||
// If already initialized, return result right away
|
// This will skip the check-loop if the SDK is initialized
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
return CueSDK.MouseSDK != null;
|
return CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse);
|
||||||
|
|
||||||
// Else try to enable the SDK
|
|
||||||
for (var tries = 0; tries < 9; tries++)
|
for (var tries = 0; tries < 9; tries++)
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Mouse))
|
||||||
break;
|
return true;
|
||||||
|
Thread.Sleep(2000);
|
||||||
try
|
|
||||||
{
|
|
||||||
CueSDK.Initialize();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if (CueSDK.ProtocolDetails == null)
|
|
||||||
return false;
|
|
||||||
return CueSDK.MouseSDK != null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System.Drawing;
|
||||||
using System.Drawing;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using CUE.NET;
|
using CUE.NET;
|
||||||
using CUE.NET.Brushes;
|
using CUE.NET.Brushes;
|
||||||
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
using CUE.NET.Devices.Keyboard;
|
using CUE.NET.Devices.Keyboard;
|
||||||
using Point = System.Drawing.Point;
|
using Point = System.Drawing.Point;
|
||||||
|
|
||||||
@ -14,6 +14,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
public class CorsairRGB : KeyboardProvider
|
public class CorsairRGB : KeyboardProvider
|
||||||
{
|
{
|
||||||
private CorsairKeyboard _keyboard;
|
private CorsairKeyboard _keyboard;
|
||||||
|
private ImageBrush _keyboardBrush;
|
||||||
|
|
||||||
public CorsairRGB()
|
public CorsairRGB()
|
||||||
{
|
{
|
||||||
@ -26,29 +27,17 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
|
|
||||||
public override bool CanEnable()
|
public override bool CanEnable()
|
||||||
{
|
{
|
||||||
// If already initialized, return result right away
|
// This will skip the check-loop if the SDK is initialized
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
return CueSDK.KeyboardSDK != null;
|
return CueSDK.IsSDKAvailable(CorsairDeviceType.Keyboard);
|
||||||
|
|
||||||
// Else try to enable the SDK
|
|
||||||
for (var tries = 0; tries < 9; tries++)
|
for (var tries = 0; tries < 9; tries++)
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsSDKAvailable(CorsairDeviceType.Keyboard))
|
||||||
break;
|
return true;
|
||||||
|
Thread.Sleep(2000);
|
||||||
try
|
|
||||||
{
|
|
||||||
CueSDK.Initialize();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if (CueSDK.ProtocolDetails == null)
|
|
||||||
return false;
|
|
||||||
return CueSDK.KeyboardSDK != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -56,7 +45,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails == null)
|
if (!CueSDK.IsInitialized)
|
||||||
CueSDK.Initialize();
|
CueSDK.Initialize();
|
||||||
|
|
||||||
_keyboard = CueSDK.KeyboardSDK;
|
_keyboard = CueSDK.KeyboardSDK;
|
||||||
@ -83,11 +72,13 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
PreviewSettings = new PreviewSettings(665, 215, new Thickness(0, -5, 0, 0), Resources.strafe);
|
PreviewSettings = new PreviewSettings(665, 215, new Thickness(0, -5, 0, 0), Resources.strafe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails != null)
|
if (CueSDK.IsInitialized)
|
||||||
CueSDK.Reinitialize();
|
CueSDK.Reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,12 +104,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
image = strafeBitmap;
|
image = strafeBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
var brush = new ImageBrush
|
_keyboardBrush.Image = image;
|
||||||
{
|
|
||||||
Image = image
|
|
||||||
};
|
|
||||||
|
|
||||||
_keyboard.Brush = brush;
|
|
||||||
_keyboard.Update();
|
_keyboard.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
|
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Castle.Core" version="3.3.3" targetFramework="net452" />
|
<package id="Castle.Core" version="3.3.3" targetFramework="net452" />
|
||||||
<package id="Colore" version="4.0.0" targetFramework="net452" />
|
<package id="Colore" version="4.0.0" targetFramework="net452" />
|
||||||
<package id="CUE.NET" version="1.0.2.2" targetFramework="net452" />
|
<package id="CUE.NET" version="1.0.3" targetFramework="net452" />
|
||||||
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
|
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
|
||||||
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net452" />
|
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net452" />
|
||||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user