Esempio n. 1
0
        public static int addDevice(string lightName, string ColorCSV)
        {
            string[]        components = ColorCSV.Split(',');
            LFX_ColorStruct color      = new LFX_ColorStruct(Convert.ToByte(components[0]), Convert.ToByte(components[1]), Convert.ToByte(components[2]), Convert.ToByte(components[3]));
            LightDevice     device     = Lights.getLightForName(lightName) as LightDevice;

            device.LightColor = color;
            lights.Add(device);
            return(0);
        }
Esempio n. 2
0
        public void InitializeAFX()
        {
            lightFXController = new LightFXController();
            LFX_Result status = lightFXController.LFX_Initialize();

            Console.WriteLine("Initializing Alien FX System");
            switch (status)
            {
            case LFX_Result.LFX_Success:
            {
                Console.WriteLine("Initialization Successful");
                lightFXController.LFX_Reset();
                lightFXController.LFX_GetNumLights(AFX_Device, out AFX_Lights_Count);
                Lights lights = new Lights();
                for (int i = 0; i < AFX_Lights_Count; i++)
                {
                    StringBuilder sb = new StringBuilder();
                    lightFXController.LFX_GetLightDescription(AFX_Device, Convert.ToUInt32(i), out sb, 255);
                    string       name = sb.ToString();
                    LFX_Position position;
                    lightFXController.LFX_GetLightLocation(AFX_Device, Convert.ToUInt32(i), out position);
                    LFX_ColorStruct color;
                    lightFXController.LFX_GetLightColor(AFX_Device, Convert.ToUInt32(i), out color);
                    LightDevice device = new LightDevice(Convert.ToUInt32(i), name, position, color);
                    Lights.addDevice(device);
                }
            }
            break;

            case LFX_Result.LFX_Failure:
            {
                disable = true;
                Console.WriteLine("Error Occured During Initialization.");
            }
            break;

            default:
            {
                disable = true;
                Console.WriteLine("Not An Alien FX Equipped Machine");
            }
            break;
            }
        }
Esempio n. 3
0
        public async void Update()
        {
            if (disable)
            {
                return;
            }
            List <ILight> lightsUsedNow = new List <ILight>();

            for (int i = 0; i < UpdateLights.NumberOfDevices; i++)
            {
                LightDevice device = UpdateLights.lightAtIndex(i) as LightDevice;
                if (lightsUsedNow.Contains(device))
                {
                    UpdateLights.pushToStack(device);
                    continue;
                }
                Colorize(AFX_Device, device.DeviceID, device.LightColor);
                UpdateLights.removeDevice(device);
            }
            UpdateLights.resetStack();
            await Task.Delay(UpdateInterval);

            Update();
        }