Better performance when picking icons for apps

UWPTest
Brian Lima 8 years ago
parent ba6a489b32
commit 3eae0163fb

@ -44,6 +44,21 @@ namespace UWPHook
set { _aumid = value; } set { _aumid = value; }
} }
/// <summary>
/// Gets or sets the icon for the app
/// </summary>
private string _icon;
public string Icon
{
get { return _icon; }
set { _icon = value; }
}
/// <summary>
/// Sets the path where icons for the app is
/// </summary>
private string _icon_path; private string _icon_path;
public string IconPath public string IconPath
@ -78,6 +93,8 @@ namespace UWPHook
if (icon != null) if (icon != null)
{ {
//UWP apps usually store live tile images inside the same directory
//Let's check if the image is square for use as icon on Steam and pick the largest one
if (icon.Width == icon.Height && (icon.Size.Height > size.Height)) if (icon.Width == icon.Height && (icon.Size.Height > size.Height))
{ {
size = icon.Size; size = icon.Size;

@ -111,6 +111,13 @@ namespace UWPHook
{ {
var users = SteamManager.GetUsers(steam_folder); var users = SteamManager.GetUsers(steam_folder);
var selected_apps = Apps.Entries.Where(app => app.Selected); var selected_apps = Apps.Entries.Where(app => app.Selected);
//To make things faster, decide icons before looping users
foreach (var app in selected_apps)
{
app.Icon = app.widestSquareIcon();
}
foreach (var user in users) foreach (var user in users)
{ {
try try
@ -139,7 +146,7 @@ namespace UWPHook
Exe = @"""" + System.Reflection.Assembly.GetExecutingAssembly().Location + @""" " + app.Aumid, Exe = @"""" + System.Reflection.Assembly.GetExecutingAssembly().Location + @""" " + app.Aumid,
StartDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), StartDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
AllowDesktopConfig = 1, AllowDesktopConfig = 1,
Icon = app.widestSquareIcon(), Icon = app.Icon,
Index = shortcuts.Length, Index = shortcuts.Length,
IsHidden = 0, IsHidden = 0,
OpenVR = 0, OpenVR = 0,
@ -168,7 +175,6 @@ namespace UWPHook
MessageBox.Show("Error exporting your games:" + Environment.NewLine + ex.Message + ex.StackTrace); MessageBox.Show("Error exporting your games:" + Environment.NewLine + ex.Message + ex.StackTrace);
} }
} }
} }
} }

Loading…
Cancel
Save