<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using Aurora.Devices.RGBNet;
using Aurora.Settings;
using keyboard;
using Microsoft.Win32;
using RegistryUtils;

namespace Aurora.Devices.Uni
{
     
    public class KeyboardDevice : Device
    {
        
            // Generic Variables
            private string devicename = "keyboard";
            private bool isInitialized = false;

            private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            private long lastUpdateTime = 0;

        List<AuroraInterface> DeviceList = new List<AuroraInterface>();
        //  Controll Class
        private AuroraInterface keyboard = null;
        /// 
        //private AuroraInterface keyboard  = null;

        //private AuroraInterface lightbar = KeyboardFactory.CreateHIDDevice("hidlightbar");
        int GamingCenterType = 0;
        public KeyboardDevice()
        {
            devicename = KeyboardFactory.GetOEMName()+ " keyboard";
            ChoiceGamingCenter();
 
        }

        private void ChoiceGamingCenter()
        {

           

            try
            {
                //CCI
                string m_sRegPathI = @"\OEM\GamingCenter\RGBKeyboardView";
                int Control = (int)RegistrySoftwareKeyRead(RegistryHive.LocalMachine, m_sRegPathI, "AuroraSwitch", 0);
                GamingCenterType = 1;

            }
            catch (Exception ex)
            {
                GamingCenterType = 0;
            }
            try
            {
                //GCU
                string m_sRegPathI = @"\OEM\GamingCenter2\RGBKeyboard";
                string Control = (string)RegistrySoftwareKeyRead(RegistryHive.LocalMachine, m_sRegPathI, "AuroraSwitch", "0");
                GamingCenterType = 2;
            }
            catch (Exception ex)
            {
                GamingCenterType = 0;
            }
            if(GamingCenterType == 1)
            {
                RegistryMonitor monitor = new RegistryMonitor(@"HKEY_LOCAL_MACHINE\SOFTWARE\OEM\GamingCenter\RGBKeyboardView");
                monitor.RegChangeNotifyFilter = RegChangeNotifyFilter.Value;
                monitor.RegChanged += new EventHandler(OnRegChanged);
                monitor.Start();
            }
            else if(GamingCenterType ==2)
            {
                RegistryMonitor gcumonitor = new RegistryMonitor(@"HKEY_LOCAL_MACHINE\SOFTWARE\OEM\GamingCenter2\RGBKeyboard");
                gcumonitor.RegChangeNotifyFilter = RegChangeNotifyFilter.Value;
                gcumonitor.RegChanged += new EventHandler(OnRegChanged);
                gcumonitor.Start();

            }



        }

<commit_msg>[Fixed] CCI connect bug fixed.<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using Aurora.Devices.RGBNet;
using Aurora.Settings;
using keyboard;
using Microsoft.Win32;
using RegistryUtils;

namespace Aurora.Devices.Uni
{
     
    public class KeyboardDevice : Device
    {
        
            // Generic Variables
            private string devicename = "keyboard";
            private bool isInitialized = false;

            private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            private long lastUpdateTime = 0;

        List<AuroraInterface> DeviceList = new List<AuroraInterface>();
        //  Controll Class
        private AuroraInterface keyboard = null;
        /// 
        //private AuroraInterface keyboard  = null;

        //private AuroraInterface lightbar = KeyboardFactory.CreateHIDDevice("hidlightbar");
        int GamingCenterType = 0;
        public KeyboardDevice()
        {
            devicename = KeyboardFactory.GetOEMName()+ " keyboard";
            ChoiceGamingCenter();
 
        }

        private void ChoiceGamingCenter()
        {

           

            try
            {
                //CCI
                string m_sRegPathI = @"\OEM\GamingCenter\RGBKeyboardView";
                int Control = (int)RegistrySoftwareKeyRead(RegistryHive.LocalMachine, m_sRegPathI, "AuroraSwitch", 0);
                GamingCenterType = 1;

            }
            catch (Exception ex)
            {
                GamingCenterType = 0;
            }
            if(GamingCenterType==0)
            {
                try
                {
                    //GCU
                    string m_sRegPathI = @"\OEM\GamingCenter2\RGBKeyboard";
                    string Control = (string)RegistrySoftwareKeyRead(RegistryHive.LocalMachine, m_sRegPathI, "AuroraSwitch", "0");
                    GamingCenterType = 2;
                }
                catch (Exception ex)
                {
                    GamingCenterType = 0;
                }
            }
           
            if(GamingCenterType == 1)
            {
                RegistryMonitor monitor = new RegistryMonitor(@"HKEY_LOCAL_MACHINE\SOFTWARE\OEM\GamingCenter\RGBKeyboardView");
                monitor.RegChangeNotifyFilter = RegChangeNotifyFilter.Value;
                monitor.RegChanged += new EventHandler(OnRegChanged);
                monitor.Start();
            }
            else if(GamingCenterType ==2)
            {
                RegistryMonitor gcumonitor = new RegistryMonitor(@"HKEY_LOCAL_MACHINE\SOFTWARE\OEM\GamingCenter2\RGBKeyboard");
                gcumonitor.RegChangeNotifyFilter = RegChangeNotifyFilter.Value;
                gcumonitor.RegChanged += new EventHandler(OnRegChanged);
                gcumonitor.Start();

            }



        }


{'fraction_non_alphanumeric': 0.08035558654348963, 'fraction_numerical': 0.005054906745685899, 'mean_word_length': 1.75998075998076, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4041633', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1434, 'n_words': 281}