|
|
|
@ -284,7 +284,7 @@ namespace UWPHook
|
|
|
|
|
{
|
|
|
|
|
SteamGridDbApi api = new SteamGridDbApi(Properties.Settings.Default.SteamGridDbApiKey);
|
|
|
|
|
string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\";
|
|
|
|
|
GameResponse[] games;
|
|
|
|
|
GameResponse[] games = null;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -293,7 +293,6 @@ namespace UWPHook
|
|
|
|
|
catch (TaskCanceledException exception)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(exception.Message);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (games != null)
|
|
|
|
@ -390,6 +389,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)
|
|
|
|
@ -415,30 +416,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()
|
|
|
|
|
{
|
|
|
|
@ -448,7 +445,7 @@ namespace UWPHook
|
|
|
|
|
LaunchOptions = app.Aumid + " " + app.Executable,
|
|
|
|
|
AllowDesktopConfig = 1,
|
|
|
|
|
AllowOverlay = 1,
|
|
|
|
|
Icon = icon,
|
|
|
|
|
Icon = app.Icon,
|
|
|
|
|
Index = shortcuts.Length,
|
|
|
|
|
IsHidden = 0,
|
|
|
|
|
OpenVR = 0,
|
|
|
|
@ -537,7 +534,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.Icon : forcedIcon;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Directory.Exists(icons_path))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(icons_path);
|
|
|
|
@ -546,15 +542,19 @@ namespace UWPHook
|
|
|
|
|
string dest_file = String.Join(String.Empty, icons_path, app.Aumid + Path.GetFileName(icon_to_copy));
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Copy(icon_to_copy, dest_file, true);
|
|
|
|
|
if (File.Exists(icon_to_copy))
|
|
|
|
|
{
|
|
|
|
|
File.Copy(icon_to_copy, dest_file, true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dest_file = app.Icon;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
// to UWPHook's icon
|
|
|
|
|
Log.Warning("File could not be copied: " + icon_to_copy);
|
|
|
|
|
dest_file = app.Icon;
|
|
|
|
|
Log.Warning(e, "Could not copy icon " + app.Icon);
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dest_file;
|
|
|
|
|