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:
parent
b488ddf8eb
commit
fe41d940c9
@ -1,4 +1,5 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Threading;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using CUE.NET;
|
using CUE.NET;
|
||||||
using CUE.NET.Brushes;
|
using CUE.NET.Brushes;
|
||||||
@ -22,23 +23,33 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
|
|
||||||
public override bool CanEnable()
|
public override bool CanEnable()
|
||||||
{
|
{
|
||||||
try
|
// Try for about 10 seconds
|
||||||
|
var tries = 0;
|
||||||
|
while (tries < 9)
|
||||||
{
|
{
|
||||||
CueSDK.Initialize();
|
try
|
||||||
}
|
{
|
||||||
catch (CUEException e)
|
CueSDK.Initialize();
|
||||||
{
|
}
|
||||||
if (e.Error == CorsairError.ServerNotFound)
|
catch (CUEException e)
|
||||||
return false;
|
{
|
||||||
throw;
|
if (e.Error == CorsairError.ServerNotFound)
|
||||||
}
|
{
|
||||||
catch (WrapperException)
|
tries++;
|
||||||
{
|
Thread.Sleep(1000);
|
||||||
CueSDK.Reinitialize();
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (WrapperException)
|
||||||
|
{
|
||||||
|
CueSDK.Reinitialize();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user