private void UpdateColor() { while (_client.IsConnected()) { uint color = _client.RequestCurrentColor(); // ----- // We need to bit-shift the color components, // as the Razer ChromaSDK uses the COLORREF from Gdi32.dll // which uses a different arrangement for the color components. // //LEDController: // 0xff000000 = red // 0x00ff0000 = green // 0x0000ff00 = blue // //GDI: // 0x000000ff = red // 0x0000ff00 = green // 0x00ff0000 = blue // ----- byte r = (byte)(color >> 24); byte g = (byte)(color >> 16); byte b = (byte)(color >> 8); ulong gdiColor = (ulong)r | (ulong)g << 8 | (ulong)b << 16; ChromaSDK.setKeyboardColor(gdiColor); ChromaSDK.setMouseColor(gdiColor); Thread.Sleep(40); } }
private void Shutdown() { WinAPI.ShowConsoleWindow(true); Console.WriteLine("\n\n--- Shutting down --- "); _client.Disconnect(); ChromaSDK.unitialize(); Application.Exit(); Console.WriteLine("Shutdown procedure finished, terminating."); Thread.Sleep(1000); Environment.Exit(0); }
static void Main(string[] args) { ChromaSDK.initialize(); new Program(); }