Compare commits

..

No commits in common. 'master' and '2.12' have entirely different histories.
master ... 2.12

@ -4,7 +4,7 @@
Small project to link UWP games and XboxGamePass to Steam
If you want to add Windows Store or Xbox Game Pass Games to Steam, you need to do a bit of a workaround because Steam can't see UWP apps, and there's a chance Steam won't show it on your "Currently playing" status. This app aims to simplify a little bit the process where it is possible by automating the scripting and launching of Windows Store apps and Xbox Game Pass games.
If you want to add Windows Store or Xbox Game Pass Games to Steam, you need to do a bit of a warkaround because Steam can't see UWP apps, and there's a chance Steam won't show it on your "Currently playing" status. This app aims to simplify a little bit the process where it is possible by automating the scripting and launching of Windows Store apps and Xbox Game Pass games.
# To add UWP or XGP games to Steam #
@ -42,41 +42,29 @@ Special thanks to @FusRoDah061 for implementing the base feature!
- **Steam's Overlay isn't working!**
- Unfortunately, it's a Steam limitation, Valve has to update it in order to work properly with UWP, DXTory is a recommended overlay for UWP games.
- **Using Steam Link**
- Check the option "Streaming" mode inside the settings screen
- **Steam Deck?**
- This app is not compatible with the Steam Deck in any way.
If you are facing an error of any kind, please check the contents of the file
- **I have shortcuts from other application that broke when i used UWPHook**
- You can find a backup of your `shortcuts.vdf` file in `%appdata%\Roaming\Briano\UWPHook\backups`, each file in this directory is a backup of the original `shortcuts.vdf` before manipulation by UWPHook, the files are renamed `{userid}_{timestamp}_shortcut.vdf`, you can restore these files to their original location for usage.
- **Steam Link launches the game but input doesn't work!**
- Unfortunately, another limitation by Steam, i have some ideas as to why it isn't working, but i can't give an ETA for when i can fix this, or even if it's fixable on my end, since Valve didn't released the Link in Brazil and i can't get one to test.
- **Steam Controller isn't working**
- Another limitation by Steam, some people reported it works with "Desktop Mode" configuration, but i can't verify this.
- **My question isn't listed here!**
- Drop by our subreddit and ask a question over there, maybe someone will help you, i surely will as soon as i can:
- Drop by our subreddit and ask a question over there, maybe someone will help you, i surely will as soon as i can
**[https://www.reddit.com/r/uwphook](https://www.reddit.com/r/uwphook)**
- Please also paste the contents of the file `%appdata%Roaming\Briano\UWPHook\application.log` so i can try to understand better the problem.
----------
# Building
# Building #
- Clone project or forked project.
- Install Visual Studio 2022 with .NET Framework 4.8.
- Install [SharpSteam by BrianLima](https://github.com/BrianLima/SharpSteam/releases/) and [VDFParser](https://github.com/brianlima/VDFParser) and build.
- If the project asks for the references for VDFParser and Sharpsteam, point it to the most recent build.
- Install Visual Studio 2019 with .NET Framework 4.6.2.
- Install [SharpSteam by BrianLima](https://github.com/BrianLima/SharpSteam/releases/) and [VDFParser by heyvito](https://github.com/heyvito/VDFParser).
- Add the above two dll to the project in Visual Studio Reference Manager.
- Press run!
## Installer
The installer is built with [NSIS](https://nsis.sourceforge.io/Download), just run the script `UWPHook.nsi` and things **should** work. Modify any hardcoded paths to suit your setup.
The installation consists of zipping the application and creating some of the paths for the user, since the application is mostly static/dynamic and does not depend a lot on where it is installed, the installer is made for convenience.
----------
# About
# About #
This software is open-source under the MIT License.
It will mostly likely break withouth any heads up, since any API, file format, script and many other things used by it may be changed by Valve or Microsoft withouth prior notice.
I am not responsible if anything breaks.
If you like what i did with it and want to suport me, you can cheer me up at my [Twitter](http://www.twitter.com/brianostorm "Twitter") or [pay me a coffee via Paypal, it will help me to continue to build amazing open source tools for you!"](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9YPV3FHEFRAUQ)

@ -11,7 +11,7 @@
!define APP_NAME "UWPHook"
!define COMP_NAME "Briano"
!define WEB_SITE "https://briano.dev"
!define VERSION "2.14.00.00"
!define VERSION "2.12.00.00"
!define COPYRIGHT "Briano <20> 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 "$APPDATA\Briano\UWPHook"
InstallDir "$PROGRAMFILES\Briano\UWPHook"
######################################################################
@ -91,24 +91,14 @@ SetOutPath "$INSTDIR"
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\Microsoft.Xaml.Behaviors.dll"
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\Newtonsoft.Json.Bson.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.Buffers.dll"
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Diagnostics.DiagnosticSource.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.Memory.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\System.Numerics.Vectors.dll"
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Runtime.CompilerServices.Unsafe.dll"
File "C:\Users\Brian\Documents\GitHub\UWPHook\UWPHook\bin\Release\System.Threading.Tasks.Extensions.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"

@ -82,18 +82,6 @@
</ArrayOfString>
</value>
</setting>
<setting name="LogLevel" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<string>ERROR</string>
<string>DEBUG</string>
<string>TRACE</string>
</ArrayOfString>
</value>
</setting>
<setting name="SelectedLogLevel" serializeAs="String">
<value>0</value>
</setting>
</UWPHook.Properties.Settings>
</userSettings>
<runtime>

@ -1,15 +1,15 @@
<Application x:Class="UWPHook.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:UWPHook" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:UWPHook"
StartupUri="GamesWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:CustomColorTheme BaseTheme="Light" PrimaryColor="Blue" SecondaryColor="MediumPurple" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.deeppurple.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

@ -87,10 +87,8 @@ namespace UWPHook
try
{
//Get every png, jpg or jpeg in this directory, Steam only allows for .png's but jpgs work too
//Get every png in this directory, Steam only allows for .png's
images.AddRange(Directory.GetFiles(_icon_path, "*.png"));
images.AddRange(Directory.GetFiles(_icon_path, "*.jpg"));
images.AddRange(Directory.GetFiles(_icon_path, "*.jpeg"));
}
catch (DirectoryNotFoundException)
{

@ -1,5 +1,4 @@
using Serilog;
using Serilog.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -29,13 +28,16 @@ namespace UWPHook
/// <param name="aumid">The AUMID of the app to launch</param>
public static void LaunchUWPApp(string[] args)
{
// We receive the args from Steam,
// 0 is application location,
// 1 is the aumid,
// 2 is the executable, the rest are extras
string aumid = args[1];
executablePath = args[2].Contains("/") ? args[2].Replace('/', '\\') : args[2];
Log.Verbose("Arguments => " + String.Join("/", args));
FileStream debug = File.OpenWrite("debug.log");
Log.Debug("Arguments => " + String.Join("/", args));
var mgr = new ApplicationActivationManager();
uint processId;
@ -48,14 +50,13 @@ namespace UWPHook
{
mgr.ActivateApplication(aumid, extra_args, ActivateOptions.None, out processId);
runningProcessId = (int) processId;
Log.Verbose("Process ID => " + runningProcessId.ToString());
Log.Debug("Process ID => " + runningProcessId.ToString());
//Bring the launched app to the foreground, this fixes in-home streaming
BringProcess();
}
catch (Exception e)
{
Log.Error("Error while trying to launch your app." + Environment.NewLine + e.Message);
throw new Exception("Error while trying to launch your app." + Environment.NewLine + e.Message);
}
}
@ -95,12 +96,12 @@ namespace UWPHook
foreach (var process in processes)
{
string executableFile = executablePath.Contains('\\') ? executablePath.Substring(executablePath.LastIndexOf('\\') + 1) : executablePath;
Log.Verbose("Process " + process.Value.Path + " contains " + executablePath + " ? : " + process.Value.Path.Contains(executablePath).ToString());
Log.Verbose("Process " + process.Key + " contains " + executableFile + " ? : " + process.Key.Contains(executableFile).ToString());
Log.Debug("Process " + process.Value.Path + " contains " + executablePath + " ? : " + process.Value.Path.Contains(executablePath).ToString());
Log.Debug("Process " + process.Key + " contains " + executableFile + " ? : " + process.Key.Contains(executableFile).ToString());
if (process.Value.Path.Contains(executablePath) || process.Key.Contains(executableFile))
{
int pid = process.Value.Pid;
Log.Verbose($"Launcher opened child process ({runningProcessId}->{pid}), using new process as target");
Log.Debug($"Launcher opened child process ({runningProcessId}->{pid}), using new process as target");
runningProcessId = pid;
isLauncherProcess = true;
@ -172,7 +173,6 @@ namespace UWPHook
}
catch (Exception e)
{
Log.Error("Error trying to get installed apps on your PC " + Environment.NewLine + e.Message, e.InnerException);
throw new Exception("Error trying to get installed apps on your PC " + Environment.NewLine + e.Message, e.InnerException);
}

@ -20,7 +20,7 @@
<RowDefinition Height="147*"/>
<RowDefinition Height="65.6"/>
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.Darken="True" Mode="PrimaryMid" Height="80" Margin="0,0,-0.4,0">
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" Height="80" Margin="0,0,-0.4,0">
<Label x:Name="label1" Content="Welcome to UWPHook, the easier way to add UWP games and apps to Steam!" HorizontalAlignment="Left" Margin="172,-14,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>

@ -30,7 +30,7 @@ namespace UWPHook
BaseTheme darkTheme = BaseTheme.Dark;
var theme = Theme.Create(darkTheme,
var theme = Theme.Create(darkTheme.GetBaseTheme(),
SwatchHelper.Lookup[(MaterialDesignColor)PrimaryColor.DeepPurple],
SwatchHelper.Lookup[(MaterialDesignColor)SecondaryColor.Lime]);

@ -18,7 +18,7 @@
<RowDefinition Height="144*"/>
<RowDefinition Height="19*"/>
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.Darken="True" Mode="PrimaryMid" Height="80">
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" Height="80">
<Label x:Name="label1" Content="Welcome to UWPHook, the easier way to add UWP apps and XGP games and apps to Steam!" HorizontalAlignment="Left" Margin="172,-14,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>

@ -1,6 +1,5 @@
using Force.Crc32;
using Serilog;
using Serilog.Core;
using SharpSteam;
using System;
using System.Collections.Generic;
@ -30,35 +29,24 @@ namespace UWPHook
{
AppEntryModel Apps;
BackgroundWorker bwrLoad;
static LoggingLevelSwitch levelSwitch = new LoggingLevelSwitch();
public GamesWindow()
{
InitializeComponent();
Log.Debug("Init GamesWindow");
Debug.WriteLine("Init GamesWindow");
Apps = new AppEntryModel();
var args = Environment.GetCommandLineArgs();
// Init log file to AppData\Roaming\Briano\UWPHook directory with size rotation on 10Mb with max 5 files
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
string loggerFilePath = String.Join("\\", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), fvi.CompanyName, fvi.ProductName, "application.log");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(levelSwitch)
.WriteTo.File(path: loggerFilePath, rollOnFileSizeLimit: true, fileSizeLimitBytes: 10485760, retainedFileCountLimit: 5)
.WriteTo.Console()
.MinimumLevel.Error()
.WriteTo.File("debug.log", rollingInterval: RollingInterval.Day)
.CreateLogger();
// Switch to Info by default to inform logger level in log file and switch to the correct log level
levelSwitch.MinimumLevel = Serilog.Events.LogEventLevel.Information;
SetLogLevel();
// If null or 1, the app was launched normally
if (args?.Length > 1)
{
// When length is 1, the only argument is the path where the app is installed
_ = LauncherAsync(args); // Launches the requested game
_ = LauncherAsync(args); // Launches the requested game
}
else
{
@ -176,11 +164,11 @@ namespace UWPHook
await RestartSteam(restartSteam);
msg = "Your apps were successfuly exported!";
if (!restartSteam)
if(!restartSteam)
{
msg += " Please restart Steam in order to see them.";
}
else if (result)
else if(result)
{
msg += " Steam has been restarted.";
}
@ -188,7 +176,6 @@ namespace UWPHook
}
catch (TaskCanceledException exception)
{
Log.Error(exception.Message);
msg = exception.Message;
}
@ -215,9 +202,8 @@ namespace UWPHook
{
stream = client.OpenRead(imageUrl);
}
catch (Exception exception)
catch (Exception e)
{
Log.Error(exception.Message);
//Image with error?
//Skip for now
}
@ -230,7 +216,7 @@ namespace UWPHook
stream.Close();
client.Dispose();
}
});
});
}
/// <summary>
@ -238,16 +224,16 @@ namespace UWPHook
/// </summary>
/// <param name="user">The user path to copy images to</param>
private void CopyTempGridImagesToSteamUser(string user)
{
{
string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\";
string userGridDirectory = user + "\\config\\grid\\";
// No images were downloaded, maybe the key is invalid or no app had an image
if (!Directory.Exists(tmpGridDirectory))
{
return;
}
string[] images = Directory.GetFiles(tmpGridDirectory);
if (!Directory.Exists(userGridDirectory))
@ -283,7 +269,7 @@ namespace UWPHook
{
SteamGridDbApi api = new SteamGridDbApi(Properties.Settings.Default.SteamGridDbApiKey);
string tmpGridDirectory = Path.GetTempPath() + "UWPHook\\tmp_grid\\";
GameResponse[] games = null;
GameResponse[] games;
try
{
@ -291,23 +277,26 @@ namespace UWPHook
}
catch (TaskCanceledException exception)
{
Log.Error(exception.Message);
throw;
}
if (games != null)
{
var game = games[0];
Log.Verbose("Detected Game: " + game.ToString());
Debug.WriteLine("Detected Game: " + game.ToString());
UInt64 gameId = GenerateSteamGridAppId(appName, appTarget);
SafellyCreateTmpGridDirectory(tmpGridDirectory);
if (!Directory.Exists(tmpGridDirectory))
{
Directory.CreateDirectory(tmpGridDirectory);
}
var gameGridsVertical = api.GetGameGrids(game.Id, "600x900,342x482,660x930");
var gameGridsHorizontal = api.GetGameGrids(game.Id, "460x215,920x430");
var gameHeroes = api.GetGameHeroes(game.Id);
var gameLogos = api.GetGameLogos(game.Id);
Log.Verbose("Game ID: " + game.Id);
Debug.WriteLine("Game ID: " + game.Id);
await Task.WhenAll(
gameGridsVertical,
@ -351,26 +340,6 @@ namespace UWPHook
}
}
private void SafellyCreateTmpGridDirectory(string tmpGridDirectory)
{
if (!Directory.Exists(tmpGridDirectory))
{
try
{
Directory.CreateDirectory(tmpGridDirectory);
Log.Information("Created directory: " + tmpGridDirectory);
}
catch (Exception exception)
{
Log.Error(exception.Message);
Log.Error(exception.StackTrace);
throw new Exception("UWPHook was not able to create the tmp directory for some reason." + Environment.NewLine +
"You may solve this by manually creating the following folder:" + Environment.NewLine +
tmpGridDirectory);
}
}
}
/// <summary>
/// Main Task to export the selected games to steam
/// </summary>
@ -391,7 +360,7 @@ namespace UWPHook
List<Task> gridImagesDownloadTasks = new List<Task>();
bool downloadGridImages = !String.IsNullOrEmpty(Properties.Settings.Default.SteamGridDbApiKey);
//To make things faster, decide icons and download grid images before looping users
Log.Verbose("downloadGridImages: " + (downloadGridImages));
Debug.WriteLine("downloadGridImages: " + (downloadGridImages));
foreach (var app in selected_apps)
{
@ -399,14 +368,12 @@ namespace UWPHook
if (downloadGridImages)
{
Log.Verbose("Downloading grid images for app " + app.Name);
Debug.WriteLine("Downloading grid images for app " + app.Name);
gridImagesDownloadTasks.Add(DownloadTempGridImages(app.Name, exePath));
}
}
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)
@ -423,7 +390,6 @@ namespace UWPHook
//If it's a short VDF, let's just overwrite it
if (ex.GetType() != typeof(VDFTooShortException))
{
Log.Error("Error: Program failed to load existing Steam shortcuts." + Environment.NewLine + ex.Message);
throw new Exception("Error: Program failed to load existing Steam shortcuts." + Environment.NewLine + ex.Message);
}
}
@ -432,38 +398,17 @@ namespace UWPHook
{
foreach (var app in selected_apps)
{
try
{
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\\";
SafellyCreateTmpGridDirectory(tmpGridDirectory);
string[] images = Directory.GetFiles(tmpGridDirectory);
UInt64 gameId = GenerateSteamGridAppId(app.Name, exePath);
app.Icon = PersistAppIcon(app, tmpGridDirectory + gameId + "_logo.png");
});
}
string icon = PersistAppIcon(app);
VDFEntry newApp = new VDFEntry()
{
appid = ((int)GenerateSteamGridAppId(app.Name, exePath)),
AppName = app.Name,
Exe = exePath,
StartDir = exeDir,
LaunchOptions = app.Aumid + " " + app.Executable,
AllowDesktopConfig = 1,
AllowOverlay = 1,
Icon = app.Icon,
Icon = icon,
Index = shortcuts.Length,
IsHidden = 0,
OpenVR = 0,
@ -473,20 +418,21 @@ namespace UWPHook
DevkitGameID = "",
LastPlayTime = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
};
Boolean shortcutAlreadyExists = false;
Boolean isFound = false;
for (int i = 0; i < shortcuts.Length; i++)
{
Log.Verbose(shortcuts[i].ToString());
Debug.WriteLine(shortcuts[i].ToString());
if (shortcuts[i].AppName == app.Name && shortcuts[i].Exe == exePath)
if (shortcuts[i].AppName == app.Name)
{
shortcutAlreadyExists = true;
Log.Verbose(app.Name + " already added to Steam. Updating existing shortcut.");
isFound = true;
Debug.WriteLine(app.Name + " already added to Steam. Updating existing shortcut.");
shortcuts[i] = newApp;
}
}
if (!shortcutAlreadyExists)
if (!isFound)
{
//Resize this array so it fits the new entries
Array.Resize(ref shortcuts, shortcuts.Length + 1);
@ -500,23 +446,17 @@ namespace UWPHook
{
Directory.CreateDirectory(user + @"\\config\\");
}
BackupShortcutsVDF(user, @"\\config\\shortcuts.vdf");
//Write the file with all the shortcuts
File.WriteAllBytes(user + @"\\config\\shortcuts.vdf", VDFSerializer.Serialize(shortcuts));
Log.Debug("Shortcuts written to " + user + @"\\config\\shortcuts.vdf");
}
catch (Exception ex)
{
Log.Error("Error: Program failed while trying to write your Steam shortcuts" + Environment.NewLine + ex.InnerException + ex.StackTrace);
throw new Exception("Error: Program failed while trying to write your Steam shortcuts" + Environment.NewLine + ex.Message);
}
}
}
catch (Exception ex)
{
Log.Error("Error: Program failed exporting your games:" + Environment.NewLine + ex.Message + ex.StackTrace);
MessageBox.Show("Error: Program failed exporting your games:" + Environment.NewLine + ex.Message + ex.StackTrace);
}
}
@ -540,63 +480,26 @@ namespace UWPHook
return true;
}
private void BackupShortcutsVDF(string userPath, string vdfSubPath)
{
string backupFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Briano", "UWPHook", "backups");
if (!Directory.Exists(backupFolder))
{
Directory.CreateDirectory(backupFolder);
Log.Debug("Created backup folder: " + backupFolder);
}
string user_id = userPath.Split('\\').Last();
string sourceFilePath = Path.Combine(userPath, "config", "shortcuts.vdf");
string destinationFileName = Path.Combine(backupFolder, $"{user_id}_{DateTime.Now.ToString("yyyyMMddHHmmss")}_shortcuts.vdf");
File.Copy(sourceFilePath, destinationFileName);
Log.Debug("Backup created: " + destinationFileName);
}
/// <summary>
/// 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"
/// </summary>
/// <param name="app">App to copy the icon to</param>
/// <param name="forcedIcon">Overwrites the app.icon to be copied</param>
/// <returns>string, the path to the usable and persisted icon</returns>
private string PersistAppIcon(AppEntry app, string forcedIcon = "")
/// <param name="app">App to copy the icon from</param>
/// <returns></returns>
private string PersistAppIcon(AppEntry app)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
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;
string icons_path = path + @"\\Briano\\UWPHook\\icons\\";
if (!Directory.Exists(icons_path))
{
Directory.CreateDirectory(icons_path);
}
string dest_file = String.Join(String.Empty, icons_path, app.Aumid + Path.GetFileName(icon_to_copy));
try
{
if (File.Exists(icon_to_copy))
{
File.Copy(icon_to_copy, dest_file, true);
}
else
{
dest_file = app.Icon;
}
}
catch (System.IO.IOException e)
{
Log.Warning(e, "Could not copy icon " + app.Icon);
throw e;
}
string destFile = String.Join(String.Empty, icons_path+ @"\\", app.Aumid + Path.GetFileName(app.Icon));
File.Copy(app.Icon, destFile, true);
return dest_file;
return destFile;
}
/// <summary>
@ -614,7 +517,7 @@ namespace UWPHook
string steamExe = steam.MainModule.FileName;
//we always ask politely
Log.Debug("Requesting Steam shutdown");
Debug.WriteLine("Requesting Steam shutdown");
Process.Start(steamExe, "-exitsteam");
bool restarted = false;
@ -628,7 +531,7 @@ namespace UWPHook
await Task.Delay(TimeSpan.FromSeconds(0.5f));
if (getSteam() == null)
{
Log.Debug("Restarting Steam");
Debug.WriteLine("Restarting Steam");
Process.Start(steamExe);
restarted = true;
break;
@ -637,14 +540,14 @@ namespace UWPHook
if (!restarted)
{
Log.Debug("Steam instance not restarted");
Debug.WriteLine("Steam instance not restarted");
MessageBox.Show("Failed to restart Steam, please launch it manually", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
return false;
}
}
else
{
Log.Debug("Steam instance not found to be restarted");
Debug.WriteLine("Steam instance not found to be restarted");
}
return true;
@ -652,7 +555,7 @@ namespace UWPHook
public static void ClearAllShortcuts()
{
Log.Debug("Clearing all elements in shortcuts.vdf");
Debug.WriteLine("DBG: Clearing all elements in shortcuts.vdf");
string[] tags = Settings.Default.Tags.Split(',');
string steam_folder = SteamManager.GetSteamFolder();
@ -679,13 +582,11 @@ namespace UWPHook
}
catch (Exception ex)
{
Log.Error("Error: Program failed while trying to write your Steam shortcuts" + Environment.NewLine + ex.Message);
throw new Exception("Error: Program failed while trying to write your Steam shortcuts" + Environment.NewLine + ex.Message);
}
}
catch (Exception ex)
{
Log.Error("Error: Program failed while trying to clear your Steam shortcuts:" + Environment.NewLine + ex.Message + ex.StackTrace);
MessageBox.Show("Error: Program failed while trying to clear your Steam shortcuts:" + Environment.NewLine + ex.Message + ex.StackTrace);
}
}
@ -778,7 +679,6 @@ namespace UWPHook
}
catch (Exception ex)
{
Log.Error(ex.Message);
MessageBox.Show(ex.Message, "UWPHook", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
@ -832,24 +732,5 @@ namespace UWPHook
}
}
}
public static void SetLogLevel()
{
switch (Settings.Default.SelectedLogLevel)
{
case 1:
Log.Information("Init log with DEBUG level.");
levelSwitch.MinimumLevel = Serilog.Events.LogEventLevel.Debug;
break;
case 2:
Log.Information("Init log with TRACE level.");
levelSwitch.MinimumLevel = Serilog.Events.LogEventLevel.Verbose;
break;
default:
Log.Information("Init log with ERROR level.");
levelSwitch.MinimumLevel = Serilog.Events.LogEventLevel.Error;
break;
}
}
}
}

@ -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.14.0.0")]
[assembly: AssemblyFileVersion("2.14.0.0")]
[assembly: AssemblyVersion("2.12.0.0")]
[assembly: AssemblyFileVersion("2.12.0.0")]
[assembly: NeutralResourcesLanguage("en")]

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -12,7 +12,7 @@ namespace UWPHook.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -219,32 +219,5 @@ namespace UWPHook.Properties {
this["SteamGridDB_Humor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsd=\"http://www.w3." +
"org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <s" +
"tring>ERROR</string>\r\n <string>DEBUG</string>\r\n <string>TRACE</string>\r\n</Arra" +
"yOfString>")]
public global::System.Collections.Specialized.StringCollection LogLevel {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["LogLevel"]));
}
set {
this["LogLevel"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int SelectedLogLevel {
get {
return ((int)(this["SelectedLogLevel"]));
}
set {
this["SelectedLogLevel"] = value;
}
}
}
}

@ -70,16 +70,5 @@
&lt;string&gt;true&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="LogLevel" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;string&gt;ERROR&lt;/string&gt;
&lt;string&gt;DEBUG&lt;/string&gt;
&lt;string&gt;TRACE&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="SelectedLogLevel" Type="System.String" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

@ -10,46 +10,24 @@ foreach ($app in $installedapps)
{
$appx = Get-AppxPackageManifest $app;
$name = $appx.Package.Properties.DisplayName;
$executable = $appx.Package.Applications.Application.Executable;
# Handle app running with microsoft launcher or which doesn't have an executable in the manifest
if([string]::IsNullOrWhitespace($executable) -or $executable -eq "GameLaunchHelper.exe") {
if(Test-Path -Path ($app.InstallLocation + "\MicrosoftGame.Config")) {
[xml]$msconfig = Get-Content ($app.InstallLocation + "\MicrosoftGame.Config");
$executable = $msconfig.Game.ExecutableList.Executable.Name;
}
else {
# Cannot handle app which doesn't have any configuration to read
continue;
}
}
$executable = (Select-Xml -Path ($app.InstallLocation + "\MicrosoftGame.Config") -XPath "/Game/ExecutableList/Executable/@Name").Node.Value
# Convert object to ensure is the String of execuble (cf Halo Master Chief Collection example below)
# mcclauncher.exe
# MCC\Binaries\Win64\MCCWinStore-Win64-Shipping.exe
if($executable -is [Object[]]) { $executable = $executable[1].ToString() }
# Exclude apps without a name acceptable
if($name -like '*DisplayName*' -or $name -like '*ms-resource*')
{
continue;
$name = $appx.Package.Applications.Application.VisualElements.DisplayName;
}
if($name -like '*DisplayName*' -or $name -like '*ms-resource*')
{
$name = "App name not found, double click here to edit it";
}
$logo = $app.InstallLocation + "\" + $appx.Package.Applications.Application.VisualElements.Square150x150Logo;
# Check for possible duplicate game like Halo MCC which have two version (one with AC and one witohut AC)
$duplicate = $false;
foreach($item in $aumidList) {
#Write-host $item - $name
if($item.StartsWith($name)) {
$duplicate = $true;
break;
}
}
# Insert if not duplicated
if(!$duplicate) {
$aumidList += $name + "|" + $logo + "|" + $app.packagefamilyname + "!" + $id + "|" + $executable + ";"
}
$aumidList += $name + "|" + $logo + "|" + $app.packagefamilyname + "!" + $id + "|" + $executable + ";"
}
}
}

@ -1,4 +1,4 @@
<Window x:Class="UWPHook.SettingsWindow"
<Window x:Class="UWPHook.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -18,29 +18,22 @@
<ColumnDefinition Width="17*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="41*"/>
<RowDefinition Height="179*"/>
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" Mode="PrimaryMid" VerticalAlignment="Top" Height="80" Grid.ColumnSpan="2" Margin="0,0,-0.4,0"/>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="80" Grid.ColumnSpan="2" Margin="0,0,-0.4,0"/>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>
<Grid Margin="10,10,10,10" Grid.RowSpan="1" Grid.Row="1">
<Grid Margin="10,88,10,44" Grid.RowSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="30"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="62"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="80"/>
<RowDefinition Height="50*"/>
<RowDefinition Height="50*"/>
<RowDefinition Height="66*"/>
<RowDefinition Height="223*"/>
<RowDefinition Height="56*"/>
<RowDefinition Height="62*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="62*"/>
@ -48,37 +41,27 @@
<ColumnDefinition Width="124*"/>
<ColumnDefinition Width="113*"/>
</Grid.ColumnDefinitions>
<!-- Settings Section -->
<materialDesign:ColorZone Padding="16" Mode="PrimaryMid" VerticalAlignment="Top" Height="30" Grid.ColumnSpan="4" Grid.Row="0">
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="27" Grid.ColumnSpan="4">
<Label Content="Settings" HorizontalAlignment="Left" Margin="-10,-15,0,-17" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="14" Height="32" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<ToggleButton x:Name="language_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" RenderTransformOrigin="0.304,0.444" Grid.Row="1" Margin="5,3,6,4" />
<Label ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="label_cultures" Content="Set system language when launching an app*" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"/>
<ComboBox ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="cultures_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="3" HorizontalAlignment="Right" Width="92" Grid.Row="1"/>
<Label x:Name="label_seconds" ToolTip="If 0, UWPHook will not run in the background and will not update the in-game status" Content="Check if the launched app is running every" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2"/>
<ComboBox x:Name="seconds_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="3" HorizontalAlignment="Right" Width="92" Grid.Row="2"/>
<ToggleButton x:Name="streaming_toggle" Style="{DynamicResource MaterialDesignSwitchToggleButton}" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Grid.Row="3" Margin="6,3,5,4" />
<Label ToolTip="This fixes Steam in-home Streaming, set this in the host computer." x:Name="label_streaming" Content="Enable streaming mode" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3"/>
<ToggleButton x:Name="change_resolution_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Change host resolution on streaming mode" IsChecked="False" Grid.Row="4" Width="NaN" Margin="5,3,6,3" />
<Label ToolTip="Change the host computer resolution on launch, return to previous after." x:Name="label_resolution" Content="Change host resolution to:" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.Row="4"/>
<ComboBox x:Name="resolution_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="2" Width="220" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Right"/>
<Label ToolTip="Add these tags to exported games, use comma separated values" x:Name="label_tags" Content="Export with these tags:" Margin="0,0,8,0" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.Row="5"/>
<TextBox x:Name="tags_textBox" Grid.Column="2" Height="32" Margin="0,0,10,0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Center" Grid.ColumnSpan="2" Width="220" HorizontalAlignment="Right"/>
<Label x:Name="label_logLevel" Content="Define log severity level" VerticalAlignment="Center" Height="29" Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="2"/>
<ComboBox x:Name="logLevel_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="3" Width="92" Grid.Row="6" SelectedIndex="0" HorizontalAlignment="Right" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="10,0,0,0">
<ComboBoxItem Content="ERROR"/>
<ComboBoxItem Content="DEBUG"/>
<ComboBoxItem Content="TRACE"/>
</ComboBox>
<!-- SteamGrid Section -->
<materialDesign:ColorZone Padding="16" Mode="PrimaryMid" VerticalAlignment="Top" Height="30" Grid.ColumnSpan="4" Grid.Row="7">
<ToggleButton x:Name="language_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="6,34,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Height="18" HorizontalAlignment="Left" Width="46" RenderTransformOrigin="0.304,0.444" />
<Label ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="label1" Content="Set system language when launching an app*" Margin="5,31,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.ColumnSpan="2"/>
<ComboBox ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="cultures_comboBox" Margin="0,29,10,0" VerticalAlignment="Top" Height="31" Grid.Column="3" HorizontalAlignment="Right" Width="93"/>
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="3" Grid.Row="6" Margin="0,2,0,0"/>
<Label x:Name="label3" ToolTip="If 0, UWPHook will not run in the background and will not update the in-game status" Content="Check if the launched app is running every" Margin="5,7,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"/>
<ComboBox x:Name="seconds_comboBox" Margin="0,7,10,0" VerticalAlignment="Top" Height="31" Grid.Column="3" HorizontalAlignment="Right" Width="93" Grid.Row="1"/>
<Button x:Name="update_button" Click="update_button_Click" Content="Check for updates" Margin="0,0,8,9" Grid.Row="7" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="162" Grid.ColumnSpan="2"/>
<Button x:Name="help_button" Click="help_button_Click" Content="Get help at our Reddit" Grid.Column="2" Margin="0,0,0,9" Grid.Row="7" VerticalAlignment="Bottom" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="163"/>
<ToggleButton x:Name="streaming_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="0,6,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Height="18" Grid.Row="2" />
<Label ToolTip="This fixes Steam in-home Streaming, set this in the host computer." x:Name="label1_Copy" Content="Enable streaming mode" Margin="5,1,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2"/>
<Label ToolTip="SteamGridDB API key used to download Steam's library artwork. Leave it blank if you don't want to download artwork." x:Name="label1_Copy1" Content="Api Key" Margin="5,39,0,0" VerticalAlignment="Top" Height="29" Grid.Row="5" Grid.Column="1"/>
<TextBox x:Name="steamgriddb_api_key" Grid.Column="1" Height="29" Margin="150,39,10,0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="3"/>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="27" Grid.ColumnSpan="4" Margin="0,7,0,0" Grid.Row="5">
<Label Content="SteamGrid" HorizontalAlignment="Left" Margin="-10,-15,0,-17" FontFamily="Segoe UI Semibold" FontSize="14" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Button x:Name="key_Button" Content="{materialDesign:PackIcon Key}" ToolTip="Go to SteamGridDB.com to generate a new key" Grid.Row="8" Height="Auto" Click="key_Button_Click" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label ToolTip="SteamGridDB API key used to download Steam's library artwork. Leave it blank if you don't want to download artwork." x:Name="label_apiKey" Content="Api Key" VerticalAlignment="Center" Height="29" Grid.Row="8" Grid.Column="1"/>
<TextBox x:Name="steamgriddb_api_key" Grid.Column="2" Height="32" Grid.Row="8" TextWrapping="Wrap" VerticalAlignment="Center" Grid.ColumnSpan="2" Margin="0,0,10,0" Width="220" HorizontalAlignment="Right"/>
<Label ToolTip="The main style of the artwork." x:Name="label_artworkStyle" Content="Artwork Style" VerticalAlignment="Center" Height="29" Grid.Row="9" Grid.Column="1"/>
<ComboBox x:Name="style_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="2" Width="220" Grid.Row="9" Grid.ColumnSpan="2" HorizontalAlignment="Right">
<Button x:Name="key_Button" Content="{materialDesign:PackIcon Key}" ToolTip="Go to SteamGridDB.com to generate a new key" Margin="6,39,7,155" Grid.Row="5" Height="Auto" Click="key_Button_Click" />
<Label ToolTip="The main style of the artwork." x:Name="label1_Copy2" Content="Artwork Style" Margin="5,73,0,0" VerticalAlignment="Top" Height="29" Grid.Row="5" Grid.Column="1"/>
<ComboBox x:Name="style_comboBox" Margin="0,73,10,0" VerticalAlignment="Top" Height="31" Grid.Column="1" HorizontalAlignment="Right" Width="244" Grid.Row="5" Grid.ColumnSpan="3">
<ComboBoxItem Content="Any"/>
<ComboBoxItem Content="Alternate"/>
<ComboBoxItem Content="Blurred"/>
@ -86,79 +69,79 @@
<ComboBoxItem Content="Material"/>
<ComboBoxItem Content="No Logo"/>
</ComboBox>
<Label ToolTip="Type of the artwork, animated, static or both." x:Name="label_artworkType" Content="Artwork Type" VerticalAlignment="Center" Height="29" Grid.Row="10" Grid.Column="1"/>
<ComboBox x:Name="type_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="2" Width="220" Grid.Row="10" Grid.ColumnSpan="2" HorizontalAlignment="Right">
<Label ToolTip="Type of the artwork, animated, static or both." x:Name="label1_Copy3" Content="Artwork Type" Margin="5,109,0,0" VerticalAlignment="Top" Height="29" Grid.Row="5" Grid.Column="1"/>
<ComboBox x:Name="type_comboBox" Margin="0,109,10,0" VerticalAlignment="Top" Height="31" Grid.Column="1" HorizontalAlignment="Right" Width="244" Grid.Row="5" Grid.ColumnSpan="3">
<ComboBoxItem Content="Any"/>
<ComboBoxItem Content="Static"/>
<ComboBoxItem Content="Animated"/>
</ComboBox>
<Label ToolTip="Consider NSFW artwork?" x:Name="label_artworkNSFW" Content="Artwork nsfw" VerticalAlignment="Center" Height="29" Grid.Row="11" Grid.Column="1"/>
<ComboBox x:Name="nfsw_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="2" Width="220" Grid.Row="11" Grid.ColumnSpan="2" HorizontalAlignment="Right">
<Label ToolTip="Consider NSFW artwork?" x:Name="label1_Copy4" Content="Artwork nsfw" Margin="5,142,0,0" VerticalAlignment="Top" Height="29" Grid.Row="5" Grid.Column="1"/>
<ComboBox x:Name="nfsw_comboBox" Margin="0,145,10,0" VerticalAlignment="Top" Height="31" Grid.Column="1" HorizontalAlignment="Right" Width="244" Grid.Row="5" Grid.ColumnSpan="3">
<ComboBoxItem Content="No"/>
<ComboBoxItem Content="Any"/>
<ComboBoxItem Content="Yes"/>
</ComboBox>
<Label ToolTip="Consider meme and humorous artwork?" x:Name="label_artworkHumor" Content="Artwork humorous" VerticalAlignment="Center" Height="29" Grid.Row="12" Grid.Column="1"/>
<ComboBox x:Name="humor_comboBox" Margin="0,0,10,0" VerticalAlignment="Center" Height="32" Grid.Column="2" Width="220" Grid.Row="12" Grid.ColumnSpan="2" HorizontalAlignment="Right">
<Label ToolTip="Consider meme and humorous artwork?" x:Name="label1_Copy5" Content="Artwork humorous" Margin="5,176,0,0" VerticalAlignment="Top" Height="29" Grid.Row="5" Grid.Column="1"/>
<ComboBox x:Name="humor_comboBox" Margin="0,181,10,0" VerticalAlignment="Top" Height="31" Grid.Column="1" HorizontalAlignment="Right" Width="244" Grid.Row="5" Grid.ColumnSpan="3">
<ComboBoxItem Content="No"/>
<ComboBoxItem Content="Any"/>
<ComboBoxItem Content="Yes"/>
</ComboBox>
<!-- Bottom Section -->
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="3" Grid.Row="13" Grid.ColumnSpan="1" Height="32" Margin="0,5,10,0"/>
<Button x:Name="update_button" Click="update_button_Click" Content="Check for updates" Margin="0,0,10,0" Grid.Row="14" VerticalAlignment="Center" HorizontalAlignment="Right" Width="165" Grid.ColumnSpan="2" Grid.Column="0" Height="32"/>
<Button x:Name="help_button" Click="help_button_Click" Content="Get help at our Reddit" Grid.Column="2" Grid.Row="14" VerticalAlignment="Center" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="165" Height="32" Margin="10,0,0,0"/>
<Button x:Name="clearAll_button" Click="clearAll_button_Click" Content="Debug: Clear shortcuts.vdf" Grid.Row="18" VerticalAlignment="Center" HorizontalAlignment="Center" Width="200" Grid.Column="1" Grid.ColumnSpan="2" Height="32"/>
<Label ToolTip="Add these tags to exported games, use comma separated values" x:Name="label1_Copy6" Content="Export with these tags:" Margin="5,2,8,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.Row="4"/>
<TextBox x:Name="tags_textBox" Grid.Column="2" Height="29" Margin="10,2,10,0" Grid.Row="4" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
<ToggleButton x:Name="change_resolution_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="0,9,0,0" ToolTip="Change host resolution on streaming mode" IsChecked="False" Height="18" Grid.Row="3" />
<Label ToolTip="Change the host computer resolution on launch, return to previous after." x:Name="label1_Copy8" Content="Change host resolution to:" Margin="5,3,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1" Grid.Row="3"/>
<ComboBox x:Name="resolution_comboBox" Margin="0,3,10,0" VerticalAlignment="Top" Height="31" Grid.Column="2" HorizontalAlignment="Right" Width="217" Grid.Row="3" Grid.ColumnSpan="2"/>
</Grid>
<!-- Sidebar -->
<Grid Margin="10,10,10,10" Grid.Column="1" Grid.RowSpan="1" Grid.Row="1">
<Grid Margin="10,88,9,35" Grid.Column="1" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="290*"/>
<ColumnDefinition Width="63*"/>
<ColumnDefinition Width="164*"/>
<ColumnDefinition Width="59*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="150"/>
<RowDefinition Height="80"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="60*"/>
<RowDefinition Height="259*"/>
<RowDefinition Height="42*"/>
<RowDefinition Height="42*"/>
<RowDefinition Height="42*"/>
<RowDefinition Height="190*"/>
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" Mode="PrimaryMid" VerticalAlignment="Top" Height="30" Grid.ColumnSpan="3">
<Label Content="About" HorizontalAlignment="Left" Margin="-10,-15,0,-17" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="14" Height="32" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image2" Height="150" VerticalAlignment="Center" Source="Resources/briano.png" Stretch="UniformToFill" HorizontalAlignment="Center" Width="150" Grid.Column="0" Grid.Row="1"/>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock" Text="Developed by Brian Lima, @brianostorm, if you like my work cheer me up at my Twitter or pay me a coffee via Paypal, this way i can keep building amazing open-source tools for you!" TextAlignment="Justify" VerticalAlignment="Center" Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Row="2" HorizontalAlignment="Center"/>
<materialDesign:Chip Content="Projects @ GitHub"
IconBackground="{DynamicResource PrimaryHueDarkBrush}"
IconForeground="{DynamicResource PrimaryHueDarkForegroundBrush}"
Margin="0,0,0,0" Click="Chip1_Click" HorizontalAlignment="Center" Height="32" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Width="160">
Margin="8,3,0,4" Click="Chip1_Click" HorizontalAlignment="Stretch" Height="Auto" Grid.Row="1" Grid.Column="1">
<materialDesign:Chip.Icon>
<materialDesign:PackIcon Kind="Github" Foreground="{DynamicResource MaterialDesign.Brush.Primary.Dark}"/>
<materialDesign:PackIcon Kind="MicrosoftGithub"></materialDesign:PackIcon>
</materialDesign:Chip.Icon>
</materialDesign:Chip>
<materialDesign:Chip Content="Paypal donate"
IconBackground="{DynamicResource PrimaryHueDarkBrush}"
IconForeground="{DynamicResource PrimaryHueDarkForegroundBrush}"
Margin="0,0,0,0" Click="Chip2_Click" HorizontalAlignment="Center" Height="32" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Width="160">
Margin="8,4,0,5" Click="Chip2_Click" HorizontalAlignment="Stretch" Height="Auto" Grid.Row="2" Grid.Column="1">
<materialDesign:Chip.Icon>
<materialDesign:PackIcon Kind="Coffee" Foreground="{DynamicResource MaterialDesign.Brush.Primary.Dark}"></materialDesign:PackIcon>
<materialDesign:PackIcon Kind="Coffee"></materialDesign:PackIcon>
</materialDesign:Chip.Icon>
</materialDesign:Chip>
<materialDesign:Chip Content="@brianostorm"
IconBackground="{DynamicResource PrimaryHueDarkBrush}"
IconForeground="{DynamicResource PrimaryHueDarkForegroundBrush}"
Margin="0,0,0,0" Click="Chip_Click" HorizontalAlignment="Center" Height="32" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" Width="160">
Margin="8,4,0,3" Click="Chip_Click" HorizontalAlignment="Stretch" Height="Auto" Grid.Row="3" Grid.Column="1">
<materialDesign:Chip.Icon>
<materialDesign:PackIcon Kind="Twitter" Foreground="{DynamicResource MaterialDesign.Brush.Primary.Dark}" />
<materialDesign:PackIcon Kind="Twitter" />
</materialDesign:Chip.Icon>
</materialDesign:Chip>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock_Copy" Height="59" TextAlignment="Justify" Grid.Row="6" Grid.ColumnSpan="1" VerticalAlignment="Top" Margin="0,10,0,0"><Run Text="Special thanks to /r/Forza and /r/Steam communities at Reddit"/><Run Text=", and to all the "/><Hyperlink NavigateUri="https://github.com/BrianLima/UWPHook/graphs/contributors"> contributors </Hyperlink><Run Text=" who have dealt with my bad code"/><Run Text="."/><Run Text=" "/><Run Text=":)"/></TextBlock>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock" Margin="0,185,0,0" Text="Developed by Brian Lima, @brianostorm, if you like my work cheer me up at my Twitter or pay me a coffee via Paypal, this way i can keep building amazing open-source tools for you!" TextAlignment="Justify" Height="91" VerticalAlignment="Top" Grid.ColumnSpan="3" Grid.RowSpan="2"/>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="27" Grid.ColumnSpan="3">
<Label Content="About" HorizontalAlignment="Left" Margin="-10,-15,0,-17" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="14" Height="32" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image2" Height="150" VerticalAlignment="Top" Source="Resources/briano.png" Stretch="UniformToFill" Margin="8,32,0,0" HorizontalAlignment="Left" Width="150" Grid.Column="1"/>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock_Copy" VerticalAlignment="Top" Height="59" TextAlignment="Justify" Grid.Row="4" Grid.ColumnSpan="3" Margin="0,1,0,0"><Run Text="Special thanks to /r/Forza and /r/Steam communities at Reddit"/><Run Text=", and to all the "/><Hyperlink NavigateUri="https://github.com/BrianLima/UWPHook/graphs/contributors"> contributors </Hyperlink><Run Text=" who have dealt with my bad code"/><Run Text="."/><Run Text=" "/><Run Text=":)"/></TextBlock>
</Grid>
<Grid Margin="10,9.8,10.2,0.4" Grid.Row="2" Visibility="Hidden">
<Image HorizontalAlignment="Left" Height="111" VerticalAlignment="Top" Width="111" Source="Resources/square.png"/>
<TextBlock Margin="116,0,0,0" TextWrapping="Wrap" Text="Checkout OverFy, my new app, it add Spotify's now playing status into Rivatuner/MSI Afterburner overlay, Free and Open Source!" VerticalAlignment="Top" Height="63" TextAlignment="Justify" HorizontalAlignment="Left" Width="341"/>
<Button x:Name="update_button_Copy" Click="update_button_Click" Content="Get OverFy!" Margin="206,0,0,10" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="162"/>
</Grid>
<Button x:Name="clearAll_button" Click="clearAll_button_Click" Content="Debug: Clear shortcuts.vdf" Margin="0,0,156,12" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="191"/>
</Grid>
</Window>

@ -1,6 +1,9 @@
using System;
using System.Globalization;
using System.Windows;
using System.Linq;
using System.Runtime.InteropServices;
//using System.Windows.Forms;
namespace UWPHook
{
@ -25,14 +28,13 @@ namespace UWPHook
seconds_comboBox.Items.Add(i + " seconds");
if (i == Properties.Settings.Default.Seconds)
{
seconds_comboBox.SelectedIndex = i;
seconds_comboBox.SelectedIndex = i - 1;
}
}
cultures_comboBox.SelectedItem = Properties.Settings.Default.TargetLanguage;
language_toggle.IsChecked = Properties.Settings.Default.ChangeLanguage;
streaming_toggle.IsChecked = Properties.Settings.Default.StreamMode;
logLevel_comboBox.SelectedIndex = Properties.Settings.Default.SelectedLogLevel;
steamgriddb_api_key.Text = Properties.Settings.Default.SteamGridDbApiKey;
style_comboBox.SelectedIndex = Properties.Settings.Default.SelectedSteamGridDB_Style;
type_comboBox.SelectedIndex = Properties.Settings.Default.SelectedSteamGridDB_Type;
@ -47,7 +49,6 @@ namespace UWPHook
Properties.Settings.Default.TargetLanguage = cultures_comboBox.SelectedItem.ToString();
Properties.Settings.Default.Seconds = Int32.Parse(seconds_comboBox.SelectedItem.ToString().Substring(0, 1));
Properties.Settings.Default.StreamMode = (bool)streaming_toggle.IsChecked;
Properties.Settings.Default.SelectedLogLevel = logLevel_comboBox.SelectedIndex;
Properties.Settings.Default.SteamGridDbApiKey = steamgriddb_api_key.Text.Trim('\r', '\n');
Properties.Settings.Default.SelectedSteamGridDB_Style = style_comboBox.SelectedIndex;
Properties.Settings.Default.SelectedSteamGridDB_Type = type_comboBox.SelectedIndex;
@ -55,7 +56,6 @@ namespace UWPHook
Properties.Settings.Default.SelectedSteamGridDB_Humor = humor_comboBox.SelectedIndex;
Properties.Settings.Default.Tags = tags_textBox.Text;
Properties.Settings.Default.Save();
GamesWindow.SetLogLevel();
this.Close();
}
@ -86,11 +86,7 @@ namespace UWPHook
private void clearAll_button_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show("This action will remove ALL shortcuts from non-Steam games." + Environment.NewLine + " Are you sure you want to continue?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{
GamesWindow.ClearAllShortcuts();
}
GamesWindow.ClearAllShortcuts();
}
private void key_Button_Click(object sender, RoutedEventArgs e)

@ -4,7 +4,6 @@ using System.Net.Http.Headers;
using System.Threading.Tasks;
using UWPHook.Properties;
using System.Diagnostics;
using Serilog;
namespace UWPHook.SteamGridDb
{
@ -46,12 +45,11 @@ namespace UWPHook.SteamGridDb
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
{
Log.Verbose("ERROR RESPONSE: " + response.ToString());
Debug.WriteLine("ERROR RESPONSE: " + response.ToString());
settings.SteamGridDbApiKey = String.Empty;
settings.Save();
Log.Error("Warning: SteamGrid API Key Invalid. Please generate a new key and add it to settings.");
throw new TaskCanceledException("Warning: SteamGrid API Key Invalid. Please generate a new key and add it to settings.");
}

@ -202,22 +202,19 @@
<Version>1.2.0</Version>
</PackageReference>
<PackageReference Include="MaterialDesignColors">
<Version>3.0.0</Version>
<Version>2.0.6</Version>
</PackageReference>
<PackageReference Include="MaterialDesignThemes">
<Version>5.0.0</Version>
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.WebApi.Client">
<Version>6.0.0</Version>
<Version>5.2.9</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="Serilog">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Console">
<Version>5.0.1</Version>
<Version>2.11.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.File">
<Version>5.0.0</Version>

Loading…
Cancel
Save