diff --git a/UWPHook/GameModel.cs b/UWPHook/GameModel.cs index 9132eb5..43a2592 100644 --- a/UWPHook/GameModel.cs +++ b/UWPHook/GameModel.cs @@ -25,6 +25,11 @@ namespace UWPHook } private ObservableCollection _games; + + public int length() + { + return this._games.Count; + } public ObservableCollection games { diff --git a/UWPHook/MainWindow.xaml.cs b/UWPHook/MainWindow.xaml.cs index d176c41..cce3732 100644 --- a/UWPHook/MainWindow.xaml.cs +++ b/UWPHook/MainWindow.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -24,30 +25,37 @@ namespace UWPHook public MainWindow() { InitializeComponent(); - - if (Environment.GetCommandLineArgs() != null) - { - } - - // games = new List(); - // for (int i = 0; i < 10; i++) - // { - // games.Add(new GameModel { game_alias = "sajufhsaduifhuisdsdgbuigduisaguidsguisaguiasguidasg", game_path = "sajufhsaduifhuisdsdgbuigduisaguidsguisaguiasguidasgx" }); - // } - } private void Window_Loaded(object sender, RoutedEventArgs e) { games = new GameModel(); listView.ItemsSource = games.games; - + + var argument = Environment.GetCommandLineArgs(); + string argumentGame = ""; + for (int i = 1; i < argument.Length; i++) + { + argumentGame += argument[i] + " "; + } + + if (argument != null) + { + foreach (Game game in games.games) + { + if (game.game_alias.ToLower() == argumentGame.ToLower().Trim()) + { + Process.Start(@"shell:AppsFolder\" + game.game_path); + } + } + } + } private void addButton_Click(object sender, RoutedEventArgs e) { games.Store(); - games.Add(new Game{ game_alias = alias_textBox.Text, game_path = path_textBox.Text }); + games.Add(new Game { game_alias = alias_textBox.Text, game_path = path_textBox.Text }); } } } diff --git a/UWPHook/UWPHook.csproj.user b/UWPHook/UWPHook.csproj.user index f671e13..5737ba3 100644 --- a/UWPHook/UWPHook.csproj.user +++ b/UWPHook/UWPHook.csproj.user @@ -1,6 +1,6 @@  - forza + forza horizon 3 \ No newline at end of file diff --git a/UWPHook/bin/Debug/UWPHook.exe b/UWPHook/bin/Debug/UWPHook.exe index 83afebc..f6e2f89 100644 Binary files a/UWPHook/bin/Debug/UWPHook.exe and b/UWPHook/bin/Debug/UWPHook.exe differ diff --git a/UWPHook/bin/Debug/UWPHook.pdb b/UWPHook/bin/Debug/UWPHook.pdb index 9474841..648289a 100644 Binary files a/UWPHook/bin/Debug/UWPHook.pdb and b/UWPHook/bin/Debug/UWPHook.pdb differ diff --git a/UWPHook/bin/Debug/games.json b/UWPHook/bin/Debug/games.json index 8950874..4360682 100644 --- a/UWPHook/bin/Debug/games.json +++ b/UWPHook/bin/Debug/games.json @@ -1 +1 @@ -[{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"}] \ No newline at end of file +[{"game_alias":"Forza Apex","game_path":"Microsoft.ApexPG_8wekyb3d8bbwe!forzamotorsportapex"},{"game_alias":"Forza Horizon 3", "game_path":"Microsoft.OpusPG_8wekyb3d8bbwe!App"},{"game_alias":"Killer Instinct","game_path":"Microsoft.KillerInstinct-Win10_8wekyb3d8bbwe!KillerInstinct.App"},{"game_alias":"Minecraft","game_path":"Microsoft.MinecraftUWP_8wekyb3d8bbwe!App"}] \ No newline at end of file diff --git a/UWPHook/games.json b/UWPHook/games.json index 8950874..4360682 100644 --- a/UWPHook/games.json +++ b/UWPHook/games.json @@ -1 +1 @@ -[{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"}] \ No newline at end of file +[{"game_alias":"Forza Apex","game_path":"Microsoft.ApexPG_8wekyb3d8bbwe!forzamotorsportapex"},{"game_alias":"Forza Horizon 3", "game_path":"Microsoft.OpusPG_8wekyb3d8bbwe!App"},{"game_alias":"Killer Instinct","game_path":"Microsoft.KillerInstinct-Win10_8wekyb3d8bbwe!KillerInstinct.App"},{"game_alias":"Minecraft","game_path":"Microsoft.MinecraftUWP_8wekyb3d8bbwe!App"}] \ No newline at end of file diff --git a/UWPHook/obj/Debug/UWPHook.exe b/UWPHook/obj/Debug/UWPHook.exe index 83afebc..f6e2f89 100644 Binary files a/UWPHook/obj/Debug/UWPHook.exe and b/UWPHook/obj/Debug/UWPHook.exe differ diff --git a/UWPHook/obj/Debug/UWPHook.pdb b/UWPHook/obj/Debug/UWPHook.pdb index 9474841..648289a 100644 Binary files a/UWPHook/obj/Debug/UWPHook.pdb and b/UWPHook/obj/Debug/UWPHook.pdb differ