public void GetDevices()
        {
            var supportedUsbs = this.GetProperties().SupportedDevices;
            var connected     = SLSManager.GetSupportedDevices(supportedUsbs);

            foreach (var supportedDevice in connected)
            {
                AddDevice(supportedDevice.HID.Value);
            }
        }
示例#2
0
    private void Awake()
    {
        if (_selfSLSM == null)
        {
            _selfSLSM = this;
        }

        if (_selfSLSM != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
示例#3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        SLSManager slsManager = (SLSManager)target;

        if (GUILayout.Button("Save PlayerStats"))
        {
            slsManager.SavePlayerStats();
        }

        if (GUILayout.Button("Load PlayerStats"))
        {
            slsManager.LoadPlayerStats();
        }
    }
示例#4
0
    void Awake()                                                                   //if there's no settings to load from, default settings get initialized from InputManager.Start();
    {                                                                              //if there are settings to load from, InputManager.Keybindings get initialized from settings
        if (Instance == null)                                                      //settings get reinitialized every time a key is re-binded
        {                                                                          //before that all callbacks need to be cleared because functions can't be serialized into a file
            Instance = this;                                                       //after reinitializing settings callbacks need to be re-registered immediately
            DontDestroyOnLoad(gameObject);

            string path = Application.persistentDataPath + "/Settings.dat";
            if (File.Exists(path))
            {
                LoadSettings();
            }
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#5
0
        static void Main(string[] args)
        {
            try
            {
                Directory.CreateDirectory("SLSConfigs");
            }
            catch
            {
            }

            SLSManager ledManager = new SLSManager("SLSConfigs");

            ledManager.Drivers.Add(new RainbowWaveDriver());
            ledManager.Drivers.Add(new IT8296Provider());
            //ledManager.Drivers.Add(new SteelSeriesDriver());
            ledManager.Drivers.Add(new SimpleRGBCycleDriver());
            ledManager.Drivers.Add(new MadLedDriver());
            //ledManager.Drivers.Add(new MSIDriver());
            ledManager.Drivers.Add(new ScreenShotSourceProvider());
            //ledManager.Drivers.Add(new CUEDriver());
            ledManager.Init();
            Console.WriteLine("Getting devices");
            List <ControlDevice> devices = ledManager.GetDevices();

            Dictionary <int, ControlDevice> driv = new Dictionary <int, ControlDevice>();
            int ct = 1;

            foreach (var controlDevice in devices)
            {
                Console.WriteLine(ct + ": " + controlDevice.Driver.Name() + "-" + controlDevice.Name + " - " + controlDevice.DeviceType + ", " + controlDevice.LEDs?.Length + " LEDs");
                driv.Add(ct, controlDevice);
                ct++;
            }

            //Console.WriteLine("Type Source Number");
            //string derp = Console.ReadLine();

            string        derp     = "";
            ControlDevice cycleFan = null;

            //ControlDevice cycleFan = driv[int.Parse(derp)]; //devices.First(xx => xx.Name == "Simple RGB Cycler");

            var timer = new Timer((state) =>
            {
                if (cycleFan != null)
                {
                    foreach (var t in devices.Where(xx =>
                                                    xx.Driver.GetProperties().SupportsPush&& xx.LEDs != null && xx.LEDs.Length > 0))
                    {
                        if (cycleFan.Driver.GetProperties().SupportsPull)
                        {
                            cycleFan.Pull();
                        }

                        t.MapLEDs(cycleFan);
                        t.Push();
                    }
                }
            }, null, 0, 33);

            while (true)
            {
                Console.WriteLine("Type Source Number (Q TO QUIT, S TO SAVE CFG, L TO LOAD CFG)");
                derp = Console.ReadLine();
                if (derp.ToUpper() == "Q")
                {
                    return;
                }

                if (derp.ToUpper() == "S")
                {
                    ledManager.SaveConfigs();
                }

                else if (derp.ToUpper() == "L")
                {
                    ledManager.LoadConfigs();
                }
                else
                {
                    cycleFan = driv[int.Parse(derp)]; //devices.First(xx => xx.Name == "Simple RGB Cycler");
                }
            }
        }
示例#6
0
 public void Configure(DriverDetails driverDetails)
 {
     SLSManager.GetSupportedDevices(supportedDevices.Select(x => new USBDevice {
         HID = x.Pid, VID = x.Vid
     }).ToList()).ForEach(x => InterestedUSBChange(x.VID, x.HID.Value, true));
 }
示例#7
0
        static void Main(string[] args)
        {
            var apiClient   = new SimpleLedApiClient();
            var driverProps = apiClient.GetProductsByCategory(ProductCategory.Effect).Result;

            try
            {
                Directory.CreateDirectory("SLSConfigs");
            }
            catch
            {
            }


            DummyForm dummy = new DummyForm();


            SLSManager ledManager = new SLSManager("SLSConfigs");

            ledManager.DeviceAdded   += LedManager_DeviceAdded;
            ledManager.DeviceRemoved += LedManager_DeviceRemoved;
            //Add drivers manually like the example below.
            //you wll need to add the driver csproj too.
            //you will need to add at LEAST two - one for source, one for dest
            //ledManager.Drivers.Add(new CUEDriver());

            ledManager.Drivers.Add(new RainbowWaveDriver());

            ledManager.Drivers.Add(new RGBNetDriver());

            ledManager.RescanRequired += LedManager_RescanRequired;

            ledManager.Init();
            Console.WriteLine("Getting devices");



            string        derp     = "";
            ControlDevice cycleFan = null;

            var timer = new Timer((state) =>
            {
                if (cycleFan != null)
                {
                    foreach (var t in devices.Where(xx =>
                                                    xx.Driver.GetProperties().SupportsPush&& xx.LEDs != null && xx.LEDs.Length > 0))
                    {
                        if (cycleFan.Driver.GetProperties().SupportsPull)
                        {
                            cycleFan.Pull();
                        }

                        t.MapLEDs(cycleFan);
                        t.Push();
                    }
                }
            }, null, 0, 33);

            while (true)
            {
                Console.WriteLine("Type Source Number (Q TO QUIT, S TO SAVE CFG, L TO LOAD CFG)");
                derp = Console.ReadLine();
                if (derp.ToUpper() == "Q")
                {
                    return;
                }

                if (derp.ToUpper() == "S")
                {
                    ledManager.SaveConfigs();
                }

                else if (derp.ToUpper() == "L")
                {
                    ledManager.LoadConfigs();
                }
                else
                {
                    cycleFan = driv[int.Parse(derp)];
                }
            }
        }
示例#8
0
        public List <ControlDevice> GetDevices()
        {
            List <ControlDevice> devices = new List <ControlDevice>();

            var connectedKeyboards = SLSManager.GetSupportedDevices(supportedKeyboards);
            var connectedMice      = SLSManager.GetSupportedDevices(supportedMice);
            var connectedMouseMats = SLSManager.GetSupportedDevices(supportedMouseMats);
            var connectedKeypads   = SLSManager.GetSupportedDevices(supportedKeypads);
            var connectedHeadsets  = SLSManager.GetSupportedDevices(supportedHeadsets);


            if (!configModel.ShowOnlyConnected || connectedKeyboards.Any())
            {
                KeyboardDevice keyboard = new KeyboardDevice(uri, this);

                if (connectedKeyboards.Any())
                {
                    USBDevice first = connectedKeyboards.First();

                    keyboard.Name = first.DevicePrettyName;

                    if (first.HID.HasValue)
                    {
                        KeyboardHelper.AddKeyboardWatcher(first.VID, first.HID.Value, keyboard.HandleInput);
                    }
                }

                devices.Add(keyboard);
            }

            if (!configModel.ShowOnlyConnected || connectedMice.Any())
            {
                MouseDevice mouse = new MouseDevice(uri, this);

                if (connectedMice.Any())
                {
                    USBDevice first = connectedMice.First();

                    mouse.Name = first.DevicePrettyName;
                }

                devices.Add(mouse);
            }

            if (!configModel.ShowOnlyConnected || connectedMouseMats.Any())
            {
                MousepadDevice mousePad = new MousepadDevice(uri, this);

                if (connectedMouseMats.Any())
                {
                    USBDevice first = connectedMouseMats.First();

                    mousePad.Name = first.DevicePrettyName;
                }

                devices.Add(mousePad);
            }


            if (!configModel.ShowOnlyConnected || connectedKeypads.Any())
            {
                KeypadDevice keypad = new KeypadDevice(uri, this);

                if (connectedKeypads.Any())
                {
                    USBDevice first = connectedKeypads.First();

                    keypad.Name = first.DevicePrettyName;
                }

                devices.Add(keypad);
            }



            if (!configModel.ShowOnlyConnected || connectedHeadsets.Any())
            {
                HeadSetDevice headset = new HeadSetDevice(uri, this);

                if (connectedHeadsets.Any())
                {
                    USBDevice first = connectedHeadsets.First();

                    headset.Name = first.DevicePrettyName;
                }

                devices.Add(headset);
            }

            //Chroma links could be anything - always show this one
            ChromaLinkDevice chromaLink = new ChromaLinkDevice(uri, this);

            devices.Add(chromaLink);


            return(devices);
        }