Skip to content

Commit cabec4b

Browse files
committed
1.5.11
[fix] Apps have been restarted, regardless of compatible mode setting. [fix] If restarts fails, HDRProfile won't crash anymore
1 parent c398486 commit cabec4b

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

Source/HDRProfile/HDRProfileHandler.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ private void UpdateRestartAppStates(IDictionary<ApplicationItem, ApplicationStat
505505
{
506506
newLastAppStates.Add(applicationState.Key, applicationState.Value);
507507

508-
if (restartApps)
508+
if (applicationState.Key.RestartProcess && restartApps)
509509
{
510510
if (!_lastAppStates.ContainsKey(applicationState.Key) && applicationState.Value != ApplicationState.None)
511511
RestartProcess(applicationState.Key);
@@ -519,18 +519,26 @@ private void UpdateRestartAppStates(IDictionary<ApplicationItem, ApplicationStat
519519

520520
private void RestartProcess(ApplicationItem application)
521521
{
522-
Tools.Logs.Add($"Restarting application {application.ApplicationName}", false);
523-
foreach (Process process in Process.GetProcessesByName(application.ApplicationName).ToList())
524-
if (process.StartTime < Process.GetCurrentProcess().StartTime)
525-
{
526-
Tools.Logs.Add($"Won't restart application {application.ApplicationName} as it was running before {Locale_Texts.HDRProfile}.", false);
522+
try
523+
{
524+
Tools.Logs.Add($"Restarting application {application.ApplicationName}", false);
525+
foreach (Process process in Process.GetProcessesByName(application.ApplicationName).ToList())
526+
if (process.StartTime < Process.GetCurrentProcess().StartTime)
527+
{
528+
Tools.Logs.Add($"Won't restart application {application.ApplicationName} as it was running before {Locale_Texts.HDRProfile}.", false);
527529

528-
return;
529-
}
530-
Process.GetProcessesByName(application.ApplicationName).ToList().ForEach(p => p.Kill());
531-
System.Threading.Thread.Sleep(1500);
532-
Process proc = new Process();
533-
StartApplication(application);
530+
return;
531+
}
532+
Process.GetProcessesByName(application.ApplicationName).ToList().ForEach(p => p.Kill());
533+
System.Threading.Thread.Sleep(1500);
534+
Process proc = new Process();
535+
StartApplication(application);
536+
}
537+
catch (Exception ex)
538+
{
539+
Tools.Logs.AddException($"Failed to restart process {application.DisplayName} ({application.ApplicationFilePath}).", ex);
540+
throw;
541+
}
534542
}
535543

536544
#endregion Process handling

Source/HDRProfile/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
5353
// indem Sie "*" wie unten gezeigt eingeben:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("1.5.10.0")]
56-
[assembly: AssemblyFileVersion("1.5.10.0")]
55+
[assembly: AssemblyVersion("1.5.11.0")]
56+
[assembly: AssemblyFileVersion("1.5.11.0")]

Source/HDRProfile/UWP/UWPApp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private void ReadAppxManifest()
4545
string manifestContent = string.Empty;
4646
if (File.Exists(appxManifestPath))
4747
manifestContent = File.ReadAllText(appxManifestPath);
48-
Tools.Logs.Add($"Error while retrieving UWP app ({appxManifestPath})\r\n\r\nContent: {manifestContent}.\r\n\r\n Exception: {ex}",false);
48+
Tools.Logs.AddException($"Error while retrieving UWP app ({appxManifestPath})\r\n\r\nContent: {manifestContent}.",ex);
4949
}
5050
}
5151

Source/HDRProfile/UWP/UWPAppsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static List<ApplicationItem> GetUWPApps()
3535
}
3636
catch (Exception ex)
3737
{
38-
Tools.Logs.Add($"Powershell query failed. {ex}", false);
38+
Tools.Logs.AddException($"Powershell query failed.",ex);
3939

4040
throw;
4141
}

Source/Release_Any/HDRProfile.exe

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)