From fd3a34b745ef3d0f5f010cd70845d6fe6d751b94 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 13 Dec 2024 18:08:29 +0000 Subject: [PATCH] v3.2.3 - Fix path geometries not parsing correctly with other cultures/regions/languages - Fix resource not found on OpenFolderDialog when switching languages - Added a launch argument to launch the game straight away when opening the launcher with -launchgame - Code cleanup - General bug fixes --- H1EmuLauncher/App.xaml.cs | 6 ++-- .../Classes/CustomSettingsProvider.cs | 2 +- H1EmuLauncher/H1EmuLauncher.csproj | 6 ++-- .../SettingsPages/AccountKey.xaml.cs | 5 +-- H1EmuLauncher/SteamFramePages/Login.xaml.cs | 33 +++++++++++-------- .../Windows/AddOrEditServerWindow.xaml.cs | 4 +-- H1EmuLauncher/Windows/LauncherWindow.xaml.cs | 18 ++++++---- H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj | 14 ++++---- 8 files changed, 49 insertions(+), 39 deletions(-) diff --git a/H1EmuLauncher/App.xaml.cs b/H1EmuLauncher/App.xaml.cs index ca9eee5..0867167 100644 --- a/H1EmuLauncher/App.xaml.cs +++ b/H1EmuLauncher/App.xaml.cs @@ -79,7 +79,7 @@ private void SendArgumentsToRunningInstance(string[] args) { try { - NamedPipeClientStream pipeClient = new(".", "H1EmuLauncherPipe", PipeDirection.Out); + NamedPipeClientStream pipeClient = new(null, "H1EmuLauncherPipe", PipeDirection.Out); StreamWriter writer = new(pipeClient); pipeClient.Connect(1000); @@ -88,7 +88,7 @@ private void SendArgumentsToRunningInstance(string[] args) } catch (Exception e) { - CustomMessageBox.Show($"Error sending argumentsto active instance: \"{e.Message}\"."); + CustomMessageBox.Show($"Error sending launch arguments to active instance: \"{e.Message}\".", LauncherWindow.launcherInstance); } } @@ -103,7 +103,7 @@ private void TextBoxContextMenuPasteClick(object sender, RoutedEventArgs e) } catch (Exception ex) { - CustomMessageBox.Show($"{FindResource("item184")} \"{ex.Message}\"."); + CustomMessageBox.Show($"{FindResource("item220")} \"{ex.Message}\"."); } } diff --git a/H1EmuLauncher/Classes/CustomSettingsProvider.cs b/H1EmuLauncher/Classes/CustomSettingsProvider.cs index adcdcb0..b616e77 100644 --- a/H1EmuLauncher/Classes/CustomSettingsProvider.cs +++ b/H1EmuLauncher/Classes/CustomSettingsProvider.cs @@ -137,7 +137,7 @@ public override void SetPropertyValues(SettingsContext context, SettingsProperty private void LoadValuesFromFile() { - // New data folder name + // New data folder name so user settings need to be migrated if (Directory.Exists($"{Info.APPLICATION_DATA_PATH}\\H1EmuLauncher")) { try diff --git a/H1EmuLauncher/H1EmuLauncher.csproj b/H1EmuLauncher/H1EmuLauncher.csproj index a070d4d..81f60e0 100644 --- a/H1EmuLauncher/H1EmuLauncher.csproj +++ b/H1EmuLauncher/H1EmuLauncher.csproj @@ -7,10 +7,10 @@ true true Icon.ico - 3.2.2 + 3.2.3 true H1Emu - 3.2.2 + 3.2.3 H1Emu Launcher false © H1Emu @@ -18,7 +18,7 @@ A launcher for the H1Emu project. H1Emu Launcher Icon.ico - 3.2.2 + 3.2.3 True diff --git a/H1EmuLauncher/SettingsPages/AccountKey.xaml.cs b/H1EmuLauncher/SettingsPages/AccountKey.xaml.cs index a4dfe30..12c83f3 100644 --- a/H1EmuLauncher/SettingsPages/AccountKey.xaml.cs +++ b/H1EmuLauncher/SettingsPages/AccountKey.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Globalization; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -121,13 +122,13 @@ private void ToggleKeyVisibility(object sender, RoutedEventArgs e) { accountKeyBoxPassword.Visibility = Visibility.Hidden; accountKeyBoxText.Visibility = Visibility.Visible; - toggleKeyVisibilityButtonPath.Data = Geometry.Parse(FindResource("EyeHideIcon").ToString()); + toggleKeyVisibilityButtonPath.Data = (PathGeometry)FindResource("EyeHideIcon"); } else { accountKeyBoxPassword.Visibility = Visibility.Visible; accountKeyBoxText.Visibility = Visibility.Hidden; - toggleKeyVisibilityButtonPath.Data = Geometry.Parse(FindResource("EyeIcon").ToString()); + toggleKeyVisibilityButtonPath.Data = (PathGeometry)FindResource("EyeIcon"); } toggleKeyVisibilityButton.Content = toggleKeyVisibilityButtonPath; diff --git a/H1EmuLauncher/SteamFramePages/Login.xaml.cs b/H1EmuLauncher/SteamFramePages/Login.xaml.cs index 88a4856..bc16c92 100644 --- a/H1EmuLauncher/SteamFramePages/Login.xaml.cs +++ b/H1EmuLauncher/SteamFramePages/Login.xaml.cs @@ -19,10 +19,6 @@ public partial class Login { private static Storyboard loadingAnimation; public static string gameInfo = "-app 295110 -depot 295111 -manifest 8395659676467739522"; - OpenFolderDialog selectDirectory = new() - { - Title = Application.Current.FindResource("item51").ToString() - }; public Login() { @@ -132,13 +128,17 @@ public async void TryLoginDownload() SelectLocation: bool result = true; bool returnToLogin = false; + string selectedDirectory = string.Empty; Dispatcher.Invoke(new Action(delegate { - if (selectDirectory.ShowDialog() == false) + OpenFolderDialog ofd = new() { - UpdateLang(); + Title = FindResource("item51").ToString() + }; + if (ofd.ShowDialog() == false) + { MessageBoxResult mbr = CustomMessageBox.Show(FindResource("item222").ToString(), LauncherWindow.launcherInstance, false, true, true); if (mbr == MessageBoxResult.Yes) { @@ -150,14 +150,17 @@ public async void TryLoginDownload() } else { - if (Directory.GetFileSystemEntries(selectDirectory.FolderName).Length != 0) + if (Directory.GetFileSystemEntries(ofd.FolderName).Length != 0) { - UpdateLang(); - MessageBoxResult mbr = CustomMessageBox.Show(FindResource("item89").ToString().Replace("\\n\\n", Environment.NewLine + Environment.NewLine), LauncherWindow.launcherInstance, false, true, true); - if (mbr != MessageBoxResult.Yes) - result = false; + if (mbr != MessageBoxResult.Yes) + { + result = false; + return; + } } + + selectedDirectory = ofd.FolderName; } })); @@ -166,7 +169,7 @@ public async void TryLoginDownload() else if (returnToLogin) return; - ContentDownloader.DEFAULT_DOWNLOAD_DIR = selectDirectory.FolderName; + ContentDownloader.DEFAULT_DOWNLOAD_DIR = selectedDirectory; foreach (ulong manifestId in manifestIdList) { @@ -200,7 +203,6 @@ public async void TryLoginDownload() Dispatcher.Invoke(new Action(delegate { - UpdateLang(); LauncherWindow.launcherInstance.taskbarIcon.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None; LauncherWindow.launcherInstance.steamFramePanel.Navigate(new Uri("..\\SteamFramePages\\DownloadComplete.xaml", UriKind.Relative)); loadingAnimation.Stop(); @@ -208,6 +210,7 @@ public async void TryLoginDownload() loginEnterButton.Visibility = Visibility.Visible; LauncherWindow.launcherInstance.directoryBox.Text = Properties.Settings.Default.activeDirectory; LauncherWindow.launcherInstance.CheckGameVersionAndPath(LauncherWindow.launcherInstance, false, true); + UpdateLang(); CustomMessageBox.Show($"{FindResource("item37")} {version}.", LauncherWindow.launcherInstance); })); } @@ -228,6 +231,7 @@ public async void TryLoginDownload() Dispatcher.Invoke(new Action(delegate { BackToLogin(); + UpdateLang(); CustomMessageBox.Show($"{FindResource("item38")} {version}.", LauncherWindow.launcherInstance); })); } @@ -236,6 +240,7 @@ public async void TryLoginDownload() Dispatcher.Invoke(new Action(delegate { BackToLogin(); + UpdateLang(); if (ex.Message.Contains("is not available from this account.")) CustomMessageBox.Show($"{FindResource("item39")} \"{ex.Message}\".\n\n{FindResource("item15")}", LauncherWindow.launcherInstance); else @@ -247,6 +252,7 @@ public async void TryLoginDownload() Dispatcher.Invoke(new Action(delegate { BackToLogin(); + UpdateLang(); CustomMessageBox.Show($"{FindResource("item40")} \"{exc.Message}\".", LauncherWindow.launcherInstance); })); } @@ -355,7 +361,6 @@ static List GetParameterList(string[] args, string param) public void BackToLogin() { - UpdateLang(); LauncherWindow.launcherInstance.taskbarIcon.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None; LauncherWindow.launcherInstance.steamFramePanel.Navigate(new Uri("..\\SteamFramePages\\Login.xaml", UriKind.Relative)); usernameBox.Text = string.Empty; diff --git a/H1EmuLauncher/Windows/AddOrEditServerWindow.xaml.cs b/H1EmuLauncher/Windows/AddOrEditServerWindow.xaml.cs index 2d17c03..7c916e2 100644 --- a/H1EmuLauncher/Windows/AddOrEditServerWindow.xaml.cs +++ b/H1EmuLauncher/Windows/AddOrEditServerWindow.xaml.cs @@ -119,7 +119,7 @@ private void AddNewServer() }; System.Windows.Shapes.Path pathEdit = new() { - Data = Geometry.Parse(FindResource("EditIcon").ToString()), + Data = (PathGeometry)FindResource("EditIcon"), Stretch = Stretch.Uniform }; Binding bindingEdit = new("Foreground") @@ -146,7 +146,7 @@ private void AddNewServer() }; System.Windows.Shapes.Path pathDelete = new() { - Data = Geometry.Parse(FindResource("BinIcon").ToString()), + Data = (PathGeometry)FindResource("BinIcon"), Stretch = Stretch.Uniform }; Binding bindingDelete = new("Foreground") diff --git a/H1EmuLauncher/Windows/LauncherWindow.xaml.cs b/H1EmuLauncher/Windows/LauncherWindow.xaml.cs index a59c28e..cf4e353 100644 --- a/H1EmuLauncher/Windows/LauncherWindow.xaml.cs +++ b/H1EmuLauncher/Windows/LauncherWindow.xaml.cs @@ -173,6 +173,10 @@ await Task.Run(() => else SettingsWindow.SwitchToAccountKeyTab(); } + else if (string.Join(' ', rawArgs).Contains("-launchgame")) + { + playButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); + } } private void ServerSelectorChanged(object sender, SelectionChangedEventArgs e) @@ -212,7 +216,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathH1EmuServersPlay = new() { - Data = Geometry.Parse(FindResource("PlayIcon").ToString()), + Data = (PathGeometry)FindResource("PlayIcon"), Stretch = Stretch.Uniform, Width = 14, Height = 14 @@ -239,7 +243,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathSinglePlayerPlay = new() { - Data = Geometry.Parse(FindResource("PlayIcon").ToString()), + Data = (PathGeometry)FindResource("PlayIcon"), Stretch = Stretch.Uniform, Width = 14, Height = 14 @@ -272,7 +276,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathExitNotifyIcon = new() { - Data = Geometry.Parse(FindResource("ExitIcon").ToString()), + Data = (PathGeometry)FindResource("ExitIcon"), Stretch = Stretch.Uniform, Width = 14, Height = 14, @@ -305,7 +309,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathCustomServerDelete = new() { - Data = Geometry.Parse(FindResource("PlayIcon").ToString()), + Data = (PathGeometry)FindResource("PlayIcon"), Stretch = Stretch.Uniform, Width = 14, Height = 14 @@ -373,7 +377,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathCustom = new() { - Data = Geometry.Parse(FindResource("EditIcon").ToString()), + Data = (PathGeometry)FindResource("EditIcon"), Stretch = Stretch.Uniform }; Binding bindingCustom = new("Foreground") @@ -400,7 +404,7 @@ private void LoadServers() }; System.Windows.Shapes.Path pathDeleteCustom = new() { - Data = Geometry.Parse(FindResource("BinIcon").ToString()), + Data = (PathGeometry)FindResource("BinIcon"), Stretch = Stretch.Uniform }; Binding bindingDeleteCustom = new("Foreground") @@ -560,7 +564,7 @@ private void AddServerToRecentList(string name) }; System.Windows.Shapes.Path pathCustomServerPlay = new() { - Data = Geometry.Parse(FindResource("PlayIcon").ToString()), + Data = (PathGeometry)FindResource("PlayIcon"), Stretch = Stretch.Uniform, Width = 14, Height = 14 diff --git a/H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj b/H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj index c85f0d6..859d316 100644 --- a/H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj +++ b/H1EmuLauncherSetup/H1EmuLauncherSetup.vdproj @@ -203,16 +203,16 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:H1Emu Launcher" - "ProductCode" = "8:{9D73D8A0-128C-41B5-A726-02354F198B42}" - "PackageCode" = "8:{9A8EACA3-C79B-443D-A19A-00EF5674C2AD}" + "ProductCode" = "8:{B0B0D73F-52C6-4E2D-B45C-0B274A5E1FD5}" + "PackageCode" = "8:{8ED996B9-37EA-45AE-93CA-1E10C8B751C0}" "UpgradeCode" = "8:{4E679270-65C8-4021-83BE-3B8EC3EC7AFE}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:3.2.2" - "Manufacturer" = "8:H1Emu © 2024" + "ProductVersion" = "8:3.2.3" + "Manufacturer" = "8:H1Emu" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://discord.com/invite/RM6jNkj" "Title" = "8:H1Emu Launcher" @@ -349,7 +349,7 @@ "Condition" = "8:" "Transitive" = "11:FALSE" "ValueTypes" = "3:1" - "Value" = "8:\"[TARGETDIR]H1EmuLauncher.exe\" \"%1\"\"" + "Value" = "8:\"[TARGETDIR]H1Emu Launcher.exe\" \"%1\"\"" } } } @@ -381,7 +381,7 @@ "Condition" = "8:" "Transitive" = "11:FALSE" "ValueTypes" = "3:1" - "Value" = "8:H1EmuLauncher.exe,1" + "Value" = "8:H1Emu Launcher.exe,1" } } } @@ -402,7 +402,7 @@ "Condition" = "8:" "Transitive" = "11:FALSE" "ValueTypes" = "3:1" - "Value" = "8:URL:H1EmuLauncher Protocol" + "Value" = "8:URL:H1Emu Launcher Protocol" } } }