diff --git a/DisplayMagician/DisplayMagician.csproj b/DisplayMagician/DisplayMagician.csproj
index 90e53fb..3757afb 100644
--- a/DisplayMagician/DisplayMagician.csproj
+++ b/DisplayMagician/DisplayMagician.csproj
@@ -79,6 +79,7 @@
+
@@ -90,6 +91,7 @@
+
diff --git a/DisplayMagician/GameLibraries/GameUtils.cs b/DisplayMagician/GameLibraries/GameUtils.cs
new file mode 100644
index 0000000..e075392
--- /dev/null
+++ b/DisplayMagician/GameLibraries/GameUtils.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Management;
+
+namespace DisplayMagician.GameLibraries
+{
+ class GameUtils
+ {
+ public static string GetMainModuleFilepath(int processId)
+ {
+ string wmiQueryString = "SELECT ProcessId, ExecutablePath FROM Win32_Process WHERE ProcessId = " + processId;
+ using (var searcher = new ManagementObjectSearcher(wmiQueryString))
+ {
+ using (var results = searcher.Get())
+ {
+ ManagementObject mo = results.Cast().FirstOrDefault();
+ if (mo != null)
+ {
+ return (string)mo["ExecutablePath"];
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/DisplayMagician/GameLibraries/SteamGame.cs b/DisplayMagician/GameLibraries/SteamGame.cs
index ae8e35a..b3a5dea 100644
--- a/DisplayMagician/GameLibraries/SteamGame.cs
+++ b/DisplayMagician/GameLibraries/SteamGame.cs
@@ -83,8 +83,16 @@ namespace DisplayMagician.GameLibraries
List gameProcesses = Process.GetProcessesByName(_steamGameProcessName).ToList();
foreach (Process gameProcess in gameProcesses)
{
- if (gameProcess.MainModule.FileName.StartsWith(_steamGameExePath))
- numGameProcesses++;
+ try
+ {
+ if (gameProcess.MainModule.FileName.StartsWith(_steamGameExePath))
+ numGameProcesses++;
+ }
+ catch (Exception ex)
+ {
+ if (GameUtils.GetMainModuleFilepath(gameProcess.Id).StartsWith(_steamGameExePath))
+ numGameProcesses++;
+ }
}
if (numGameProcesses > 0)
return true;
diff --git a/DisplayMagician/GameLibraries/UplayGame.cs b/DisplayMagician/GameLibraries/UplayGame.cs
index c8c05c1..e9183a8 100644
--- a/DisplayMagician/GameLibraries/UplayGame.cs
+++ b/DisplayMagician/GameLibraries/UplayGame.cs
@@ -84,8 +84,16 @@ namespace DisplayMagician.GameLibraries
List gameProcesses = Process.GetProcessesByName(_uplayGameProcessName).ToList();
foreach (Process gameProcess in gameProcesses)
{
- if (gameProcess.MainModule.FileName.StartsWith(_uplayGameExePath))
- numGameProcesses++;
+ try
+ {
+ if (gameProcess.MainModule.FileName.StartsWith(_uplayGameExePath))
+ numGameProcesses++;
+ }
+ catch (Exception ex)
+ {
+ if (GameUtils.GetMainModuleFilepath(gameProcess.Id).StartsWith(_uplayGameExePath))
+ numGameProcesses++;
+ }
}
if (numGameProcesses > 0)
return true;
diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs
index b94da0a..77c4257 100644
--- a/DisplayMagician/Properties/AssemblyInfo.cs
+++ b/DisplayMagician/Properties/AssemblyInfo.cs
@@ -37,8 +37,8 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.2.0.*")]
-[assembly: AssemblyFileVersion("0.2.0.0")]
+[assembly: AssemblyVersion("0.2.1.*")]
+[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(true)]
\ No newline at end of file
diff --git a/DisplayMagician/ShortcutRepository.cs b/DisplayMagician/ShortcutRepository.cs
index 6a4236a..d8a4ef8 100644
--- a/DisplayMagician/ShortcutRepository.cs
+++ b/DisplayMagician/ShortcutRepository.cs
@@ -661,7 +661,7 @@ namespace DisplayMagician
// Construct the Windows toast content
ToastContentBuilder tcBuilder = new ToastContentBuilder()
.AddToastActivationInfo("notify=runningApplication", ToastActivationType.Foreground)
- .AddText($"Running {processNameToLookFor} Shortcut", hintMaxLines: 1)
+ .AddText($"Running {processNameToLookFor}", hintMaxLines: 1)
.AddText($"Waiting for all {processNameToLookFor} windows to exit...");
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
ToastContent toastContent = tcBuilder.Content;
@@ -699,6 +699,23 @@ namespace DisplayMagician
Console.WriteLine($"{processNameToLookFor} has exited.");
logger.Debug($"ShortcutRepository/RunShortcut - Application {processNameToLookFor} has exited.");
+ // Tell the user that the application has closed
+ // Construct the toast content
+ tcBuilder = new ToastContentBuilder()
+ .AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
+ .AddText($"{processNameToLookFor} was closed", hintMaxLines: 1)
+ .AddText($"All {processNameToLookFor} processes were shutdown and changes were reverted.");
+ toastContent = tcBuilder.Content;
+ // Make sure to use Windows.Data.Xml.Dom
+ doc = new XmlDocument();
+ doc.LoadXml(toastContent.GetContent());
+ // And create the toast notification
+ toast = new ToastNotification(doc);
+ // Remove any other Notifications from us
+ DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
+ // And then show it
+ DesktopNotifications.DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
+
}
else if (shortcutToUse.Category.Equals(ShortcutCategory.Game))
@@ -759,7 +776,7 @@ namespace DisplayMagician
// Construct the Windows toast content
ToastContentBuilder tcBuilder = new ToastContentBuilder()
.AddToastActivationInfo("notify=runningSteamGame", ToastActivationType.Foreground)
- .AddText($"Running {shortcutToUse.GameName} Shortcut", hintMaxLines: 1)
+ .AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
.AddText($"Waiting for the Steam Game {shortcutToUse.GameName} to exit...");
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
ToastContent toastContent = tcBuilder.Content;
@@ -791,6 +808,24 @@ namespace DisplayMagician
Console.WriteLine($"{steamGameToRun.Name} has exited.");
logger.Debug($"ShortcutRepository/RunShortcut - Steam Game {steamGameToRun.Name} has exited.");
+ // Tell the user that the Steam Game has closed
+ // Construct the toast content
+ tcBuilder = new ToastContentBuilder()
+ .AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
+ .AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
+ .AddText($"{shortcutToUse.GameName} game was shutdown and changes were reverted.");
+ toastContent = tcBuilder.Content;
+ // Make sure to use Windows.Data.Xml.Dom
+ doc = new XmlDocument();
+ doc.LoadXml(toastContent.GetContent());
+ // And create the toast notification
+ toast = new ToastNotification(doc);
+ // Remove any other Notifications from us
+ DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
+ // And then show it
+ DesktopNotifications.DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
+
+
}
}
@@ -816,11 +851,56 @@ namespace DisplayMagician
address += "/0";
}
+ // Now we want to tell the user we're starting upc.exe
+ // Construct the Windows toast content
+ ToastContentBuilder tcBuilder = new ToastContentBuilder()
+ .AddToastActivationInfo("notify=startingUplay", ToastActivationType.Foreground)
+ .AddText($"Starting Uplay", hintMaxLines: 1)
+ .AddText($"Waiting for Uplay to start (and update if needed)...");
+ //.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
+ ToastContent toastContent = tcBuilder.Content;
+ // Make sure to use Windows.Data.Xml.Dom
+ var doc = new XmlDocument();
+ doc.LoadXml(toastContent.GetContent());
+ // And create the toast notification
+ var toast = new ToastNotification(doc);
+ // Remove any other Notifications from us
+ DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
+ // And then show this notification
+ DesktopNotifications.DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
+
+
// Start the URI Handler to run Uplay
Console.WriteLine($"Starting Uplay Game: {uplayGameToRun.Name}");
- var uplayProcess = Process.Start(address);
+ Process uplayStartProcess = Process.Start(address);
- // Wait for Uplay game to update if needed
+ // Wait for Uplay to start
+ List uplayProcesses = null;
+ for (int secs = 0; secs >= (shortcutToUse.StartTimeout * 1000); secs += 500)
+ {
+
+ // Look for the processes with the ProcessName we sorted out earlier
+ uplayProcesses = Process.GetProcessesByName("upc").ToList();
+
+ // If we have found one or more processes then we should be good to go
+ // so let's break
+ if (uplayProcesses.Count > 0)
+ {
+ logger.Debug($"Found {uplayProcesses.Count} 'upc' processes have started");
+ break;
+ }
+
+ // Let's wait a little while if we couldn't find
+ // any processes yet
+ Thread.Sleep(500);
+
+ }
+
+ // Delay 5secs
+ Thread.Sleep(5000);
+
+ // Now we know the Uplay app is running then
+ // we wait until the Uplay game is running (*allows for uplay update)
for (int secs = 0; secs >= (shortcutToUse.StartTimeout * 1000); secs += 500)
{
@@ -836,7 +916,7 @@ namespace DisplayMagician
}
// Store the Uplay Process ID for later
- IPCService.GetInstance().HoldProcessId = uplayProcess?.Id ?? 0;
+ IPCService.GetInstance().HoldProcessId = uplayStartProcess?.Id ?? 0;
IPCService.GetInstance().Status = InstanceStatus.OnHold;
// Add a status notification icon in the status area
@@ -848,17 +928,17 @@ namespace DisplayMagician
// Now we want to tell the user we're running a game!
// Construct the Windows toast content
- ToastContentBuilder tcBuilder = new ToastContentBuilder()
+ tcBuilder = new ToastContentBuilder()
.AddToastActivationInfo("notify=runningUplayGame", ToastActivationType.Foreground)
- .AddText($"Running {shortcutToUse.GameName} Shortcut", hintMaxLines: 1)
+ .AddText($"Running {shortcutToUse.GameName}", hintMaxLines: 1)
.AddText($"Waiting for the Uplay Game {shortcutToUse.GameName} to exit...");
//.AddButton("Stop", ToastActivationType.Background, "notify=runningGame&action=stop");
- ToastContent toastContent = tcBuilder.Content;
+ toastContent = tcBuilder.Content;
// Make sure to use Windows.Data.Xml.Dom
- var doc = new XmlDocument();
+ doc = new XmlDocument();
doc.LoadXml(toastContent.GetContent());
// And create the toast notification
- var toast = new ToastNotification(doc);
+ toast = new ToastNotification(doc);
// Remove any other Notifications from us
DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
// And then show this notification
@@ -882,6 +962,23 @@ namespace DisplayMagician
}
Console.WriteLine($"{uplayGameToRun.Name} has exited.");
logger.Debug($"ShortcutRepository/RunShortcut - Uplay Game {uplayGameToRun.Name} has exited.");
+
+ // Tell the user that the Uplay Game has closed
+ // Construct the toast content
+ tcBuilder = new ToastContentBuilder()
+ .AddToastActivationInfo("notify=stopDetected", ToastActivationType.Foreground)
+ .AddText($"{shortcutToUse.GameName} was closed", hintMaxLines: 1)
+ .AddText($"{shortcutToUse.GameName} game was shutdown and changes were reverted.");
+ toastContent = tcBuilder.Content;
+ // Make sure to use Windows.Data.Xml.Dom
+ doc = new XmlDocument();
+ doc.LoadXml(toastContent.GetContent());
+ // And create the toast notification
+ toast = new ToastNotification(doc);
+ // Remove any other Notifications from us
+ DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
+ // And then show it
+ DesktopNotifications.DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
}
@@ -911,12 +1008,10 @@ namespace DisplayMagician
Application.DoEvents();
}
- // Remove any other Notifications from us
- DesktopNotifications.DesktopNotificationManagerCompat.History.Clear();
-
// Only replace the notification if we're minimised
if (Program.AppProgramSettings.MinimiseOnStart)
- {
+ {
+
// Remind the user that DisplayMagician is running the in background
// Construct the toast content
ToastContentBuilder tcBuilder = new ToastContentBuilder()
diff --git a/DisplayMagicianBootstrapper/Bundle.wxs b/DisplayMagicianBootstrapper/Bundle.wxs
deleted file mode 100644
index b349b93..0000000
--- a/DisplayMagicianBootstrapper/Bundle.wxs
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
- = 1000]]>
-
-
-
-
-
-
-
-
-
diff --git a/DisplayMagicianBootstrapper/DisplayMagicianBootstrapper.wixproj b/DisplayMagicianBootstrapper/DisplayMagicianBootstrapper.wixproj
deleted file mode 100644
index 0f9704b..0000000
--- a/DisplayMagicianBootstrapper/DisplayMagicianBootstrapper.wixproj
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
- Debug
- x86
- 3.10
- 59f3f084-ec7e-42d4-b0f4-8131b82bdb3b
- 2.0
- DisplayMagicianBootstrapper
- Bundle
-
-
- bin\$(Configuration)\
- obj\$(Configuration)\
- Debug
-
-
- bin\$(Configuration)\
- obj\$(Configuration)\
-
-
-
-
-
-
- $(WixExtDir)\WixNetFxExtension.dll
- WixNetFxExtension
-
-
- $(WixExtDir)\WixBalExtension.dll
- WixBalExtension
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DisplayMagicianSetup
- {dfd22d4d-f2e4-4ba4-b32a-7a990a35ba08}
- True
- True
- Binaries;Content;Satellites
- INSTALLFOLDER
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DisplayMagicianBootstrapper/Includes/DisplayMagicianVariables.wxi b/DisplayMagicianBootstrapper/Includes/DisplayMagicianVariables.wxi
deleted file mode 100644
index 60a2512..0000000
--- a/DisplayMagicianBootstrapper/Includes/DisplayMagicianVariables.wxi
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DisplayMagicianBootstrapper/Lang/en-us/EULA_en-us.rtf b/DisplayMagicianBootstrapper/Lang/en-us/EULA_en-us.rtf
deleted file mode 100644
index 821a9b3..0000000
Binary files a/DisplayMagicianBootstrapper/Lang/en-us/EULA_en-us.rtf and /dev/null differ
diff --git a/DisplayMagicianBootstrapper/Lang/en-us/Loc_en-us.wxl b/DisplayMagicianBootstrapper/Lang/en-us/Loc_en-us.wxl
deleted file mode 100644
index 639ad14..0000000
--- a/DisplayMagicianBootstrapper/Lang/en-us/Loc_en-us.wxl
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- 1033
- DisplayMagician
- DisplayMagician will automatically run your games with a different display profile or audio settings and then will revert everything back to the way it was when you've finished playing.
- \Lang\en-us\EULA_en-us.rtf
- LittleBitBig
- https://displaymagician.littlebitbig.com
- https://displaymagician.littlebitbig.com
- https://github.com/terrymacdonald/DisplayMagician/releases
- LogReporter will collect details about your computer to help us troubleshoot errors running DisplayMagician.
- This application is is not supported on your current OS. Your OS must be Windows 10 or later (64-bit only).
- .NET Framework 4.8 or higher is required for DisplayMagician to work. Please install the latest .NET Framework then run this installer again.
- You must close !(loc.ProductName) in order to upgrade it!
- You cannot downgrade !(loc.ProductName) to a lower version using this installer. Please uninstall the older version of !(loc.ProductName) first!
- A newer version of !(loc.ProductName) is already installed.
- This setup wizard will install DisplayMagician onto your computer. DisplayMagician will automatically run your games with a different display profile or audio settings and then will revert everything back to the way it was when you've finished playing. If you want to install DisplayMagician then click Next to continue or Cancel to exit.
-
diff --git a/DisplayMagicianLogReporter/Properties/AssemblyInfo.cs b/DisplayMagicianLogReporter/Properties/AssemblyInfo.cs
index c3e1c6a..07aacb9 100644
--- a/DisplayMagicianLogReporter/Properties/AssemblyInfo.cs
+++ b/DisplayMagicianLogReporter/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("0.2.1.0")]
+[assembly: AssemblyFileVersion("0.2.1.0")]
\ No newline at end of file
diff --git a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs
index 5573ea9..63d5bfc 100644
--- a/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs
+++ b/DisplayMagicianSetup/Fragments/DisplayMagicianFilesFragment.wxs
@@ -2,196 +2,196 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/DisplayMagicianShared/Properties/AssemblyInfo.cs b/DisplayMagicianShared/Properties/AssemblyInfo.cs
index 772dd47..786c6dc 100644
--- a/DisplayMagicianShared/Properties/AssemblyInfo.cs
+++ b/DisplayMagicianShared/Properties/AssemblyInfo.cs
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("HeliosDisplayManagement.Shared")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyTitle("DisplayMagician.Shared")]
+[assembly: AssemblyDescription("Shared libraries for DisplayMagician")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DisplayMagicianShared")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCompany("LittleBitBig")]
+[assembly: AssemblyProduct("DisplayMagician")]
+[assembly: AssemblyCopyright("Copyright © Terry MacDonald 2020-2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.9.5.*")]
-[assembly: AssemblyFileVersion("0.9.5.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("0.2.1.*")]
+[assembly: AssemblyFileVersion("0.2.1.0")]
\ No newline at end of file
diff --git a/DisplayMagicianShellExtension/Properties/AssemblyInfo.cs b/DisplayMagicianShellExtension/Properties/AssemblyInfo.cs
index 44dc039..a30c5da 100644
--- a/DisplayMagicianShellExtension/Properties/AssemblyInfo.cs
+++ b/DisplayMagicianShellExtension/Properties/AssemblyInfo.cs
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.0.*")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("0.2.1.*")]
+[assembly: AssemblyFileVersion("0.2.1.0")]
\ No newline at end of file