private void Update() { PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed 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))) { StopUnUpdatedEvents(); return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; // If the current foreground process is excluded from Aurora, disable the lighting manager if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { StopUnUpdatedEvents(); Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { UpdateEvent(profile, newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { // Update any overlays registered in the Overlays array. This includes applications with type set to Overlay and things such as skype overlay foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { UpdateEvent(@event, newFrame); } } // Update any overlays that are timer-based (e.g. the volume overlay that appears for a few seconds at a time) TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { UpdateEvent((evnt.item as LightEvent), newFrame); } } // Update any applications that have overlay layers if that application is open var events = GetOverlayActiveProfiles().ToList(); //Add the Light event that we're previewing to be rendered as an overlay if (preview && Global.Configuration.OverlaysInPreview && !events.Contains(profile)) { events.Add(profile); } foreach (var @event in events) { @event.UpdateOverlayLights(newFrame); } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); }
private void Update() { //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed 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))) { return; } UpdateProcess(); string process_name = System.IO.Path.GetFileName(processMonitor.ProcessPath).ToLowerInvariant(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = null; ILightEvent tempProfile = null; bool preview = false; //Global.logger.LogLine(process_name); if (!Global.Configuration.excluded_programs.Contains(process_name)) { //TODO: GetProfile that checks based on event type if (((tempProfile = GetProfileFromProcess(process_name)) != null) && tempProfile.Config.Type == LightEventType.Normal && tempProfile.IsEnabled) { profile = tempProfile; } else if ((tempProfile = GetProfileFromProcess(previewModeProfileKey)) != null) //Don't check for it being Enabled as a preview should always end-up with the previewed profile regardless of it being disabled { profile = tempProfile; preview = true; } else if (Global.Configuration.allow_wrappers_in_background && Global.net_listener != null && Global.net_listener.IsWrapperConnected && ((tempProfile = GetProfileFromProcess(Global.net_listener.WrappedProcess)) != null) && tempProfile.Config.Type == LightEventType.Normal && tempProfile.Config.ProcessNames.Contains(process_name) && tempProfile.IsEnabled) { profile = tempProfile; } } profile = profile ?? DesktopProfile; timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; //Check if any keybinds have been triggered if (profile is Application) { foreach (var prof in (profile as Application).Profiles) { if (prof.TriggerKeybind.IsPressed() && !(profile as Application).Profile.ProfileName.Equals(prof.ProfileName)) { (profile as Application).SwitchToProfile(prof); break; } } } if (profile is Desktop.Desktop && !profile.IsEnabled && Global.Configuration.ShowDefaultLightingOnDisabled) { Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { profile.UpdateLights(newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } //Add overlays TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { (evnt.item as LightEvent).UpdateLights(newFrame); } } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); }
private void Update() { PreUpdate?.Invoke(this, null); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed 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))) { return; } string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); ILightEvent profile = GetCurrentProfile(out bool preview); timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.excluded_programs.Contains(raw_process_name)) { Global.dev_manager.Shutdown(); Global.effengine.PushFrame(newFrame); return; } else { Global.dev_manager.InitializeOnce(); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var underlay in Underlays) { ILightEvent @event = Events[underlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } } //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) { profile.UpdateLights(newFrame); } if (Global.Configuration.OverlaysInPreview || !preview) { foreach (var overlay in Overlays) { ILightEvent @event = Events[overlay]; if (@event.IsEnabled && (@event.Config.ProcessNames == null || ProcessUtils.AnyProcessExists(@event.Config.ProcessNames))) { @event.UpdateLights(newFrame); } } //Add overlays TimedListObject[] overlay_events = overlays.ToArray(); foreach (TimedListObject evnt in overlay_events) { if ((evnt.item as LightEvent).IsEnabled) { (evnt.item as LightEvent).UpdateLights(newFrame); } } UpdateIdleEffects(newFrame); } Global.effengine.PushFrame(newFrame); PostUpdate?.Invoke(this, null); }