[WIP] Changing Icon lib libraries

The current Icon Library is old and I haven't been
using it properly :). I need to use something different
and the IconExtractor library is still being updated
whereas the IconLib.Unofficial isn't any longer.
This commit is contained in:
temacdonald 2020-04-29 22:29:43 +12:00
parent 04c93e283a
commit ae1a759be4
13 changed files with 63 additions and 32 deletions

View File

@ -8,8 +8,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{76DF2BCF-911B-4820-B63E-8F3468DB5E79}</ProjectGuid> <ProjectGuid>{76DF2BCF-911B-4820-B63E-8F3468DB5E79}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>HeliosDisplayManagement.Reporting</RootNamespace> <RootNamespace>HeliosPlus.Reporting</RootNamespace>
<AssemblyName>HeliosDisplayManagement.Reporting</AssemblyName> <AssemblyName>HeliosPlus.Reporting</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -37,6 +37,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -56,6 +62,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="FodyWeavers.xml" /> <Content Include="FodyWeavers.xml" />
<Content Include="Icon.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Costura.Fody"> <PackageReference Include="Costura.Fody">

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -51,7 +51,7 @@ namespace HeliosPlus.Reporting
private static void Main(string[] args) private static void Main(string[] args)
{ {
_writer = new StreamWriter(new FileStream( _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)); FileMode.CreateNew));
try try
@ -207,7 +207,7 @@ namespace HeliosPlus.Reporting
try try
{ {
Dump(Profile.GetAllProfiles(), "HeliosDisplayManagement.Shared.Profile.GetAllProfiles()", null, 99); Dump(Profile.GetAllProfiles(), "HeliosPlus.Shared.Profile.GetAllProfiles()", null, 99);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -17,7 +17,7 @@ namespace HeliosPlus.Shared
{ {
using ( using (
var key = var key =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Helios Display Management", false)) Registry.LocalMachine.OpenSubKey(@"SOFTWARE\HeliosPlus", false))
{ {
var executableAddress = key?.GetValue(@"ExecutableAddress", null) as string; var executableAddress = key?.GetValue(@"ExecutableAddress", null) as string;

View File

@ -5,7 +5,7 @@ using HeliosPlus.ShellExtension.Resources;
namespace HeliosPlus.ShellExtension namespace HeliosPlus.ShellExtension
{ {
internal class HeliosDisplayManagement internal class HeliosPlus
{ {
public static void Open( public static void Open(
HeliosStartupAction action = HeliosStartupAction.None, HeliosStartupAction action = HeliosStartupAction.None,

View File

@ -17,15 +17,15 @@ namespace HeliosPlus.ShellExtension
{ {
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16)); var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, null, 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 Enabled = profile.IsPossible && !profile.IsActive
}); });
profileMenu.DropDownItems.Add(new ToolStripSeparator()); profileMenu.DropDownItems.Add(new ToolStripSeparator());
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null, 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, 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; return profileMenu;
} }
@ -55,7 +55,7 @@ namespace HeliosPlus.ShellExtension
Properties.Resources.Icon_x16, Properties.Resources.Icon_x16,
(sender, args) => (sender, args) =>
{ {
HeliosDisplayManagement.Open(); HeliosPlus.Open();
})); }));
explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(extensionMenu);
explorerMenu.Items.Add(new ToolStripSeparator()); explorerMenu.Items.Add(new ToolStripSeparator());
@ -66,7 +66,7 @@ namespace HeliosPlus.ShellExtension
Properties.Resources.Icon_x16, Properties.Resources.Icon_x16,
(sender, args) => (sender, args) =>
{ {
HeliosDisplayManagement.Open(); HeliosPlus.Open();
}); });
explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(extensionMenu);
explorerMenu.Items.Add(new ToolStripSeparator()); explorerMenu.Items.Add(new ToolStripSeparator());

View File

@ -45,7 +45,7 @@ namespace HeliosPlus.ShellExtension
Properties.Resources.Icon_x16, Properties.Resources.Icon_x16,
(sender, args) => (sender, args) =>
{ {
HeliosDisplayManagement.Open(); HeliosPlus.Open();
})); }));
explorerMenu.Items.Add(extensionMenu); explorerMenu.Items.Add(extensionMenu);
explorerMenu.Items.Add(new ToolStripSeparator()); explorerMenu.Items.Add(new ToolStripSeparator());
@ -59,12 +59,12 @@ namespace HeliosPlus.ShellExtension
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16)); var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null, profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null,
(sender, args) => (sender, args) =>
HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.SwitchProfile, profile, HeliosPlus.OpenSteamGame(HeliosStartupAction.SwitchProfile, profile,
appId))); appId)));
profileMenu.DropDownItems.Add(new ToolStripSeparator()); profileMenu.DropDownItems.Add(new ToolStripSeparator());
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null, profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
(sender, args) => (sender, args) =>
HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.CreateShortcut, profile, HeliosPlus.OpenSteamGame(HeliosStartupAction.CreateShortcut, profile,
appId))); appId)));
return profileMenu; return profileMenu;

View File

@ -68,6 +68,15 @@ namespace HeliosPlus.GameLibraries
_steamGameExe = steamGameExe; _steamGameExe = steamGameExe;
_steamGameIcon = steamGameIcon; _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; } public uint GameId { get => _steamGameId; }

View File

@ -49,6 +49,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon> <ApplicationIcon>Icon.ico</ApplicationIcon>
@ -181,20 +182,25 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CircularProgressBar"> <PackageReference Include="CircularProgressBar">
<Version>2.7.0.7</Version> <Version>2.8.0.16</Version>
</PackageReference>
<PackageReference Include="Gameloop.Vdf">
<Version>0.5.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="HtmlAgilityPack"> <PackageReference Include="HtmlAgilityPack">
<Version>1.11.23</Version> <Version>1.11.23</Version>
</PackageReference> </PackageReference>
<PackageReference Include="IconExtractor.dll">
<Version>1.0.2.1-beta</Version>
</PackageReference>
<PackageReference Include="IconLib.Unofficial"> <PackageReference Include="IconLib.Unofficial">
<Version>0.73.0</Version> <Version>0.73.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="McMaster.Extensions.CommandLineUtils"> <PackageReference Include="McMaster.Extensions.CommandLineUtils">
<Version>3.0.0</Version> <Version>3.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<Version>3.0.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version> <Version>12.0.3</Version>
</PackageReference> </PackageReference>

View File

@ -13,7 +13,7 @@ namespace HeliosPlus.InterProcess
ContractDescription.GetContract(typeof(IService)), ContractDescription.GetContract(typeof(IService)),
new NetNamedPipeBinding(), new NetNamedPipeBinding(),
new EndpointAddress( new EndpointAddress(
$"net.pipe://localhost/HeliosDisplayManagement_IPC{process.Id}/Service"))) $"net.pipe://localhost/HeliosPlus_IPC{process.Id}/Service")))
{ {
} }

View File

@ -44,7 +44,7 @@ namespace HeliosPlus.InterProcess
var service = new IPCService(); var service = new IPCService();
_serviceHost = new ServiceHost( _serviceHost = new ServiceHost(
service, 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.AddServiceEndpoint(typeof(IService), new NetNamedPipeBinding(), "Service");
_serviceHost.Open(); _serviceHost.Open();

View File

@ -591,16 +591,17 @@ namespace HeliosPlus {
throw new Exception("ERROR - Couldn't convert the string steamGameIdToRun parameter to steamGameIdUint in SwitchToSteamGame!"); 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); var rollbackProfile = Profile.GetCurrent(string.Empty);
// Check that the profile we've been asked to change to will actually work
if (!profile.IsPossible) if (!profile.IsPossible)
{ {
throw new Exception(Language.Selected_profile_is_not_possible); throw new Exception(Language.Selected_profile_is_not_possible);
} }
if ( //
IPCClient.QueryAll() if ( IPCClient.QueryAll().Any(
.Any(
client => client =>
client.Status == InstanceStatus.Busy || client.Status == InstanceStatus.Busy ||
client.Status == InstanceStatus.OnHold)) 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); .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<SteamGame> allSteamGames = SteamGame.GetAllInstalledGames(); List<SteamGame> 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; SteamGame steamGameToRun = null;
foreach (SteamGame steamGameToCheck in allSteamGames) foreach (SteamGame steamGameToCheck in allSteamGames)
{ {
@ -624,23 +633,21 @@ namespace HeliosPlus {
} }
if (!SteamGame.SteamInstalled) // Attempt to change to a different profile if it's needed
{
throw new Exception(Language.Steam_is_not_installed);
}
if (!GoProfile(profile)) if (!GoProfile(profile))
{ {
throw new Exception(Language.Can_not_change_active_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}"; var address = $"steam://rungameid/{steamGameToRun.GameId}";
if (!string.IsNullOrWhiteSpace(steamGameArguments)) if (!string.IsNullOrWhiteSpace(steamGameArguments))
{ {
address += "/" + steamGameArguments; address += "/" + steamGameArguments;
} }
var steamProcess = System.Diagnostics.Process.Start(address); var steamProcess = System.Diagnostics.Process.Start(address);
// Wait for steam game to update and then run // Wait for steam game to update and then run
var ticks = 0; var ticks = 0;

View File

@ -1,4 +1,5 @@
using System.Reflection; using System.Resources;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
@ -36,4 +37,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.9.*")] [assembly: AssemblyVersion("0.9.9.*")]
[assembly: AssemblyFileVersion("0.9.9.0")] [assembly: AssemblyFileVersion("0.9.9.0")]
[assembly: NeutralResourcesLanguage("")]