@ -177,11 +177,11 @@ namespace UWPHook
await RestartSteam ( restartSteam ) ;
await RestartSteam ( restartSteam ) ;
msg = "Your apps were successfuly exported!" ;
msg = "Your apps were successfuly exported!" ;
if ( ! restartSteam )
if ( ! restartSteam )
{
{
msg + = " Please restart Steam in order to see them." ;
msg + = " Please restart Steam in order to see them." ;
}
}
else if ( result )
else if ( result )
{
{
msg + = " Steam has been restarted." ;
msg + = " Steam has been restarted." ;
}
}
@ -435,7 +435,8 @@ namespace UWPHook
}
}
} ) ;
} ) ;
}
}
else {
else
{
icon = PersistAppIcon ( app ) ;
icon = PersistAppIcon ( app ) ;
}
}
@ -525,38 +526,38 @@ namespace UWPHook
/// Copies an apps icon to a intermediate location
/// 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"
/// Due to some apps changing the icon location when they update, which causes icons to be "lost"
/// </summary>
/// </summary>
/// <param name="app">App to copy the icon from</param>
/// <param name="app">App to copy the icon to</param>
/// <returns></returns>
/// <param name="forcedIcon">Overwrites the app.icon to be copied</param>
private string PersistAppIcon ( AppEntry app )
/// <returns>string, the path to the usable and persisted icon</returns>
private string PersistAppIcon ( AppEntry app , string forcedIcon = "" )
{
{
string path = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
string path = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
string icons_path = path + @"\Briano\UWPHook\icons\" ;
string icons_path = path + @"\Briano\UWPHook\icons\" ;
// 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 ) )
if ( ! Directory . Exists ( icons_path ) )
{
{
Directory . CreateDirectory ( icons_path ) ;
Directory . CreateDirectory ( icons_path ) ;
}
}
string destFile = String . Join ( String . Empty , icons_path , app . Aumid + Path . GetFileName ( app . Icon ) ) ;
string dest_file = String . Join ( String . Empty , icons_path , app . Aumid + Path . GetFileName ( icon_to_copy ) ) ;
File . Copy ( app . Icon , destFile , true ) ;
try
return destFile ;
}
private string PersistAppIcon ( AppEntry app , string iconDownloadedPath )
{
{
string path = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
File . Copy ( icon_to_copy , dest_file , true ) ;
string icons_path = path + @"\Briano\UWPHook\icons\" ;
}
catch ( System . IO . IOException )
if ( ! Directory . Exists ( icons_path ) )
{
{
Directory . CreateDirectory ( icons_path ) ;
// 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 ;
}
}
string destFile = String . Join ( String . Empty , icons_path , app . Aumid + Path . GetFileName ( iconDownloadedPath ) ) ;
return dest_file ;
File . Copy ( iconDownloadedPath , destFile , true ) ;
return destFile ;
}
}
/// <summary>
/// <summary>