Minor fixes

UWPTest
Brian Lima 8 years ago
parent b68645043f
commit a07c23002e

@ -87,52 +87,58 @@ namespace UWPHook
var selected_apps = Apps.Entries.Where(app => app.Selected); var selected_apps = Apps.Entries.Where(app => app.Selected);
foreach (var user in users) foreach (var user in users)
{ {
VDFEntry[] shortcuts;
try try
{ {
shortcuts = SteamManager.ReadShortcuts(user); VDFEntry[] shortcuts;
}
catch (Exception ex)
{
throw new Exception("Error trying to load existing Steam shortcuts." + Environment.NewLine + ex.Message);
}
//TODO: Figure out what to do when user has no shortcuts whatsoever
if (shortcuts != null )
{
foreach (var app in selected_apps)
{
VDFEntry newApp = new VDFEntry()
{
AppName = app.Name,
Exe = @"""" + System.Reflection.Assembly.GetExecutingAssembly().Location + @""" " + app.Aumid,
StartDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
AllowDesktopConfig = 1,
Icon = "",
Index = shortcuts.Length,
IsHidden = 0,
OpenVR = 0,
ShortcutPath = "",
Tags = new string[0]
};
//Resize this array so it fits the new entries
Array.Resize(ref shortcuts, shortcuts.Length + 1);
shortcuts[shortcuts.Length - 1] = newApp;
}
try try
{ {
//Write the file with all the shortcuts shortcuts = SteamManager.ReadShortcuts(user);
File.WriteAllBytes(user + @"\\config\\shortcuts.vdf", VDFSerializer.Serialize(shortcuts));
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception("Error trying to load existing Steam shortcuts." + Environment.NewLine + ex.Message);
}
throw new Exception("Error while trying to write your Steam shortcuts" + Environment.NewLine + ex.Message); if (shortcuts != null)
{
foreach (var app in selected_apps)
{
VDFEntry newApp = new VDFEntry()
{
AppName = app.Name,
Exe = @"""" + System.Reflection.Assembly.GetExecutingAssembly().Location + @""" " + app.Aumid,
StartDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
AllowDesktopConfig = 1,
Icon = "",
Index = shortcuts.Length,
IsHidden = 0,
OpenVR = 0,
ShortcutPath = "",
Tags = new string[0]
};
//Resize this array so it fits the new entries
Array.Resize(ref shortcuts, shortcuts.Length + 1);
shortcuts[shortcuts.Length - 1] = newApp;
}
try
{
//Write the file with all the shortcuts
File.WriteAllBytes(user + @"\\config\\shortcuts.vdf", VDFSerializer.Serialize(shortcuts));
}
catch (Exception ex)
{
throw new Exception("Error while trying to write your Steam shortcuts" + Environment.NewLine + ex.Message);
}
} }
} }
catch (Exception ex)
{
MessageBox.Show("Error exporting your games:" + Environment.NewLine + ex.Message + ex.StackTrace);
}
} }
} }
MessageBox.Show("Your apps were successfuly exported, please restart Steam in order to see your apps in it.", "UWPHook", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show("Your apps were successfuly exported, please restart Steam in order to see your apps in it.", "UWPHook", MessageBoxButton.OK, MessageBoxImage.Information);

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2.0")] [assembly: AssemblyVersion("2.1.3.0")]
[assembly: AssemblyFileVersion("2.1.2.0")] [assembly: AssemblyFileVersion("2.1.3.0")]

Loading…
Cancel
Save