Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Project-Aurora/Aurora-Updater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ static void Main(string[] args)
return;
}
var versionToCheck = VersionParser.ParseVersion(fileVersion);
if (versionToCheck is { Major: 0, Minor: 0, Patch: 0 })
{
_isSilent = false;
}

var owner = FileVersionInfo.GetVersionInfo(auroraPath).CompanyName;
var repository = FileVersionInfo.GetVersionInfo(auroraPath).ProductName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Management" Version="9.0.5" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.0" />
<PackageReference Include="Vulcan.NET" Version="2.2.0"/>

<PackageReference Include="Serilog.Aggregating.Filter" Version="1.1.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override Task<bool> DoInitialize(CancellationToken cancellationToken)
}
catch (Exception exc)
{
Global.Logger.Error("There was an error scanning for SoundBlasterX devices", exc);
Global.Logger.Error(exc, "There was an error scanning for SoundBlasterX devices");
IsInitialized = false;
return Task.FromResult(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected override Task<bool> DoInitialize(CancellationToken cancellationToken)
}
catch (Exception e)
{
Global.Logger.Error($"[UnifiedHID] device could not be initialized:", e);
Global.Logger.Error(e, $"[UnifiedHID] device could not be initialized");
}

return Task.FromResult(IsInitialized);
Expand Down Expand Up @@ -98,7 +98,7 @@ protected override Task Shutdown()
}
catch (Exception ex)
{
Global.Logger.Error("[UnifiedHID] there was an error shutting down devices", ex);
Global.Logger.Error(ex, "[UnifiedHID] there was an error shutting down devices");
}

return Task.CompletedTask;
Expand Down Expand Up @@ -157,7 +157,7 @@ protected override Task<bool> UpdateDevice(Dictionary<DeviceKeys, SimpleColor> k
}
catch (Exception ex)
{
Global.Logger.Error("[UnifiedHID] error when updating device:", ex);
Global.Logger.Error(ex, "[UnifiedHID] error when updating device:");
return Task.FromResult(false);
}
}
Expand Down
48 changes: 45 additions & 3 deletions Project-Aurora/AuroraDeviceManager/Utils/ProcessUtils.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
using System.Diagnostics;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.ServiceProcess;

namespace AuroraDeviceManager.Utils;

public static class ProcessUtils
{
public static bool IsProcessRunning(string processName)
{
var processesByName = Process.GetProcessesByName(processName);
return processesByName.Length > 0;
if (string.IsNullOrWhiteSpace(processName))
{
return false;
}

var normalizedName = Path.GetFileNameWithoutExtension(processName).Trim();
if (string.IsNullOrEmpty(normalizedName))
{
normalizedName = processName.Trim();
}

try
{
var processesByName = Process.GetProcessesByName(normalizedName);
if (processesByName.Length > 0)
{
return true;
}
}
catch
{
// ignore and fall back to service lookup
}

try
{
using var service = new ServiceController(normalizedName);
return service.Status is ServiceControllerStatus.Running
or ServiceControllerStatus.StartPending
or ServiceControllerStatus.ContinuePending;
}
catch (InvalidOperationException)
{
// service not found
}
catch (Win32Exception)
{
// access denied or service not accessible
}

return false;
}
}
5 changes: 3 additions & 2 deletions Project-Aurora/MemoryAccessProfiles/PluginMain.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AuroraRgb.Profiles;
using AuroraRgb.EffectsEngine;
using AuroraRgb.Profiles;
using AuroraRgb.Settings;
using MemoryAccessProfiles.Profiles.Borderlands2;
using MemoryAccessProfiles.Profiles.CloneHero;
Expand Down Expand Up @@ -36,6 +37,6 @@ public void ProcessManager(object manager)

// Register all Application types in the assembly
foreach (var inst in profiles)
lightingStateManager.RegisterEvent(inst);
lightingStateManager.ApplicationManager.RegisterEvent(inst);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Drawing;
using AuroraRgb.Profiles;
using AuroraRgb.EffectsEngine;
using AuroraRgb.Settings;
using AuroraRgb.Settings.Layers;
using Common.Devices;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Drawing;
using AuroraRgb.Profiles;
using AuroraRgb.EffectsEngine;
using AuroraRgb.Settings;
using AuroraRgb.Settings.Layers;
using Common.Devices;
Expand Down
2 changes: 1 addition & 1 deletion Project-Aurora/Project-Aurora/AuroraApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public async Task OnStartup()
}

var lsm = await LightingStateManagerModule.LightningStateManager;
lsm.InitializeApps();
lsm.ApplicationManager.InitializeApps();

//Debug Windows on Startup
if (Global.Configuration.BitmapWindowOnStartUp)
Expand Down
4 changes: 2 additions & 2 deletions Project-Aurora/Project-Aurora/ConfigUi.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public Application? FocusedApplication
set
{
SetValue(FocusedApplicationProperty, value);
_lightingStateManager.Result.PreviewProfileKey = value != null ? value.Config.ID : string.Empty;
_lightingStateManager.Result.ApplicationManager.PreviewProfileKey = value != null ? value.Config.ID : string.Empty;
}
}

Expand Down Expand Up @@ -448,7 +448,7 @@ private async Task Window_ClosingAsync(Application? focusedApp)
}

var lightingStateManager = await _lightingStateManager;
lightingStateManager.PreviewProfileKey = string.Empty;
lightingStateManager.ApplicationManager.PreviewProfileKey = string.Empty;

switch (Global.Configuration.CloseMode)
{
Expand Down
17 changes: 9 additions & 8 deletions Project-Aurora/Project-Aurora/Control_ProfilesStack.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Windows.Input;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using AuroraRgb.EffectsEngine;
using AuroraRgb.Modules.GameStateListen;
using AuroraRgb.Profiles;
using AuroraRgb.Profiles.Generic_Application;
Expand Down Expand Up @@ -85,8 +86,8 @@ private async Task GenerateProfileStack(string focusedKey)

var lightingStateManager = await _lightingStateManager;
var profileLoadTasks = Global.Configuration.ProfileOrder
.Where(profileName => lightingStateManager.Events.ContainsKey(profileName))
.Select(profileName => lightingStateManager.Events[profileName])
.Where(profileName => lightingStateManager.ApplicationManager.Events.ContainsKey(profileName))
.Select(profileName => lightingStateManager.ApplicationManager.Events[profileName])
.OrderBy(item => item.Settings is { Hidden: false } ? 0 : 1)
.Select(application => InsertApplicationImage(focusedKey, application, focusedSetTaskCompletion, cancellationToken))
.Select(x => x.Task);
Expand Down Expand Up @@ -145,15 +146,15 @@ private async Task RemoveApplication(Application application)
var name = application.Config.ID;

var lightingStateManager = await _lightingStateManager;
if (!lightingStateManager.Events.TryGetValue(name, out var value)) return;
if (!lightingStateManager.ApplicationManager.Events.TryGetValue(name, out var value)) return;
var applicationName = value.Config.ProcessNames[0];

var cancelled = MessageBox.Show(
$"Are you sure you want to delete profile for {applicationName}?", "Remove Profile",
MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes;
if (cancelled) return;

lightingStateManager.RemoveGenericProfile(name);
lightingStateManager.ApplicationManager.RemoveGenericProfile(name);

Dispatcher.InvokeAsync(async () => await GenerateProfileStack());
}
Expand All @@ -167,7 +168,7 @@ private async void AddProfile_MouseDown(object? sender, MouseButtonEventArgs e)
var filename = Path.GetFileName(dialog.ChosenExecutablePath.ToLowerInvariant());

var lightingStateManager = await _lightingStateManager;
if (lightingStateManager.Events.ContainsKey(filename))
if (lightingStateManager.ApplicationManager.Events.ContainsKey(filename))
{
MessageBox.Show("Profile for this application already exists.");
return;
Expand All @@ -188,7 +189,7 @@ private async void AddProfile_MouseDown(object? sender, MouseButtonEventArgs e)

ico.Dispose();

await lightingStateManager.RegisterEvent(genAppPm);
await lightingStateManager.ApplicationManager.RegisterEvent(genAppPm);
await ConfigManager.SaveAsync(Global.Configuration);
await GenerateProfileStack(filename);
}
Expand Down Expand Up @@ -247,12 +248,12 @@ private void ContextMenu_Opened(object? sender, RoutedEventArgs e)

private async void Control_ProfilesStack_OnLoaded(object sender, RoutedEventArgs e)
{
(await _lightingStateManager).EventAdded += LightingStateManagerOnEventAdded;
(await _lightingStateManager).ApplicationManager.EventAdded += LightingStateManagerOnEventAdded;
}

private async void Control_ProfilesStack_OnUnloaded(object sender, RoutedEventArgs e)
{
(await _lightingStateManager).EventAdded -= LightingStateManagerOnEventAdded;
(await _lightingStateManager).ApplicationManager.EventAdded -= LightingStateManagerOnEventAdded;
}

private void FocusApplication(Application application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public EffectSettingsWindow(LayerEffectConfig EffectConfig)
}
catch(Exception exc)
{
Global.logger.Error("Could not set brush:", exc);
Global.logger.Error(exc, "Could not set brush");
}

gradient_editor.BrushChanged += Gradient_editor_BrushChanged;
Expand Down Expand Up @@ -114,12 +114,12 @@ private void accept_button_Click(object? sender, RoutedEventArgs e)

private void Window_Activated(object? sender, EventArgs e)
{
Global.LightingStateManager.PreviewProfileKey = preview_key;
Global.LightingStateManager.ApplicationManager.PreviewProfileKey = preview_key;
}

private void Window_Deactivated(object? sender, EventArgs e)
{
Global.LightingStateManager.PreviewProfileKey = null;
Global.LightingStateManager.ApplicationManager.PreviewProfileKey = null;
}

private void effect_angle_ValueChanged(object? sender, RoutedPropertyChangedEventArgs<object> e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using AuroraRgb.EffectsEngine;
using AuroraRgb.Profiles;
using AuroraRgb.Utils;
using Xceed.Wpf.Toolkit;
Expand Down
Loading