diff --git a/HeliosDisplayManagement.Reporting/HeliosPlus.Reporting.csproj b/HeliosDisplayManagement.Reporting/HeliosPlus.Reporting.csproj index 96aaef0..8266bfc 100644 --- a/HeliosDisplayManagement.Reporting/HeliosPlus.Reporting.csproj +++ b/HeliosDisplayManagement.Reporting/HeliosPlus.Reporting.csproj @@ -8,8 +8,8 @@ AnyCPU {76DF2BCF-911B-4820-B63E-8F3468DB5E79} Exe - HeliosDisplayManagement.Reporting - HeliosDisplayManagement.Reporting + HeliosPlus.Reporting + HeliosPlus.Reporting v4.8 512 true @@ -37,6 +37,12 @@ 4 false + + Icon.ico + + + true + @@ -56,6 +62,7 @@ + diff --git a/HeliosDisplayManagement.Reporting/Icon.ico b/HeliosDisplayManagement.Reporting/Icon.ico new file mode 100644 index 0000000..54753b2 Binary files /dev/null and b/HeliosDisplayManagement.Reporting/Icon.ico differ diff --git a/HeliosDisplayManagement.Reporting/Program.cs b/HeliosDisplayManagement.Reporting/Program.cs index 659d7d5..7dd37f5 100644 --- a/HeliosDisplayManagement.Reporting/Program.cs +++ b/HeliosDisplayManagement.Reporting/Program.cs @@ -51,7 +51,7 @@ namespace HeliosPlus.Reporting private static void Main(string[] args) { _writer = new StreamWriter(new FileStream( - string.Format("HeliosDisplayManagement.Reporting.{0}.log", Process.GetCurrentProcess().Id), + string.Format("HeliosPlus.Reporting.{0}.log", Process.GetCurrentProcess().Id), FileMode.CreateNew)); try @@ -207,7 +207,7 @@ namespace HeliosPlus.Reporting try { - Dump(Profile.GetAllProfiles(), "HeliosDisplayManagement.Shared.Profile.GetAllProfiles()", null, 99); + Dump(Profile.GetAllProfiles(), "HeliosPlus.Shared.Profile.GetAllProfiles()", null, 99); } catch (Exception e) { diff --git a/HeliosDisplayManagement.Shared/Helios.cs b/HeliosDisplayManagement.Shared/Helios.cs index b2deba1..efa3527 100644 --- a/HeliosDisplayManagement.Shared/Helios.cs +++ b/HeliosDisplayManagement.Shared/Helios.cs @@ -17,7 +17,7 @@ namespace HeliosPlus.Shared { using ( var key = - Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Helios Display Management", false)) + Registry.LocalMachine.OpenSubKey(@"SOFTWARE\HeliosPlus", false)) { var executableAddress = key?.GetValue(@"ExecutableAddress", null) as string; diff --git a/HeliosDisplayManagement.ShellExtension/Helios.cs b/HeliosDisplayManagement.ShellExtension/Helios.cs index 390c28e..b437eab 100644 --- a/HeliosDisplayManagement.ShellExtension/Helios.cs +++ b/HeliosDisplayManagement.ShellExtension/Helios.cs @@ -5,7 +5,7 @@ using HeliosPlus.ShellExtension.Resources; namespace HeliosPlus.ShellExtension { - internal class HeliosDisplayManagement + internal class HeliosPlus { public static void Open( HeliosStartupAction action = HeliosStartupAction.None, diff --git a/HeliosDisplayManagement.ShellExtension/HeliosDesktopMenuExtension.cs b/HeliosDisplayManagement.ShellExtension/HeliosDesktopMenuExtension.cs index d8db3e2..f2d7005 100644 --- a/HeliosDisplayManagement.ShellExtension/HeliosDesktopMenuExtension.cs +++ b/HeliosDisplayManagement.ShellExtension/HeliosDesktopMenuExtension.cs @@ -17,15 +17,15 @@ namespace HeliosPlus.ShellExtension { var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16)); profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, null, - (sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile)) + (sender, args) => HeliosPlus.Open(HeliosStartupAction.SwitchProfile, profile)) { Enabled = profile.IsPossible && !profile.IsActive }); profileMenu.DropDownItems.Add(new ToolStripSeparator()); profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null, - (sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.EditProfile, profile))); + (sender, args) => HeliosPlus.Open(HeliosStartupAction.EditProfile, profile))); profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null, - (sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.CreateShortcut, profile))); + (sender, args) => HeliosPlus.Open(HeliosStartupAction.CreateShortcut, profile))); return profileMenu; } @@ -55,7 +55,7 @@ namespace HeliosPlus.ShellExtension Properties.Resources.Icon_x16, (sender, args) => { - HeliosDisplayManagement.Open(); + HeliosPlus.Open(); })); explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(new ToolStripSeparator()); @@ -66,7 +66,7 @@ namespace HeliosPlus.ShellExtension Properties.Resources.Icon_x16, (sender, args) => { - HeliosDisplayManagement.Open(); + HeliosPlus.Open(); }); explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(new ToolStripSeparator()); diff --git a/HeliosDisplayManagement.ShellExtension/HeliosSteamUrlMenuExtension.cs b/HeliosDisplayManagement.ShellExtension/HeliosSteamUrlMenuExtension.cs index 3f0974f..1cc071b 100644 --- a/HeliosDisplayManagement.ShellExtension/HeliosSteamUrlMenuExtension.cs +++ b/HeliosDisplayManagement.ShellExtension/HeliosSteamUrlMenuExtension.cs @@ -45,7 +45,7 @@ namespace HeliosPlus.ShellExtension Properties.Resources.Icon_x16, (sender, args) => { - HeliosDisplayManagement.Open(); + HeliosPlus.Open(); })); explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(new ToolStripSeparator()); @@ -59,12 +59,12 @@ namespace HeliosPlus.ShellExtension var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16)); profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null, (sender, args) => - HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.SwitchProfile, profile, + HeliosPlus.OpenSteamGame(HeliosStartupAction.SwitchProfile, profile, appId))); profileMenu.DropDownItems.Add(new ToolStripSeparator()); profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null, (sender, args) => - HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.CreateShortcut, profile, + HeliosPlus.OpenSteamGame(HeliosStartupAction.CreateShortcut, profile, appId))); return profileMenu; diff --git a/HeliosDisplayManagement/GameLibraries/SteamGame.cs b/HeliosDisplayManagement/GameLibraries/SteamGame.cs index dd20086..9e58f0d 100644 --- a/HeliosDisplayManagement/GameLibraries/SteamGame.cs +++ b/HeliosDisplayManagement/GameLibraries/SteamGame.cs @@ -68,6 +68,15 @@ namespace HeliosPlus.GameLibraries _steamGameExe = steamGameExe; _steamGameIcon = steamGameIcon; + // Find the SteamExe location, and the SteamPath for later + using (var key = Registry.CurrentUser.OpenSubKey(_registrySteamKey, RegistryKeyPermissionCheck.ReadSubTree)) + { + _steamExe = (string)key?.GetValue(@"SteamExe", string.Empty) ?? string.Empty; + _steamExe = _steamExe.Replace('/', '\\'); + _steamPath = (string)key?.GetValue(@"SteamPath", string.Empty) ?? string.Empty; + _steamPath = _steamPath.Replace('/', '\\'); + } + } public uint GameId { get => _steamGameId; } diff --git a/HeliosDisplayManagement/HeliosPlus.csproj b/HeliosDisplayManagement/HeliosPlus.csproj index 8387ea3..21e539d 100644 --- a/HeliosDisplayManagement/HeliosPlus.csproj +++ b/HeliosDisplayManagement/HeliosPlus.csproj @@ -49,6 +49,7 @@ prompt 4 false + true Icon.ico @@ -181,20 +182,25 @@ - 2.7.0.7 - - - 0.5.0 + 2.8.0.16 1.11.23 + + 1.0.2.1-beta + 0.73.0 3.0.0 + + 3.0.0 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + 12.0.3 diff --git a/HeliosDisplayManagement/InterProcess/IPCClient.cs b/HeliosDisplayManagement/InterProcess/IPCClient.cs index 9a2918f..5819315 100644 --- a/HeliosDisplayManagement/InterProcess/IPCClient.cs +++ b/HeliosDisplayManagement/InterProcess/IPCClient.cs @@ -13,7 +13,7 @@ namespace HeliosPlus.InterProcess ContractDescription.GetContract(typeof(IService)), new NetNamedPipeBinding(), new EndpointAddress( - $"net.pipe://localhost/HeliosDisplayManagement_IPC{process.Id}/Service"))) + $"net.pipe://localhost/HeliosPlus_IPC{process.Id}/Service"))) { } diff --git a/HeliosDisplayManagement/InterProcess/IPCService.cs b/HeliosDisplayManagement/InterProcess/IPCService.cs index ed3b7b1..5d33ca4 100644 --- a/HeliosDisplayManagement/InterProcess/IPCService.cs +++ b/HeliosDisplayManagement/InterProcess/IPCService.cs @@ -44,7 +44,7 @@ namespace HeliosPlus.InterProcess var service = new IPCService(); _serviceHost = new ServiceHost( service, - new Uri($"net.pipe://localhost/HeliosDisplayManagement_IPC{process.Id}")); + new Uri($"net.pipe://localhost/HeliosPlus_IPC{process.Id}")); _serviceHost.AddServiceEndpoint(typeof(IService), new NetNamedPipeBinding(), "Service"); _serviceHost.Open(); diff --git a/HeliosDisplayManagement/Program.cs b/HeliosDisplayManagement/Program.cs index 6d22f8b..a034110 100644 --- a/HeliosDisplayManagement/Program.cs +++ b/HeliosDisplayManagement/Program.cs @@ -591,16 +591,17 @@ namespace HeliosPlus { throw new Exception("ERROR - Couldn't convert the string steamGameIdToRun parameter to steamGameIdUint in SwitchToSteamGame!"); } + // Save the profile we're on now var rollbackProfile = Profile.GetCurrent(string.Empty); + // Check that the profile we've been asked to change to will actually work if (!profile.IsPossible) { throw new Exception(Language.Selected_profile_is_not_possible); } - if ( - IPCClient.QueryAll() - .Any( + // + if ( IPCClient.QueryAll().Any( client => client.Status == InstanceStatus.Busy || client.Status == InstanceStatus.OnHold)) @@ -610,9 +611,17 @@ namespace HeliosPlus { .Another_instance_of_this_program_is_in_working_state_Please_close_other_instances_before_trying_to_switch_profile); } - + // Create the SteamGame objects so we can use them shortly + // Get the game information relevant to the game we're switching to List allSteamGames = SteamGame.GetAllInstalledGames(); + // Check if Steam is installed and error if it isn't + if (!SteamGame.SteamInstalled) + { + throw new Exception(Language.Steam_is_not_installed); + } + + // Otherwise try to find the game we've been asked to run SteamGame steamGameToRun = null; foreach (SteamGame steamGameToCheck in allSteamGames) { @@ -624,23 +633,21 @@ namespace HeliosPlus { } - if (!SteamGame.SteamInstalled) - { - throw new Exception(Language.Steam_is_not_installed); - } - + // Attempt to change to a different profile if it's needed if (!GoProfile(profile)) { throw new Exception(Language.Can_not_change_active_profile); } + // Prepare to start the steam game using the URI interface + // as used by Steam for it's own desktop shortcuts. var address = $"steam://rungameid/{steamGameToRun.GameId}"; - if (!string.IsNullOrWhiteSpace(steamGameArguments)) { address += "/" + steamGameArguments; } + var steamProcess = System.Diagnostics.Process.Start(address); // Wait for steam game to update and then run var ticks = 0; diff --git a/HeliosDisplayManagement/Properties/AssemblyInfo.cs b/HeliosDisplayManagement/Properties/AssemblyInfo.cs index e82a775..08b224e 100644 --- a/HeliosDisplayManagement/Properties/AssemblyInfo.cs +++ b/HeliosDisplayManagement/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Resources; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -36,4 +37,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.9.9.*")] -[assembly: AssemblyFileVersion("0.9.9.0")] \ No newline at end of file +[assembly: AssemblyFileVersion("0.9.9.0")] +[assembly: NeutralResourcesLanguage("")]