//public void setScore(string json, Action<object> callback) //{ // try // { // print("setScore"); // dynamic jsonObject = JsonConvert.DeserializeObject(json); // int score = (int)jsonObject.score; // keyboard.SetScore(score); // if (callback == null) // { // return; // } // Task.Run(() => callback(true)); // } // catch (Exception) // { // Task.Run(() => callback(false)); // } //} public void Initialize(Action <object> callback, bool runWithoutKeyboard = false) { if (!runWithoutKeyboard) { if (!CueSDK.IsInitialized) { CueSDK.Initialize(); } RocketLeagueLib.keyboard = CueSDK.KeyboardSDK; RocketLeagueLib.keyboard.Brush = (SolidColorBrush)Color.Transparent; RocketLeagueLib.runWithoutKeyboard = runWithoutKeyboard; } if (callback == null) { return; } Task.Run(() => { try { callback("initialized"); } catch (Exception) { callback("failed to initialize"); } }); }
private void Initialize() { try { _logger.Debug("Starting registration of CUE devices in IoC..."); IoC.Instance .RegisterSingleton <IKeyboardEffect>(typeof(CorsairKeyboardEffect)) .RegisterSingleton <IMouseEffect>(typeof(CorsairMouseEffect)); _logger.Debug("Registration done"); _logger.Debug("Initializing CueSDK..."); CueSDK.Initialize(true); _logger.Debug("CueSDK initialization done"); _logger.Info("--- CueSDK info ---"); _logger.Info("Architecture " + CueSDK.LoadedArchitecture); _logger.Info("Version " + CueSDK.ProtocolDetails.SdkVersion); _logger.Info("Server version " + CueSDK.ProtocolDetails.ServerVersion); _logger.Info("Protocol version " + CueSDK.ProtocolDetails.SdkProtocolVersion); _logger.Info("Breaking changes " + CueSDK.ProtocolDetails.BreakingChanges); _logger.Info("---"); _logger.Debug("Updating CueSDK mode to 'Continuous'..."); CueSDK.UpdateMode = UpdateMode.Continuous; _logger.Debug("CueSDK mode update done"); } catch (Exception ex) { _logger.Error("Failed to initialize CueSDK with exception type '" + ex.GetType() + " and error '" + ex.Message + "'", ex); throw new DeviceInitializationException(ex.Message, ex); } }
static void InitializeKeyboard(bool firstTime = false) { Led = null; try { if (firstTime) { CueSDK.Initialize(); } else { CueSDK.Reinitialize(); } Led = CueSDK.KeyboardSDK[KeyboardKey].Led; } catch { if (!firstTime) { try { InitializeKeyboard(true); } catch { // ignore } } } }
private void SetupNetwork(string ip) { _localIp = ip; _sendToAddress = IPAddress.Parse(ip); _sendingEndPoint = new IPEndPoint(_sendToAddress, 56700); try { CueSDK.Initialize(); if (CueSDK.KeyboardSDK != null) { CueSDK.KeyboardSDK.Brush = (SolidColorBrush)System.Drawing.Color.Transparent; } if (CueSDK.MouseSDK != null) { CueSDK.MouseSDK.Brush = (SolidColorBrush)System.Drawing.Color.Transparent; } Mouse = CueSDK.MouseSDK; Keyboard = CueSDK.KeyboardSDK; if (Keyboard != null) { KeyboardLedDictionary = Keyboard.Leds.ToDictionary(x => x.Id.ToString(), x => x); } } catch (Exception e) { } auraSDK = new AuraSDK(); }
public override bool TryEnable() { try { lock (CorsairUtilities.SDKLock) { CanUse = CanInitializeSdk(); if (CanUse && !CueSDK.IsInitialized) { CueSDK.Initialize(true); } } } catch (Exception) { CanUse = false; } Logger.Debug("Attempted to enable Corsair mousemat. CanUse: {0}", CanUse); if (CanUse) { CueSDK.UpdateMode = UpdateMode.Manual; CueSDK.MousematSDK.Brush = _mousematBrush; } return(CanUse); }
public override bool TryEnable() { try { CanUse = CanInitializeSdk(); if (CanUse && !CueSDK.IsInitialized) { CueSDK.Initialize(); } } catch (Exception) { CanUse = false; } Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse); if (CanUse) { CueSDK.UpdateMode = UpdateMode.Manual; CueSDK.HeadsetSDK.Brush = _headsetBrush; } return(CanUse); }
public static void EndGame() { Console.WriteLine("You Died!"); _movementThread.Abort(); _tickerThread.Abort(); CueSDK.Reinitialize(); }
public override void Disable() { if (CueSDK.IsInitialized) { CueSDK.Reinitialize(); } }
/// <summary> /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. /// </summary> public override void Enable() { lock (CorsairUtilities.SDKLock) { if (!CueSDK.IsInitialized) { CueSDK.Initialize(true); } } CueSDK.UpdateMode = UpdateMode.Manual; _keyboard = CueSDK.KeyboardSDK; switch (_keyboard.DeviceInfo.Model) { case "K95 RGB": Height = 7; Width = 25; Slug = "corsair-k95-rgb"; PreviewSettings = new PreviewSettings(new Rect(20, 26, 1066, 282), Resources.k95); break; case "K95 RGB PLATINUM": Height = 9; Width = 22; Slug = "corsair-k95-rgb-platinum"; PreviewSettings = new PreviewSettings(new Rect(12, 1, 1075, 346), Resources.k95_platinum); break; case "K70 RGB": case "K70 RGB RAPIDFIRE": case "K70 LUX RGB": Height = 7; Width = 21; Slug = "corsair-k70-rgb"; PreviewSettings = new PreviewSettings(new Rect(15, 26, 929, 282), Resources.k70); break; case "K65 RGB": case "CGK65 RGB": case "K65 LUX RGB": case "K65 RGB RAPIDFIRE": Height = 7; Width = 18; Slug = "corsair-k65-rgb"; PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65); break; case "STRAFE RGB": Height = 8; Width = 22; Slug = "corsair-strafe-rgb"; PreviewSettings = new PreviewSettings(new Rect(23, 12, 937, 324), Resources.strafe); break; } Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model); _keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush()); }
public static void InitializeSdk() { CueSDK.Initialize(); if (!CueSDK.InitializedDevices.Any()) { throw new WrapperException("No devices detected."); } }
private void SyncWithCorsairKeyboard_Click(object sender, RoutedEventArgs e) { graphicsCard.DisableLights(); CorsairKeyboard keyboard = CueSDK.KeyboardSDK; Debug.WriteLine("Keyboard Found: " + CueSDK.IsSDKAvailable(CorsairDeviceType.Keyboard)); int r = keyboard['A'].Color.R; graphicsCard.SetColor(r, g, b); }
public void Start() { if (IsStarted) { throw new InvalidOperationException("One Instance already exists"); } IsStarted = true; StartICUE(); CueSDK.Initialize(true); }
public IsaacKeyboard() { try { //initialize CueSDK and create a corsair keyboard from it CueSDK.Initialize(); Debug.WriteLine("CueSDK Initialized - " + CueSDK.LoadedArchitecture); keyBoard = CueSDK.KeyboardSDK; } catch (Exception e) { Debug.WriteLine("Error: " + e); isNull = true; } //register every F key except F12 for (int i = 1; i < 12; i++) { HealthKeys[i - 1] = (CorsairKeyboardKeyId)(i + 1); Debug.WriteLine("-{0} Added-", HealthKeys[i]); } //Who made F12 equal to 73?? HealthKeys[11] = CorsairKeyboardKeyId.F12; Debug.WriteLine("-{0} Added-", HealthKeys[11]); //register consumable key groups if (keyBoard.DeviceInfo.Model == "K95 RGB") { for (int i = 0; i < 6; i++) { CoinKeys[i] = (CorsairKeyboardKeyId)(i + 121); Debug.WriteLine("-{0} Added-", HealthKeys[i]); } for (int i = 0; i < 4; i++) { BombKeys[i] = (CorsairKeyboardKeyId)(i + 127); Debug.WriteLine("-{0} Added-", HealthKeys[i]); } BombKeys[4] = CorsairKeyboardKeyId.G11; BombKeys[5] = CorsairKeyboardKeyId.G12; for (int i = 0; i < 6; i++) { KeyKeys[i] = (CorsairKeyboardKeyId)(i + 139); Debug.WriteLine("-{0} Added-", HealthKeys[i]); } } else { ENABLE_G_KEYS = false; } //I'm keeping this here for future reference //keyBoard['A'].Led.Color = Color.Red; //keyBoard[CorsairKeyboardKeyId.Home].Led.Color = Color.White; //keyBoard.Update(); //keyBoard.UpdateMode = CUE.NET.Devices.Generic.Enums.UpdateMode.Continuous; //keyBoard.UpdateFrequency = 1f / 20f; }
public static void Main(Model model) { try { CueSDK.Initialize(); System.Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK"); CorsairKeyboard keyboard = CueSDK.KeyboardSDK; if (keyboard == null) { throw new WrapperException("No keyboard found"); } keyboard.Brush = (SolidColorBrush)Color.Transparent; model.Translation(new PointF(10, 3)); //Flyt den ind i midten af tastaturet model.Translation(new PointF3D(0)); //Flyt modellen model.Scaler(4.0f); while (true) { model.RotateBy(new PointF3D((float)model.properties.rotateAmount, (float)model.properties.rotateAmount, (float)model.properties.rotateAmount)); Draw.LEDClear(keyboard); System.Console.Clear(); //System.Console.WriteLine("Model points"); //foreach (var point in model.GetPoints()) { // Matrix.Log(point); //} System.Console.WriteLine("Scaler"); Matrix.Log(model.GetScaler()); System.Console.WriteLine("Translator"); Matrix.Log(model.GetTranslater()); System.Console.WriteLine("Translator2D"); Matrix.Log(model.GetTranslater2D()); System.Console.WriteLine("Rotation"); Matrix.Log(model.GetRotation()); model.Draw(keyboard, Color.Red, Color.Green); keyboard.Update(); Thread.Sleep((int)(0.1 * 1000)); } } catch (CUEException ex) { System.Console.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error)); } catch (WrapperException ex) { System.Console.WriteLine("Wrapper Exception! Message:" + ex.Message); } System.Console.Read(); }
public override bool TryEnable() { CanUse = CanInitializeSdk(); if (CanUse && !CueSDK.IsInitialized) { CueSDK.Initialize(); } Logger.Debug("Attempted to enable Corsair headset. CanUse: {0}", CanUse); return(CanUse); }
/// <summary> /// If SDK is available, initializes after 5 seconds. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckForCue(object sender, ElapsedEventArgs e) { if (CueSDK.IsSDKAvailable()) { initializationTimer.Enabled = false; initializationTimer.Elapsed += InitializeSDK; initializationTimer.Elapsed -= CheckForCue; initializationTimer.Interval = 5000; initializationTimer.Enabled = true; } }
static void Main(string[] args) { if (args.Length < 1) { return; } var type = args[0]; CueSDK.Initialize(); Game(type); }
static void Main(string[] args) { CueSDK.IsSDKAvailable(); CueSDK.Initialize(true); CorsairCommanderPro cooler = CueSDK.CommanderProSDK; Console.Write("Cooler: " + cooler); Console.ReadLine(); CorsairHeadsetStand headset = CueSDK.HeadsetStandSDK; Console.Write("HeadSet: " + headset); Console.ReadLine(); }
public static void Shutdown(LedSdk sdk) { if (sdk == LedSdk.Logitech) { LogitechGSDK.LogiLedShutdown(); } else if (sdk == LedSdk.Corsair) { CueSDK.Reinitialize(); } Debug.WriteLine("SDK is shutdown!"); }
//Initializes CUESDK with optional Exclusive Access private bool InitializeCueSdk(bool ExclusiveAccess) { CueSDK.Initialize(ExclusiveAccess); if (!CheckForCUEError()) { return(false); } CorsairProtocolDetails protocol = CueSDK.ProtocolDetails; Console.WriteLine("CUE SDK: SDK Version {0}, Server Version {1}", protocol.SdkVersion, protocol.ServerVersion); return(true); }
/// <summary> /// Checks for new Corsair USB devices. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckForDevice(object sender, ElapsedEventArgs e) { int newNumDevices = CueSDK.CorsairGetDeviceCount(); if (numDevices < newNumDevices) { CueSDK.Initialize(); NewCorsairDeviceConnected?.Invoke(this, new EventArgs()); } numDevices = newNumDevices; }
public bool Initialize() { if (!isInitialized) { try { CueSDK.Initialize(true); Global.logger.LogLine("Corsair device, Initialized with " + CueSDK.LoadedArchitecture + "-SDK", Logging_Level.Info); keyboard = CueSDK.KeyboardSDK; mouse = CueSDK.MouseSDK; headset = CueSDK.HeadsetSDK; if (keyboard == null && mouse == null && headset == null) { throw new WrapperException("No devices found"); } else { if (Global.Configuration.corsair_first_time) { CorsairInstallInstructions instructions = new CorsairInstallInstructions(); instructions.ShowDialog(); Global.Configuration.corsair_first_time = false; Settings.ConfigManager.Save(Global.Configuration); } SaveLeds(); isInitialized = true; return(true); } } catch (CUEException ex) { Global.logger.LogLine("Corsair device, CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error), Logging_Level.Error); } catch (WrapperException ex) { Global.logger.LogLine("Corsair device, Wrapper Exception! Message:" + ex.Message, Logging_Level.Error); } catch (Exception ex) { Global.logger.LogLine("Corsair device, Exception! Message:" + ex, Logging_Level.Error); } isInitialized = false; return(false); } return(isInitialized); }
public static bool Initialize(LedSdk sdk) { if (sdk == LedSdk.Logitech) { return(LogitechGSDK.LogiLedInit()); } else if (sdk == LedSdk.Corsair) { CueSDK.Initialize(true); return(true); } return(false); }
public void Dispose() { try { if (CueSDK.IsInitialized) { CueSDK.Reinitialize(false); CueSDK.Reset(); } } catch (Exception) { } }
public void Initialize() { if (CueSDK.IsSDKAvailable()) { CueSDK.Initialize(); Console.WriteLine("Initialized Corsair CUE with " + CueSDK.LoadedArchitecture + "-SDK"); _keyboard = CueSDK.KeyboardSDK; CueSDK.UpdateMode = UpdateMode.Manual; } else { Console.WriteLine("Failed to initialize Corsair CUE SDK, is it installed?"); } }
public bool Initialize() { try { CueSDK.Initialize(); CueSDK.UpdateMode = UpdateMode.Continuous; CueSDK.UpdateFrequency = 1f / _settings.UpdateRate; SetAmbilightBrush(); _settings.AmbienceCreatorTypeChanged += (sender, args) => SetAmbilightBrush(); } catch { return(false); } return(true); }
/// <summary> /// <para>This function will try to start the Corsair SDK</para> /// <para>This function will use exclusive access!</para> /// </summary> /// <returns>If false, then the SDK failed the initialize</returns> public static bool initSDK() { try{ CueSDK.Initialize(true); keyboard = CueSDK.KeyboardSDK; if (keyboard == null) { throw new WrapperException("No keyboard found!"); } keyboard.UpdateMode = CUE.NET.Devices.Generic.Enums.UpdateMode.Continuous; // No need to call manual update, as we do it automatic return(true); }catch (Exception) { return(false); } }
public Corsair(bool runWithoutKeyboard = false) { this.runWithoutKeyboard = runWithoutKeyboard; if (runWithoutKeyboard) { return; } if (!CueSDK.IsInitialized) { CueSDK.Initialize(); } keyboard = CueSDK.KeyboardSDK; keyboard.Brush = (SolidColorBrush)Color.Transparent; }
public override void Disable() { try { CueSDK.Reset(); } catch (WrapperException e) { // This occurs when releasing the SDK after sleep, ignore it if (e.Message != "The previously loaded Keyboard got disconnected.") { throw; } } }
private static void Main() { CueSDK.Initialize(); if (CueSDK.IsSDKAvailable(CorsairDeviceType.Keyboard)) { new SnakeGame(); } else { Console.WriteLine("Keyboard not detected!"); } Console.ReadKey(true); }