-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
28 lines (22 loc) · 813 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Requirements:
'iCUE.exe' is running.
You have a Wireless Corsair Headset
*/
using Dawn.CorsairSDK;
using Dawn.CorsairSDK.Extensions;
using Dawn.CorsairSDK.LowLevel;
var device = CorsairSDK.GetDevices(CorsairDeviceType.CDT_Headset).FirstOrDefault(x => x.HasSupportedProperty(CorsairDevicePropertyId.CDPI_BatteryLevel));
if (device.type == CorsairDeviceType.CDT_Unknown)
{
Console.WriteLine("[!] Could not find any Corsair headsets connected, your headset might be off.");
Environment.Exit(1);
}
var (success, batteryLevel) = device.TryGetBatteryLevel();
if (!success)
{
Console.WriteLine($"[!] Unable to get battery level for '{device.GetModel()}'.");
Environment.Exit(2);
}
Console.WriteLine($"[*] The battery level for '{device.GetModel()}' is {batteryLevel}%");