/// <summary> /// Creates a Corsair device /// </summary> /// <param name="device">The device index</param> internal CorsairDevice(int deviceIndex) { _deviceIndex = deviceIndex; _device = CorsairLightingSDK.GetDeviceInfo(_deviceIndex); _lights = new List <CorsairDeviceLight>(); var positions = CorsairLightingSDK.GetLedPositionsByDeviceIndex(_deviceIndex); foreach (var position in positions.LedPosition) { _lights.Add(new CorsairDeviceLight(new CorsairLedColor() { LedId = position.LedId })); } }
/// <summary> /// Lists the devices. /// </summary> /// <returns></returns> public Device[] ListDevices() { int deviceCount = CorsairLightingSDK.GetDeviceCount(); if (deviceCount > 0) { Device[] devices = new Device[deviceCount]; for (int i = 0; i < deviceCount; i++) { CorsairDeviceInfo deviceInfo = CorsairLightingSDK.GetDeviceInfo(i); CorsairLedPositions positions = GetLedPositions(i); List <Led> leds = new List <Led>(); for (int j = 0; j < positions.LedPosition.Length; j++) { leds.Add(new Led(positions.LedPosition[j])); } devices[i] = new Device(deviceInfo, i, leds); RefreshDeviceColor(devices[i]); } return(devices); } return(new Device[0]); }