diff --git a/UWPHook/GamesWindow.xaml.cs b/UWPHook/GamesWindow.xaml.cs
index 56b7e32..55a192a 100644
--- a/UWPHook/GamesWindow.xaml.cs
+++ b/UWPHook/GamesWindow.xaml.cs
@@ -393,6 +393,8 @@ namespace UWPHook
{
foreach (var app in selected_apps)
{
+ string icon = PersistAppIcon(app, exeDir);
+
VDFEntry newApp = new VDFEntry()
{
AppName = app.Name,
@@ -401,7 +403,7 @@ namespace UWPHook
LaunchOptions = app.Aumid,
AllowDesktopConfig = 1,
AllowOverlay = 1,
- Icon = app.Icon,
+ Icon = icon,
Index = shortcuts.Length,
IsHidden = 0,
OpenVR = 0,
@@ -431,7 +433,6 @@ namespace UWPHook
Array.Resize(ref shortcuts, shortcuts.Length + 1);
shortcuts[shortcuts.Length - 1] = newApp;
}
-
}
try
@@ -474,11 +475,38 @@ namespace UWPHook
return true;
}
+ ///
+ /// Copies an apps icon to a intermediate location
+ /// Due to some apps changing the icon location when they update, which causes icons to be "lost"
+ ///
+ /// App to copy the icon from
+ /// Base path to copy the app to
+ ///
+ private string PersistAppIcon(AppEntry app, string path)
+ {
+ string icons_path = path + @"\\icons\\";
+
+ if (!Directory.Exists(icons_path))
+ {
+ Directory.CreateDirectory(icons_path);
+ }
+
+ string destFile = String.Join(String.Empty, icons_path+ @"\\", app.Aumid + Path.GetFileName(app.Icon));
+ File.Copy(app.Icon, destFile, true);
+
+ return destFile;
+ }
+
+ ///
+ /// Restarts the Steam.exe process
+ ///
+ ///
+ ///
private async Task RestartSteam(bool restartSteam)
{
Func getSteam = () => Process.GetProcessesByName("steam").SingleOrDefault();
-
Process steam = getSteam();
+
if (steam != null)
{
string steamExe = steam.MainModule.FileName;
@@ -686,7 +714,6 @@ namespace UWPHook
///
private void Window_Loaded(object sender, RoutedEventArgs e)
{
-
if (!Settings.Default.OfferedSteamGridDB)
{
Settings.Default.SteamGridDbApiKey = "";