diff --git a/UWPHook.nsi b/UWPHook.nsi index d2c0bc9..651251a 100644 --- a/UWPHook.nsi +++ b/UWPHook.nsi @@ -11,7 +11,7 @@ !define APP_NAME "UWPHook" !define COMP_NAME "Briano" !define WEB_SITE "https://briano.dev" -!define VERSION "2.12.00.00" +!define VERSION "2.13.00.00" !define COPYRIGHT "Briano � 2020 2021 2022" !define DESCRIPTION "The easy way to add UWP and XGP games to Steam" !define LICENSE_TXT "C:\Users\Brian\Documents\GitHub\UWPHook\README.md" @@ -44,7 +44,7 @@ OutFile "${INSTALLER_NAME}" BrandingText "${APP_NAME}" XPStyle on InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" "" -InstallDir "$PROGRAMFILES\Briano\UWPHook" +InstallDir "$APPDATA\Briano\UWPHook" ###################################################################### @@ -92,13 +92,15 @@ File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Crc32.NET.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\MaterialDesignColors.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\MaterialDesignThemes.Wpf.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Newtonsoft.Json.dll" +File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Serilog.dll" +File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Serilog.Sinks.Console.dll" +File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Serilog.Sinks.File.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\SharpSteam.dll" -File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Management.Automation.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Net.Http.Formatting.dll" +File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\VDFParser.dll" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\UWPHook.exe" File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\UWPHook.exe.config" -File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\VDFParser.dll" CreateDirectory "$INSTDIR\Resources" SetOutPath "$INSTDIR\Resources" diff --git a/UWPHook/GamesWindow.xaml.cs b/UWPHook/GamesWindow.xaml.cs index 840e380..44639af 100644 --- a/UWPHook/GamesWindow.xaml.cs +++ b/UWPHook/GamesWindow.xaml.cs @@ -287,7 +287,7 @@ namespace UWPHook { SteamGridDbApi api = new SteamGridDbApi(Properties.Settings.Default.SteamGridDbApiKey); string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\"; - GameResponse[] games; + GameResponse[] games = null; try { @@ -296,7 +296,6 @@ namespace UWPHook catch (TaskCanceledException exception) { Log.Error(exception.Message); - throw; } if (games != null) @@ -393,6 +392,8 @@ namespace UWPHook } } + await Task.WhenAll(gridImagesDownloadTasks); + // Export the selected apps and the downloaded images to each user // in the steam folder by modifying it's VDF file foreach (var user in users) @@ -418,30 +419,26 @@ namespace UWPHook { foreach (var app in selected_apps) { - string icon = ""; - if (gridImagesDownloadTasks.Count > 0) + try { - await Task.WhenAll(gridImagesDownloadTasks); + + app.Icon = PersistAppIcon(app); + Log.Verbose("Defaulting to app.Icon for app " + app.Name); + + } + catch (System.IO.IOException) + { + Log.Verbose("Using backup icon for app " + app.Name); await Task.Run(() => { string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\"; string[] images = Directory.GetFiles(tmpGridDirectory); - foreach (string image in images) - { - if (image.EndsWith("_logo.png")) - { - icon = PersistAppIcon(app, image); - break; - } - } + UInt64 gameId = GenerateSteamGridAppId(app.Name, exePath); + app.Icon = PersistAppIcon(app, tmpGridDirectory + gameId + "_logo.png"); }); } - else - { - icon = PersistAppIcon(app); - } VDFEntry newApp = new VDFEntry() { @@ -451,7 +448,7 @@ namespace UWPHook LaunchOptions = app.Aumid + " " + app.Executable, AllowDesktopConfig = 1, AllowOverlay = 1, - Icon = icon, + Icon = app.Icon, Index = shortcuts.Length, IsHidden = 0, OpenVR = 0, @@ -540,7 +537,6 @@ namespace UWPHook // If we do not have an specific icon to copy, copy app.icon, if we do, copy the specified icon string icon_to_copy = String.IsNullOrEmpty(forcedIcon) ? app.IconPath : forcedIcon; - if (!Directory.Exists(icons_path)) { Directory.CreateDirectory(icons_path); @@ -551,9 +547,8 @@ namespace UWPHook { System.Drawing.Image image = System.Drawing.Image.FromFile(dest_file); image.Save(dest_file); - //File.Copy(icon_to_copy, dest_file, true); } - catch (System.IO.IOException) + catch (System.IO.IOException e) { // This file is most likely encrypted or does not exist, so we return the app.Icon itself // but this app is now prone to #90 unfortunately, if we return String.empty, Steam will default diff --git a/UWPHook/Properties/AssemblyInfo.cs b/UWPHook/Properties/AssemblyInfo.cs index 1f5f44e..f546a95 100644 --- a/UWPHook/Properties/AssemblyInfo.cs +++ b/UWPHook/Properties/AssemblyInfo.cs @@ -51,6 +51,6 @@ using System.Windows; // 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("2.12.0.0")] -[assembly: AssemblyFileVersion("2.12.0.0")] +[assembly: AssemblyVersion("2.13.0.0")] +[assembly: AssemblyFileVersion("2.13.0.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/UWPHook/UWPHook.csproj b/UWPHook/UWPHook.csproj index 43e2ca1..b63821e 100644 --- a/UWPHook/UWPHook.csproj +++ b/UWPHook/UWPHook.csproj @@ -202,10 +202,10 @@ 1.2.0 - 2.0.6 + 2.0.7 - 4.5.0 + 4.6.0 5.2.9 @@ -214,7 +214,7 @@ 13.0.1 - 2.11.0 + 2.12.0 4.1.0