diff --git a/UWPHook/App.config b/UWPHook/App.config index 6a92738..e2344c9 100644 --- a/UWPHook/App.config +++ b/UWPHook/App.config @@ -16,6 +16,9 @@ + + 5 + \ No newline at end of file diff --git a/UWPHook/AppManager.cs b/UWPHook/AppManager.cs index 8b9a7ae..037790c 100644 --- a/UWPHook/AppManager.cs +++ b/UWPHook/AppManager.cs @@ -70,9 +70,7 @@ namespace UWPHook { using (StreamReader reader = new StreamReader(stream)) { - ScriptManager script = new ScriptManager(); - result = script.RunScript(reader.ReadToEnd()).Split(';').ToList(); - + result = ScriptManager.RunScript(reader.ReadToEnd()).Split(';').ToList(); } } diff --git a/UWPHook/GamesWindow.xaml.cs b/UWPHook/GamesWindow.xaml.cs index 147c0de..e05d366 100644 --- a/UWPHook/GamesWindow.xaml.cs +++ b/UWPHook/GamesWindow.xaml.cs @@ -23,17 +23,6 @@ namespace UWPHook Apps = new AppEntryModel(); listGames.ItemsSource = Apps.Entries; - if (Properties.Settings.Default.ChangeLanguage) - { - this.Title = "true "; - } - else - { - this.Title = "false "; - } - - this.Title += Properties.Settings.Default.TargetLanguage; - //If null or 1, the app was launched normally if (Environment.GetCommandLineArgs() == null) { @@ -50,8 +39,14 @@ namespace UWPHook this.Title = "UWPHook: Playing a game"; //Hide the window so the app is launched seamless this.Hide(); + string currentLanguage = CultureInfo.CurrentCulture.ToString(); try { + if (Properties.Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Properties.Settings.Default.TargetLanguage)) + { + string script = ""; + ScriptManager.RunScript("Set - WinUILanguageOverride " + Properties.Settings.Default.TargetLanguage); + } //The only other parameter Steam will send is the app AUMID AppManager.LaunchUWPApp(Environment.GetCommandLineArgs()[1]); while (AppManager.IsRunning()) @@ -64,6 +59,13 @@ namespace UWPHook this.Show(); MessageBox.Show(e.Message, "UWPHook", MessageBoxButton.OK, MessageBoxImage.Warning); } + finally + { + if (Properties.Settings.Default.ChangeLanguage && !String.IsNullOrEmpty(Properties.Settings.Default.TargetLanguage)) + { + ScriptManager.RunScript("Set - WinUILanguageOverride " + currentLanguage); + } + } } private void ExportButton_Click(object sender, RoutedEventArgs e) diff --git a/UWPHook/Properties/Settings.Designer.cs b/UWPHook/Properties/Settings.Designer.cs index 9328ab6..8eeae83 100644 --- a/UWPHook/Properties/Settings.Designer.cs +++ b/UWPHook/Properties/Settings.Designer.cs @@ -46,5 +46,17 @@ namespace UWPHook.Properties { this["TargetLanguage"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("5")] + public int Seconds { + get { + return ((int)(this["Seconds"])); + } + set { + this["Seconds"] = value; + } + } } } diff --git a/UWPHook/Properties/Settings.settings b/UWPHook/Properties/Settings.settings index 56c1587..16477b8 100644 --- a/UWPHook/Properties/Settings.settings +++ b/UWPHook/Properties/Settings.settings @@ -8,5 +8,8 @@ + + 5 + \ No newline at end of file diff --git a/UWPHook/Resources/briano.jpg b/UWPHook/Resources/briano.jpg deleted file mode 100644 index c416b50..0000000 Binary files a/UWPHook/Resources/briano.jpg and /dev/null differ diff --git a/UWPHook/Resources/briano.png b/UWPHook/Resources/briano.png new file mode 100644 index 0000000..2fca005 Binary files /dev/null and b/UWPHook/Resources/briano.png differ diff --git a/UWPHook/ScriptManager.cs b/UWPHook/ScriptManager.cs index f0de78e..c674e74 100644 --- a/UWPHook/ScriptManager.cs +++ b/UWPHook/ScriptManager.cs @@ -5,9 +5,9 @@ using System.Text; namespace UWPHook { - class ScriptManager + static class ScriptManager { - public string RunScript(string scriptText) + public static string RunScript(string scriptText) { // create Powershell runspace Runspace runspace = RunspaceFactory.CreateRunspace(); diff --git a/UWPHook/SettingsWindow.xaml b/UWPHook/SettingsWindow.xaml index f593fd2..5b7a04c 100644 --- a/UWPHook/SettingsWindow.xaml +++ b/UWPHook/SettingsWindow.xaml @@ -11,7 +11,7 @@ TextElement.FontWeight="Medium" TextElement.FontSize="14" FontFamily="Segoe UI Light" - Title="SettingsWindow" Height="600" Width="800"> + Title="Settings" Height="600" Width="800"> @@ -33,32 +33,47 @@ - - + + + - - diff --git a/UWPHook/SettingsWindow.xaml.cs b/UWPHook/SettingsWindow.xaml.cs index 1e270cb..5b3244c 100644 --- a/UWPHook/SettingsWindow.xaml.cs +++ b/UWPHook/SettingsWindow.xaml.cs @@ -1,18 +1,6 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace UWPHook { @@ -25,24 +13,53 @@ namespace UWPHook { InitializeComponent(); - Properties.Settings.Default.ChangeLanguage = true; + this.Title = "UWPHook version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); foreach (var culture in CultureInfo.GetCultures(CultureTypes.AllCultures)) { cultures_comboBox.Items.Add(culture.TextInfo.CultureName); } - } - private void ToggleButton_Checked(object sender, RoutedEventArgs e) - { + for (int i = 1; i < 10; i++) + { + seconds_comboBox.Items.Add(i + " seconds"); + if (i == Properties.Settings.Default.Seconds) + { + seconds_comboBox.SelectedIndex = i - 1; + } + } + cultures_comboBox.SelectedItem = Properties.Settings.Default.TargetLanguage; + language_toggle.IsChecked = Properties.Settings.Default.ChangeLanguage; } private void saveButton_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.ChangeLanguage = (bool)language_toggle.IsChecked; Properties.Settings.Default.TargetLanguage = cultures_comboBox.SelectedItem.ToString(); + Properties.Settings.Default.Seconds = Int32.Parse(seconds_comboBox.SelectedItem.ToString().Substring(0, 1)); Properties.Settings.Default.Save(); + this.Close(); + } + + private void Chip_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("http://twitter.com/brianostorm"); + } + + private void Chip1_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("http://github.com/brianlima"); + } + + private void Chip2_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9YPV3FHEFRAUQ"); + } + + private void update_button_Click(object sender, RoutedEventArgs e) + { + System.Diagnostics.Process.Start("https://github.com/BrianLima/UWPHook/releases"); } } -} +} \ No newline at end of file diff --git a/UWPHook/UWPHook.csproj b/UWPHook/UWPHook.csproj index d0ed16b..86b4f9a 100644 --- a/UWPHook/UWPHook.csproj +++ b/UWPHook/UWPHook.csproj @@ -186,7 +186,7 @@ - +