Example #1
0
        /// <summary>Checks to see if the duration since the last input is greater than the given inactive time.</summary>
        public bool Evaluate(IGameState gameState)
        {
            var idleTime = ActiveProcessMonitor.GetTimeSinceLastInput();

            switch (TimeUnit)
            {
            case TimeUnit.Milliseconds: return(idleTime.TotalMilliseconds > InactiveTime);

            case TimeUnit.Seconds: return(idleTime.TotalSeconds > InactiveTime);

            case TimeUnit.Minutes: return(idleTime.TotalMinutes > InactiveTime);

            case TimeUnit.Hours: return(idleTime.TotalHours > InactiveTime);

            default: return(false);
            }
            ;
        }
Example #2
0
        /// <summary>Checks to see if the duration since the last input is greater than the given inactive time.</summary>
        protected override double Execute(IGameState gameState)
        {
            var idleTime = ActiveProcessMonitor.GetTimeSinceLastInput();

            switch (TimeUnit)
            {
            case TimeUnit.Milliseconds: return(idleTime.TotalMilliseconds);

            case TimeUnit.Seconds: return(idleTime.TotalSeconds);

            case TimeUnit.Minutes: return(idleTime.TotalMinutes);

            case TimeUnit.Hours: return(idleTime.TotalHours);

            default: return(0);
            }
            ;
        }
Example #3
0
        private void UpdateIdleEffects(EffectsEngine.EffectFrame newFrame)
        {
            tagLASTINPUTINFO LastInput = new tagLASTINPUTINFO();
            Int32            IdleTime;

            LastInput.cbSize = (uint)Marshal.SizeOf(LastInput);
            LastInput.dwTime = 0;

            if (ActiveProcessMonitor.GetLastInputInfo(ref LastInput))
            {
                IdleTime = System.Environment.TickCount - LastInput.dwTime;

                if (IdleTime >= Global.Configuration.idle_delay * 60 * 1000)
                {
                    if (!(Global.Configuration.time_based_dimming_enabled &&
                          Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_start_minute, Global.Configuration.time_based_dimming_end_hour, Global.Configuration.time_based_dimming_end_minute))
                        )
                    {
                        idle_e.UpdateLights(newFrame);
                    }
                }
            }
        }
Example #4
0
        private void UpdateIdleEffects(EffectsEngine.EffectFrame newFrame)
        {
            tagLASTINPUTINFO LastInput = new tagLASTINPUTINFO();
            Int32            IdleTime;

            LastInput.cbSize = (uint)Marshal.SizeOf(LastInput);
            LastInput.dwTime = 0;

            if (ActiveProcessMonitor.GetLastInputInfo(ref LastInput))
            {
                IdleTime = System.Environment.TickCount - LastInput.dwTime;

                if (IdleTime >= Global.Configuration.IdleDelay * 60 * 1000)
                {
                    if (!(Global.Configuration.TimeBasedDimmingEnabled &&
                          Utils.Time.IsCurrentTimeBetween(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingStartMinute, Global.Configuration.TimeBasedDimmingEndHour, Global.Configuration.TimeBasedDimmingEndMinute))
                        )
                    {
                        UpdateEvent(idle_e, newFrame);
                    }
                }
            }
        }
Example #5
0
        public bool Initialize()
        {
            if (Initialized)
            {
                return(true);
            }

            processMonitor = new ActiveProcessMonitor();

            #region Initiate Defaults
            RegisterEvents(new List <ILightEvent> {
                new Desktop.Desktop(),
                new Dota_2.Dota2(),
                new CSGO.CSGO(),
                new GTA5.GTA5(),
                new RocketLeague.RocketLeague(),
                new Overwatch.Overwatch(),
                new Payday_2.PD2(),
                new TheDivision.TheDivision(),
                new LeagueOfLegends.LoL(),
                new HotlineMiami.HotlineMiami(),
                new TheTalosPrinciple.TalosPrinciple(),
                new BF3.BF3(),
                new Blacklight.Blacklight(),
                new Magic_Duels_2012.MagicDuels2012(),
                new ShadowOfMordor.ShadowOfMordor(),
                new Serious_Sam_3.SSam3(),
                new DiscoDodgeball.DiscoDodgeballApplication(),
                new XCOM.XCOM(),
                new Evolve.Evolve(),
                new Metro_Last_Light.MetroLL(),
                new Guild_Wars_2.GW2(),
                new WormsWMD.WormsWMD(),
                new Blade_and_Soul.BnS(),
                new Event_SkypeOverlay()
            });

            RegisterLayerHandlers(new List <LayerHandlerEntry> {
                new LayerHandlerEntry("Default", "Default Layer", typeof(DefaultLayerHandler)),
                new LayerHandlerEntry("Solid", "Solid Color Layer", typeof(SolidColorLayerHandler)),
                new LayerHandlerEntry("SolidFilled", "Solid Fill Color Layer", typeof(SolidFillLayerHandler)),
                new LayerHandlerEntry("Gradient", "Gradient Layer", typeof(GradientLayerHandler)),
                new LayerHandlerEntry("GradientFill", "Gradient Fill Layer", typeof(GradientFillLayerHandler)),
                new LayerHandlerEntry("Breathing", "Breathing Layer", typeof(BreathingLayerHandler)),
                new LayerHandlerEntry("Blinking", "Blinking Layer", typeof(BlinkingLayerHandler)),
                new LayerHandlerEntry("Image", "Image Layer", typeof(ImageLayerHandler)),
                new LayerHandlerEntry("Script", "Script Layer", typeof(ScriptLayerHandler)),
                new LayerHandlerEntry("Percent", "Percent Effect Layer", typeof(PercentLayerHandler)),
                new LayerHandlerEntry("PercentGradient", "Percent (Gradient) Effect Layer", typeof(PercentGradientLayerHandler)),
                new LayerHandlerEntry("Interactive", "Interactive Layer", typeof(InteractiveLayerHandler)),
                new LayerHandlerEntry("ShortcutAssistant", "Shortcut Assistant Layer", typeof(ShortcutAssistantLayerHandler)),
                new LayerHandlerEntry("Equalizer", "Equalizer Layer", typeof(EqualizerLayerHandler)),
                new LayerHandlerEntry("Ambilight", "Ambilight Layer", typeof(AmbilightLayerHandler)),
                new LayerHandlerEntry("LockColor", "Lock Color Layer", typeof(LockColourLayerHandler)),
                new LayerHandlerEntry("Glitch", "Glitch Effect Layer", typeof(GlitchLayerHandler)),
                new LayerHandlerEntry("Animation", "Animation Layer", typeof(AnimationLayerHandler)),
            }, true);

            #endregion

            LoadSettings();

            this.LoadPlugins();

            if (Directory.Exists(AdditionalProfilesPath))
            {
                List <string> additionals = new List <string>(Directory.EnumerateDirectories(AdditionalProfilesPath));
                foreach (var dir in additionals)
                {
                    if (File.Exists(Path.Combine(dir, "default.json")))
                    {
                        string proccess_name = Path.GetFileName(dir);
                        RegisterEvent(new GenericApplication(proccess_name));
                    }
                }
            }

            foreach (var profile in Events)
            {
                profile.Value.Initialize();
            }

            this.InitUpdate();

            Initialized = true;
            return(Initialized);
        }
Example #6
0
        public bool Initialize()
        {
            if (Initialized)
            {
                return(true);
            }

            processMonitor        = new ActiveProcessMonitor();
            runningProcessMonitor = new RunningProcessMonitor();

            #region Initiate Defaults
            RegisterEvents(new List <ILightEvent> {
                new Desktop.Desktop(),
                new Dota_2.Dota2(),
                new CSGO.CSGO(),
                new GTA5.GTA5(),
                new RocketLeague.RocketLeague(),
                new Borderlands2.Borderlands2(),
                new Overwatch.Overwatch(),
                new Payday_2.PD2(),
                new TheDivision.TheDivision(),
                new LeagueOfLegends.LoL(),
                new HotlineMiami.HotlineMiami(),
                new TheTalosPrinciple.TalosPrinciple(),
                new BF3.BF3(),
                new Blacklight.Blacklight(),
                new Magic_Duels_2012.MagicDuels2012(),
                new ShadowOfMordor.ShadowOfMordor(),
                new Serious_Sam_3.SSam3(),
                new DiscoDodgeball.DiscoDodgeballApplication(),
                new XCOM.XCOM(),
                new Evolve.Evolve(),
                new Metro_Last_Light.MetroLL(),
                new Guild_Wars_2.GW2(),
                new WormsWMD.WormsWMD(),
                new Blade_and_Soul.BnS(),
                new Skype.Skype(),
                new ROTTombRaider.ROTTombRaider(),
                new DyingLight.DyingLight(),
                new ETS2.ETS2(),
                new ATS.ATS(),
                new Move_or_Die.MoD(),
                new QuantumConumdrum.QuantumConumdrum(),
                new Battlefield1.Battlefield1(),
                new Dishonored.Dishonored(),
                new Witcher3.Witcher3(),
                new Minecraft.Minecraft(),
                new KillingFloor2.KillingFloor2(),
                new DOOM.DOOM(),
                new Factorio.Factorio(),
                new QuakeChampions.QuakeChampions(),
                new Diablo3.Diablo3(),
                new DeadCells.DeadCells(),
                new Subnautica.Subnautica(),
                new ResidentEvil2.ResidentEvil2(),
                new CloneHero.CloneHero(),
                new Osu.Osu(),
                new Slime_Rancher.Slime_Rancher(),
                new Terraria.Terraria(),
                new Discord.Discord()
            });

            RegisterLayerHandlers(new List <LayerHandlerEntry> {
                new LayerHandlerEntry("Default", "Default Layer", typeof(DefaultLayerHandler)),
                new LayerHandlerEntry("Solid", "Solid Color Layer", typeof(SolidColorLayerHandler)),
                new LayerHandlerEntry("SolidFilled", "Solid Fill Color Layer", typeof(SolidFillLayerHandler)),
                new LayerHandlerEntry("Gradient", "Gradient Layer", typeof(GradientLayerHandler)),
                new LayerHandlerEntry("GradientFill", "Gradient Fill Layer", typeof(GradientFillLayerHandler)),
                new LayerHandlerEntry("Breathing", "Breathing Layer", typeof(BreathingLayerHandler)),
                new LayerHandlerEntry("Blinking", "Blinking Layer", typeof(BlinkingLayerHandler)),
                new LayerHandlerEntry("Image", "Image Layer", typeof(ImageLayerHandler)),
                new LayerHandlerEntry("Script", "Script Layer", typeof(ScriptLayerHandler)),
                new LayerHandlerEntry("Percent", "Percent Effect Layer", typeof(PercentLayerHandler)),
                new LayerHandlerEntry("PercentGradient", "Percent (Gradient) Effect Layer", typeof(PercentGradientLayerHandler)),
                new LayerHandlerEntry("Razer", "Razer Chroma Layer", typeof(RazerLayerHandler)),
                new LayerHandlerEntry("Conditional", "Conditional Layer", typeof(ConditionalLayerHandler)),
                new LayerHandlerEntry("Comparison", "Comparison Layer", typeof(ComparisonLayerHandler)),
                new LayerHandlerEntry("Interactive", "Interactive Layer", typeof(InteractiveLayerHandler)),
                new LayerHandlerEntry("ShortcutAssistant", "Shortcut Assistant Layer", typeof(ShortcutAssistantLayerHandler)),
                new LayerHandlerEntry("Equalizer", "Audio Visualizer Layer", typeof(EqualizerLayerHandler)),
                new LayerHandlerEntry("Ambilight", "Ambilight Layer", typeof(AmbilightLayerHandler)),
                new LayerHandlerEntry("LockColor", "Lock Color Layer", typeof(LockColourLayerHandler)),
                new LayerHandlerEntry("Glitch", "Glitch Effect Layer", typeof(GlitchLayerHandler)),
                new LayerHandlerEntry("Animation", "Animation Layer", typeof(AnimationLayerHandler)),
                new LayerHandlerEntry("ToggleKey", "Toggle Key Layer", typeof(ToggleKeyLayerHandler)),
                new LayerHandlerEntry("Timer", "Timer Layer", typeof(TimerLayerHandler)),
                new LayerHandlerEntry("Toolbar", "Toolbar Layer", typeof(ToolbarLayerHandler)),
                new LayerHandlerEntry("BinaryCounter", "Binary Counter Layer", typeof(BinaryCounterLayerHandler))
            }, true);

            RegisterLayerHandler(new LayerHandlerEntry("WrapperLights", "Wrapper Lighting Layer", typeof(WrapperLightsLayerHandler)), false);

            #endregion

            LoadSettings();

            this.LoadPlugins();

            if (Directory.Exists(AdditionalProfilesPath))
            {
                List <string> additionals = new List <string>(Directory.EnumerateDirectories(AdditionalProfilesPath));
                foreach (var dir in additionals)
                {
                    if (File.Exists(Path.Combine(dir, "settings.json")))
                    {
                        string proccess_name = Path.GetFileName(dir);
                        RegisterEvent(new GenericApplication(proccess_name));
                    }
                }
            }

            foreach (var profile in Events)
            {
                profile.Value.Initialize();
            }

            this.InitUpdate();

            // Listen for profile keybind triggers
            Global.InputEvents.KeyDown += CheckProfileKeybinds;

            Initialized = true;
            return(Initialized);
        }
Example #7
0
        public bool Initialize()
        {
            if (Initialized)
            {
                return(true);
            }

            processMonitor        = new ActiveProcessMonitor();
            runningProcessMonitor = new RunningProcessMonitor();

            // Register all Application types in the assembly
            var profileTypes = from type in Assembly.GetExecutingAssembly().GetTypes()
                               where type.BaseType == typeof(Application) && type != typeof(GenericApplication)
                               let inst = (Application)Activator.CreateInstance(type)
                                          orderby inst.Config.Name
                                          select inst;

            foreach (var inst in profileTypes)
            {
                RegisterEvent(inst);
            }

            // Register all layer types that are in the Aurora.Settings.Layers namespace.
            // Do not register all that are inside the assembly since some are application-specific (e.g. minecraft health layer)
            var layerTypes = from type in Assembly.GetExecutingAssembly().GetTypes()
                             where type.GetInterfaces().Contains(typeof(ILayerHandler))
                             let name                       = type.Name.CamelCaseToSpaceCase()
                                                   let meta = type.GetCustomAttribute <LayerHandlerMetaAttribute>()
                                                              where !type.IsGenericType
                                                              where meta == null || !meta.Exclude
                                                              select(type, meta);

            foreach (var(type, meta) in layerTypes)
            {
                LayerHandlers.Add(type, new LayerHandlerMeta(type, meta));
            }

            LoadSettings();

            LoadPlugins();

            if (Directory.Exists(AdditionalProfilesPath))
            {
                List <string> additionals = new List <string>(Directory.EnumerateDirectories(AdditionalProfilesPath));
                foreach (var dir in additionals)
                {
                    if (File.Exists(Path.Combine(dir, "settings.json")))
                    {
                        string proccess_name = Path.GetFileName(dir);
                        RegisterEvent(new GenericApplication(proccess_name));
                    }
                }
            }

            foreach (var profile in Events)
            {
                profile.Value.Initialize();
            }

            this.InitUpdate();

            // Listen for profile keybind triggers
            Global.InputEvents.KeyDown += CheckProfileKeybinds;

            Initialized = true;
            return(Initialized);
        }