diff --git a/UWPHook/AppEntry.cs b/UWPHook/AppEntry.cs index f1abf91..daa3233 100644 --- a/UWPHook/AppEntry.cs +++ b/UWPHook/AppEntry.cs @@ -1,4 +1,6 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; +using System.IO; using System.Runtime.CompilerServices; namespace UWPHook diff --git a/UWPHook/GamesWindow.xaml.cs b/UWPHook/GamesWindow.xaml.cs index b7a51d7..5c8e665 100644 --- a/UWPHook/GamesWindow.xaml.cs +++ b/UWPHook/GamesWindow.xaml.cs @@ -14,6 +14,7 @@ using System.Windows.Shapes; using VDFParser; using VDFParser.Models; using SharpSteam; +using System.IO; namespace UWPHook { @@ -29,21 +30,30 @@ namespace UWPHook InitializeComponent(); Apps = new AppEntryModel(); listGames.ItemsSource = Apps.Entries; + this.Title = string.Join(";", Environment.GetCommandLineArgs()); } private void ExportButton_Click(object sender, RoutedEventArgs e) { string steam_folder = SteamManager.GetSteamFolder(); - var users = SteamManager.GetUsers(steam_folder); - foreach (var user in users) + if (!String.IsNullOrEmpty(steam_folder)) { - var shortcuts = SteamManager.ReadShortcuts(user); - if (shortcuts != null) + var users = SteamManager.GetUsers(steam_folder); + var selected_apps = from app in Apps.Entries + where app.Selected = true + select new AppEntry() { Aumid = app.Aumid, Name = app.Name, Selected = app.Selected }; + + foreach (var user in users) { - //foreach (var item in Apps.Entries.Select<) - //{ - // - //} + VDFEntry[] shortcuts = SteamManager.ReadShortcuts(user); + if (shortcuts != null) + { + foreach (var app in selected_apps) + { + //Resize this array so it fits the new entries + // Array.Resize(ref shortcuts, shortcuts.Length); + } + } } } } @@ -67,7 +77,6 @@ namespace UWPHook private void HelpButton_Click(object sender, RoutedEventArgs e) { - } } } diff --git a/UWPHook/ProcessManager.cs b/UWPHook/ProcessManager.cs index a0403fb..4e23f85 100644 --- a/UWPHook/ProcessManager.cs +++ b/UWPHook/ProcessManager.cs @@ -9,6 +9,39 @@ using System.Threading.Tasks; namespace UWPHook { + class AppManager + { + private int id; + + public void LaunchUWPApp(string uri) + { + var mgr = new ApplicationActivationManager(); + uint processId; + mgr.ActivateApplication(uri, null, ActivateOptions.None, out processId); + + id = (int)processId; + } + + public Boolean IsRunning() + { + if (id == 0) + { + return false; + } + + try + { + Process.GetProcessById(id); + } + catch (Exception) + { + return false; + } + + return true; + } + } + public enum ActivateOptions { None = 0x00000000, // No flags set @@ -56,30 +89,4 @@ namespace UWPHook interface IShellItemArray { } - - class ProcessManager - { - int StartProccess(string uri) - { - var mgr = new ApplicationActivationManager(); - uint processId; - var name = "Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App"; - mgr.ActivateApplication(name, null, ActivateOptions.None, out processId); - - return ((int)processId); - } - - Boolean ProcessIsRunning(int id) - { - try - { - Process. - } - catch (Exception) - { - - throw; - } - } - } -} +} \ No newline at end of file diff --git a/UWPHook/Properties/Resources.Designer.cs b/UWPHook/Properties/Resources.Designer.cs index 0cc634a..75ed6df 100644 --- a/UWPHook/Properties/Resources.Designer.cs +++ b/UWPHook/Properties/Resources.Designer.cs @@ -68,7 +68,7 @@ namespace UWPHook.Properties { ///{ ///    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id) ///    { - ///        $aumidList += $app.packagefamilyname + "!" + $id + ///        $aumidList += $app.name + "|" + $app.packagefamilyname + "!" + $id + ";" ///    } ///} /// @@ -79,5 +79,15 @@ namespace UWPHook.Properties { return ResourceManager.GetString("GetAUMIDScript", resourceCulture); } } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + public static System.Drawing.Icon hook_icon { + get { + object obj = ResourceManager.GetObject("hook_icon", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } } } diff --git a/UWPHook/Properties/Resources.resx b/UWPHook/Properties/Resources.resx index 32d0e44..2c25359 100644 --- a/UWPHook/Properties/Resources.resx +++ b/UWPHook/Properties/Resources.resx @@ -121,4 +121,7 @@ ..\Resources\GetAUMIDScript.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + ..\resources\hook_icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/UWPHook/UWPHook.csproj b/UWPHook/UWPHook.csproj index 36e2682..079d5f1 100644 --- a/UWPHook/UWPHook.csproj +++ b/UWPHook/UWPHook.csproj @@ -151,7 +151,7 @@ - + @@ -192,6 +192,17 @@ + + + {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} + 1 + 0 + 0 + tlbimp + False + True + +