Exemple #1
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");
                }
            }
        }
Exemple #2
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)];
                }
            }
        }