From d3267dd3aa3cdc98be0832f327e81b7b7fc165cb Mon Sep 17 00:00:00 2001 From: Yelo420 Date: Fri, 28 Jun 2024 12:01:40 +0200 Subject: [PATCH] - Added share button to gameview - Bug fix: Desktop shortcut was created when opening the game settings - Bug fix: Crash on download/extraction notification if box image is not set - Bug fix: Rare crash on Phalcode sign-in window --- CHANGELOG.md | 9 +++++++++ gamevault/AssemblyInfo.cs | 2 +- gamevault/Helper/DesktopHelper.cs | 6 ++++++ gamevault/Helper/WpfEmbeddedBrowser.cs | 13 ++++++++++--- gamevault/Resources/Assets/Icons.xaml | 5 ++++- .../UserControls/GameDownloadUserControl.xaml.cs | 8 ++++---- .../UserControls/GameSettingsUserControl.xaml.cs | 7 +++++-- gamevault/UserControls/GameViewUserControl.xaml | 10 ++++++++++ gamevault/UserControls/GameViewUserControl.xaml.cs | 11 +++++++++++ 9 files changed, 60 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13de373..4891b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # GameVault App Changelog +## 1.11.1.0 +Recommended Gamevault Server Version: `v12.2.0` +### Changes + +- Added share button to gameview +- Bug fix: Desktop shortcut was created when opening the game settings +- Bug fix: Crash on download/extraction notification if box image is not set +- Bug fix: Rare crash on Phalcode sign-in window + ## 1.11.0.0 Recommended Gamevault Server Version: `v12.2.0` ### Changes diff --git a/gamevault/AssemblyInfo.cs b/gamevault/AssemblyInfo.cs index d4cb3eb..f67d8e2 100644 --- a/gamevault/AssemblyInfo.cs +++ b/gamevault/AssemblyInfo.cs @@ -11,7 +11,7 @@ //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] -[assembly: AssemblyVersion("1.11.0.0")] +[assembly: AssemblyVersion("1.11.1.0")] [assembly: AssemblyCopyright("© Phalcode™. All Rights Reserved.")] #if DEBUG [assembly: XmlnsDefinition("debug-mode", "Namespace")] diff --git a/gamevault/Helper/DesktopHelper.cs b/gamevault/Helper/DesktopHelper.cs index 987ff1d..0e5d555 100644 --- a/gamevault/Helper/DesktopHelper.cs +++ b/gamevault/Helper/DesktopHelper.cs @@ -55,5 +55,11 @@ public static void RemoveShotcut(Game game) } catch { } } + public static bool ShortcutExists(Game game) + { + string desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); + string shortcutPath = desktopDir + @"\\" + game.Title + ".url"; + return File.Exists(shortcutPath); + } } } diff --git a/gamevault/Helper/WpfEmbeddedBrowser.cs b/gamevault/Helper/WpfEmbeddedBrowser.cs index ea0e69a..8b7ccca 100644 --- a/gamevault/Helper/WpfEmbeddedBrowser.cs +++ b/gamevault/Helper/WpfEmbeddedBrowser.cs @@ -51,11 +51,14 @@ public async Task InvokeAsync(BrowserOptions options, Cancellatio { ResultType = BrowserResultType.UserCancel }; - + //signinWindow.Owner = App.Current.MainWindow; signinWindow.Closing += (s, e) => { - semaphoreSlim.Release(); + if (semaphoreSlim.CurrentCount == 0) // Ensure semaphore is not already released + { + semaphoreSlim.Release(); + } webView.Dispose(); }; @@ -72,7 +75,10 @@ public async Task InvokeAsync(BrowserOptions options, Cancellatio Response = new Uri(e.Uri).AbsoluteUri }; - semaphoreSlim.Release(); + if (semaphoreSlim.CurrentCount == 0) // Ensure semaphore is not already released + { + semaphoreSlim.Release(); + } signinWindow.Close(); } }; @@ -102,6 +108,7 @@ public async Task InvokeAsync(BrowserOptions options, Cancellatio return browserResult; } + public void ShowWindowIfHidden() { if (signinWindow.ShowInTaskbar == false) diff --git a/gamevault/Resources/Assets/Icons.xaml b/gamevault/Resources/Assets/Icons.xaml index 52598b0..6176a4a 100644 --- a/gamevault/Resources/Assets/Icons.xaml +++ b/gamevault/Resources/Assets/Icons.xaml @@ -141,5 +141,8 @@ M11.99 0A12 12 0 1 0 24 12v-.014A12 12 0 0 0 11.99 0m-.055 2.564a9.399 9.399 0 0 1 9.407 9.389v.01a9.399 9.399 0 1 1-9.408-9.399Zm-1.61 17.198l2.046-2.046l-3.94-3.94c-.165-.166-.345-.373-.442-.608c-.221-.47-.318-1.203.221-1.742c.664-.664 1.548-.387 2.406.47l3.788 3.788l2.046-2.046l-3.954-3.954a2.48 2.48 0 0 1-.456-.622c-.263-.539-.25-1.216.235-1.7c.677-.678 1.562-.429 2.544.553l3.677 3.677l2.046-2.046l-3.982-3.982c-2.018-2.018-3.912-1.949-5.212-.65c-.498.499-.802 1.024-.954 1.618a4.026 4.026 0 0 0-.055 1.686l-.027.028c-.996-.414-2.13-.166-3 .705c-1.162 1.161-1.12 2.392-.982 3.11l-.042.043l-1.009-.816l-1.77 1.77a64.1 64.1 0 0 1 2.213 2.1z - + + M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81c1.66 0 3-1.34 3-3s-1.34-3-3-3s-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65c0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92 + + \ No newline at end of file diff --git a/gamevault/UserControls/GameDownloadUserControl.xaml.cs b/gamevault/UserControls/GameDownloadUserControl.xaml.cs index 8bf1824..7b4cc4a 100644 --- a/gamevault/UserControls/GameDownloadUserControl.xaml.cs +++ b/gamevault/UserControls/GameDownloadUserControl.xaml.cs @@ -196,7 +196,7 @@ private async Task DownloadGame(bool tryResume = false) if (downloadRetryTimer.Data != "error") { if (!App.Instance.IsWindowActiveAndControlInFocus(MainControl.Downloads)) - ToastMessageHelper.CreateToastMessage("Download Failed", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage.ID}"); + ToastMessageHelper.CreateToastMessage("Download Failed", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage?.ID}"); } downloadRetryTimer.Start(); @@ -308,7 +308,7 @@ private void DownloadCompleted() MainWindowViewModel.Instance.Library.GetGameInstalls().AddSystemFileWatcher(ViewModel.InstallPath); if (!App.Instance.IsWindowActiveAndControlInFocus(MainControl.Downloads)) - ToastMessageHelper.CreateToastMessage("Download Complete", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage.ID}"); + ToastMessageHelper.CreateToastMessage("Download Complete", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage?.ID}"); if (SettingsViewModel.Instance.AutoExtract) { @@ -487,7 +487,7 @@ private async Task Extract() ViewModel.ExtractionUIVisibility = System.Windows.Visibility.Hidden; if (!App.Instance.IsWindowActiveAndControlInFocus(MainControl.Downloads)) - ToastMessageHelper.CreateToastMessage("Extraction Complete", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage.ID}"); + ToastMessageHelper.CreateToastMessage("Extraction Complete", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage?.ID}"); if (SettingsViewModel.Instance.AutoInstallPortable && (ViewModel.Game.Type == GameType.WINDOWS_PORTABLE || ViewModel.Game.Type == GameType.LINUX_PORTABLE)) { @@ -524,7 +524,7 @@ private async Task Extract() { ViewModel.State = "Something went wrong during extraction"; if (!App.Instance.IsWindowActiveAndControlInFocus(MainControl.Downloads)) - ToastMessageHelper.CreateToastMessage("Extraction Failed", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage.ID}"); + ToastMessageHelper.CreateToastMessage("Extraction Failed", ViewModel.Game.Title, $"{AppFilePath.ImageCache}/gbox/{ViewModel.Game.ID}.{ViewModel.Game.BoxImage?.ID}"); } ViewModel.ExtractionUIVisibility = System.Windows.Visibility.Hidden; } diff --git a/gamevault/UserControls/GameSettingsUserControl.xaml.cs b/gamevault/UserControls/GameSettingsUserControl.xaml.cs index 8a3306d..5ec773a 100644 --- a/gamevault/UserControls/GameSettingsUserControl.xaml.cs +++ b/gamevault/UserControls/GameSettingsUserControl.xaml.cs @@ -412,8 +412,11 @@ private void Executable_SelectionChanged(object sender, SelectionChangedEventArg if (Directory.Exists(ViewModel.Directory)) { Preferences.Set(AppConfigKey.Executable, SavedExecutable, $"{ViewModel.Directory}\\gamevault-exec"); - DesktopHelper.RemoveShotcut(ViewModel.Game); - DesktopHelper.CreateShortcut(ViewModel.Game, SavedExecutable, false); + if (e.RemovedItems.Count > 0 && DesktopHelper.ShortcutExists(ViewModel.Game)) + { + DesktopHelper.RemoveShotcut(ViewModel.Game); + DesktopHelper.CreateShortcut(ViewModel.Game, SavedExecutable, false); + } } } } diff --git a/gamevault/UserControls/GameViewUserControl.xaml b/gamevault/UserControls/GameViewUserControl.xaml index 85e7f3d..a41b0e2 100644 --- a/gamevault/UserControls/GameViewUserControl.xaml +++ b/gamevault/UserControls/GameViewUserControl.xaml @@ -155,6 +155,16 @@ + + + + + + + + + + diff --git a/gamevault/UserControls/GameViewUserControl.xaml.cs b/gamevault/UserControls/GameViewUserControl.xaml.cs index 8ee639a..f378b24 100644 --- a/gamevault/UserControls/GameViewUserControl.xaml.cs +++ b/gamevault/UserControls/GameViewUserControl.xaml.cs @@ -233,5 +233,16 @@ private void GameType_Clicked(object sender, RoutedEventArgs e) } catch { } } + + private void Share_Click(object sender, MouseButtonEventArgs e) + { + try + { + string shareLink = $"gamevault://show?gameid={ViewModel?.Game?.ID}"; + Clipboard.SetText(shareLink); + MainWindowViewModel.Instance.AppBarText = "Sharelink copied to clipboard"; + } + catch { } + } } }