1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Corsair fix attempt

This commit is contained in:
SpoinkyNL 2016-02-22 09:34:39 +01:00
parent b488ddf8eb
commit fe41d940c9

View File

@ -1,4 +1,5 @@
using System.Drawing;
using System.Threading;
using Artemis.Utilities;
using CUE.NET;
using CUE.NET.Brushes;
@ -21,6 +22,10 @@ namespace Artemis.KeyboardProviders.Corsair
}
public override bool CanEnable()
{
// Try for about 10 seconds
var tries = 0;
while (tries < 9)
{
try
{
@ -29,8 +34,11 @@ namespace Artemis.KeyboardProviders.Corsair
catch (CUEException e)
{
if (e.Error == CorsairError.ServerNotFound)
return false;
throw;
{
tries++;
Thread.Sleep(1000);
continue;
}
}
catch (WrapperException)
{
@ -41,6 +49,9 @@ namespace Artemis.KeyboardProviders.Corsair
return true;
}
return false;
}
/// <summary>
/// Enables the SDK and sets updatemode to manual as well as the color of the background to black.
/// </summary>