From 730ba44043ea352fa53fe38dfe500cadd71ff2bd Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Wed, 6 Nov 2024 18:23:21 -0600 Subject: [PATCH] misc: Canary-specific naming & other small changes I had that I need to push. --- src/Ryujinx/App.axaml.cs | 6 +- .../Common/Markup/BasicMarkupExtension.cs | 37 ++- src/Ryujinx/Common/Markup/MarkupExtensions.cs | 45 +-- src/Ryujinx/Input/AvaloniaKeyboard.cs | 14 +- src/Ryujinx/UI/Applet/AvaHostUIHandler.cs | 6 +- .../UI/Views/Input/KeyboardInputView.axaml.cs | 260 +++++++++--------- .../UI/Views/Main/MainMenuBarView.axaml | 4 +- .../UI/Views/Main/MainMenuBarView.axaml.cs | 8 +- .../UserProfileImageSelectorView.axaml.cs | 3 +- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 31 +-- src/Ryujinx/Updater.cs | 15 +- 11 files changed, 200 insertions(+), 229 deletions(-) diff --git a/src/Ryujinx/App.axaml.cs b/src/Ryujinx/App.axaml.cs index 509deb34c..15ada201c 100644 --- a/src/Ryujinx/App.axaml.cs +++ b/src/Ryujinx/App.axaml.cs @@ -23,8 +23,10 @@ namespace Ryujinx.Ava { internal static string FormatTitle(LocaleKeys? windowTitleKey = null) => windowTitleKey is null - ? $"Ryujinx {Program.Version}" - : $"Ryujinx {Program.Version} - {LocaleManager.Instance[windowTitleKey.Value]}"; + ? $"{FullAppName} {Program.Version}" + : $"{FullAppName} {Program.Version} - {LocaleManager.Instance[windowTitleKey.Value]}"; + + public static readonly string FullAppName = ReleaseInformation.IsCanaryBuild ? "Ryujinx Canary" : "Ryujinx"; public static MainWindow MainWindow => Current! .ApplicationLifetime.Cast() diff --git a/src/Ryujinx/Common/Markup/BasicMarkupExtension.cs b/src/Ryujinx/Common/Markup/BasicMarkupExtension.cs index 73b298bc7..67c016562 100644 --- a/src/Ryujinx/Common/Markup/BasicMarkupExtension.cs +++ b/src/Ryujinx/Common/Markup/BasicMarkupExtension.cs @@ -2,19 +2,38 @@ using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml.MarkupExtensions; using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings; +using Gommon; using System; +// ReSharper disable VirtualMemberNeverOverridden.Global +// ReSharper disable MemberCanBeProtected.Global +// ReSharper disable MemberCanBePrivate.Global + +#nullable enable namespace Ryujinx.Ava.Common.Markup { - internal abstract class BasicMarkupExtension : MarkupExtension + internal abstract class BasicMarkupExtension : MarkupExtension { - protected abstract ClrPropertyInfo PropertyInfo { get; } - - public override object ProvideValue(IServiceProvider serviceProvider) => - new CompiledBindingExtension( - new CompiledBindingPathBuilder() - .Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor) - .Build() - ).ProvideValue(serviceProvider); + public virtual string Name => "Item"; + public virtual Action? Setter => null; + + protected abstract T? GetValue(); + + protected virtual void ConfigureBindingExtension(CompiledBindingExtension _) { } + + private ClrPropertyInfo PropertyInfo => + new(Name, + _ => GetValue(), + Setter as Action, + typeof(T)); + + public override object ProvideValue(IServiceProvider serviceProvider) + => new CompiledBindingExtension( + new CompiledBindingPathBuilder() + .Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor) + .Build() + ) + .Apply(ConfigureBindingExtension) + .ProvideValue(serviceProvider); } } diff --git a/src/Ryujinx/Common/Markup/MarkupExtensions.cs b/src/Ryujinx/Common/Markup/MarkupExtensions.cs index af917b973..a804792c7 100644 --- a/src/Ryujinx/Common/Markup/MarkupExtensions.cs +++ b/src/Ryujinx/Common/Markup/MarkupExtensions.cs @@ -1,51 +1,24 @@ -using Avalonia.Data.Core; -using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml.MarkupExtensions; -using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings; using Projektanker.Icons.Avalonia; using Ryujinx.Ava.Common.Locale; -using System; namespace Ryujinx.Ava.Common.Markup { - internal class IconExtension(string iconString) : BasicMarkupExtension + internal class IconExtension(string iconString) : BasicMarkupExtension { - protected override ClrPropertyInfo PropertyInfo - => new( - "Item", - _ => new Icon { Value = iconString }, - null, - typeof(Icon) - ); + protected override Icon GetValue() => new() { Value = iconString }; } - internal class SpinningIconExtension(string iconString) : BasicMarkupExtension + internal class SpinningIconExtension(string iconString) : BasicMarkupExtension { - protected override ClrPropertyInfo PropertyInfo - => new( - "Item", - _ => new Icon { Value = iconString, Animation = IconAnimation.Spin }, - null, - typeof(Icon) - ); + protected override Icon GetValue() => new() { Value = iconString, Animation = IconAnimation.Spin }; } - internal class LocaleExtension(LocaleKeys key) : MarkupExtension + internal class LocaleExtension(LocaleKeys key) : BasicMarkupExtension { - private ClrPropertyInfo PropertyInfo - => new( - "Item", - _ => LocaleManager.Instance[key], - null, - typeof(string) - ); - - public override object ProvideValue(IServiceProvider serviceProvider) => - new CompiledBindingExtension( - new CompiledBindingPathBuilder() - .Property(PropertyInfo, PropertyInfoAccessorFactory.CreateInpcPropertyAccessor) - .Build() - ) { Source = LocaleManager.Instance } - .ProvideValue(serviceProvider); + protected override string GetValue() => LocaleManager.Instance[key]; + + protected override void ConfigureBindingExtension(CompiledBindingExtension bindingExtension) + => bindingExtension.Source = LocaleManager.Instance; } } diff --git a/src/Ryujinx/Input/AvaloniaKeyboard.cs b/src/Ryujinx/Input/AvaloniaKeyboard.cs index ff88de79e..95d2936f6 100644 --- a/src/Ryujinx/Input/AvaloniaKeyboard.cs +++ b/src/Ryujinx/Input/AvaloniaKeyboard.cs @@ -23,21 +23,15 @@ namespace Ryujinx.Ava.Input public bool IsConnected => true; public GamepadFeaturesFlag Features => GamepadFeaturesFlag.None; - private class ButtonMappingEntry + private class ButtonMappingEntry(GamepadButtonInputId to, Key from) { - public readonly Key From; - public readonly GamepadButtonInputId To; - - public ButtonMappingEntry(GamepadButtonInputId to, Key from) - { - To = to; - From = from; - } + public readonly GamepadButtonInputId To = to; + public readonly Key From = from; } public AvaloniaKeyboard(AvaloniaKeyboardDriver driver, string id, string name) { - _buttonsUserMapping = new List(); + _buttonsUserMapping = []; _driver = driver; Id = id; diff --git a/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs b/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs index f09460b1f..1dbf37255 100644 --- a/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs +++ b/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs @@ -127,11 +127,11 @@ namespace Ryujinx.Ava.UI.Applet try { _parent.ViewModel.AppHost.NpadManager.BlockInputUpdates(); - var response = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard], args); + (UserResult result, string userInput) = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard], args); - if (response.Result == UserResult.Ok) + if (result == UserResult.Ok) { - inputText = response.Input; + inputText = userInput; okPressed = true; } } diff --git a/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs index f17c7496c..090d0335c 100644 --- a/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs @@ -33,7 +33,7 @@ namespace Ryujinx.Ava.UI.Views.Input { base.OnPointerReleased(e); - if (_currentAssigner != null && _currentAssigner.ToggledButton != null && !_currentAssigner.ToggledButton.IsPointerOver) + if (_currentAssigner is { ToggledButton.IsPointerOver: false }) { _currentAssigner.Cancel(); } @@ -41,143 +41,146 @@ namespace Ryujinx.Ava.UI.Views.Input private void Button_IsCheckedChanged(object sender, RoutedEventArgs e) { - if (sender is ToggleButton button) + if (sender is not ToggleButton button) + return; + + if (button.IsChecked is true) { - if ((bool)button.IsChecked) + if (_currentAssigner != null && button == _currentAssigner.ToggledButton) { - if (_currentAssigner != null && button == _currentAssigner.ToggledButton) - { + return; + } + + if (_currentAssigner == null) + { + _currentAssigner = new ButtonKeyAssigner(button); + + Focus(NavigationMethod.Pointer); + + PointerPressed += MouseClick; + + if (DataContext is not KeyboardInputViewModel viewModel) return; - } - if (_currentAssigner == null) + IKeyboard keyboard = + (IKeyboard)viewModel.ParentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations. + IButtonAssigner assigner = + new KeyboardKeyAssigner((IKeyboard)viewModel.ParentModel.SelectedGamepad); + + _currentAssigner.ButtonAssigned += (_, e) => { - _currentAssigner = new ButtonKeyAssigner(button); - - Focus(NavigationMethod.Pointer); - - PointerPressed += MouseClick; - - var viewModel = (DataContext as KeyboardInputViewModel); - - IKeyboard keyboard = (IKeyboard)viewModel.ParentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations. - IButtonAssigner assigner = CreateButtonAssigner(); - - _currentAssigner.ButtonAssigned += (sender, e) => + if (e.ButtonValue.HasValue) { - if (e.ButtonValue.HasValue) + var buttonValue = e.ButtonValue.Value; + viewModel.ParentModel.IsModified = true; + + switch (button.Name) { - var buttonValue = e.ButtonValue.Value; - viewModel.ParentModel.IsModified = true; - - switch (button.Name) - { - case "ButtonZl": - viewModel.Config.ButtonZl = buttonValue.AsHidType(); - break; - case "ButtonL": - viewModel.Config.ButtonL = buttonValue.AsHidType(); - break; - case "ButtonMinus": - viewModel.Config.ButtonMinus = buttonValue.AsHidType(); - break; - case "LeftStickButton": - viewModel.Config.LeftStickButton = buttonValue.AsHidType(); - break; - case "LeftStickUp": - viewModel.Config.LeftStickUp = buttonValue.AsHidType(); - break; - case "LeftStickDown": - viewModel.Config.LeftStickDown = buttonValue.AsHidType(); - break; - case "LeftStickRight": - viewModel.Config.LeftStickRight = buttonValue.AsHidType(); - break; - case "LeftStickLeft": - viewModel.Config.LeftStickLeft = buttonValue.AsHidType(); - break; - case "DpadUp": - viewModel.Config.DpadUp = buttonValue.AsHidType(); - break; - case "DpadDown": - viewModel.Config.DpadDown = buttonValue.AsHidType(); - break; - case "DpadLeft": - viewModel.Config.DpadLeft = buttonValue.AsHidType(); - break; - case "DpadRight": - viewModel.Config.DpadRight = buttonValue.AsHidType(); - break; - case "LeftButtonSr": - viewModel.Config.LeftButtonSr = buttonValue.AsHidType(); - break; - case "LeftButtonSl": - viewModel.Config.LeftButtonSl = buttonValue.AsHidType(); - break; - case "RightButtonSr": - viewModel.Config.RightButtonSr = buttonValue.AsHidType(); - break; - case "RightButtonSl": - viewModel.Config.RightButtonSl = buttonValue.AsHidType(); - break; - case "ButtonZr": - viewModel.Config.ButtonZr = buttonValue.AsHidType(); - break; - case "ButtonR": - viewModel.Config.ButtonR = buttonValue.AsHidType(); - break; - case "ButtonPlus": - viewModel.Config.ButtonPlus = buttonValue.AsHidType(); - break; - case "ButtonA": - viewModel.Config.ButtonA = buttonValue.AsHidType(); - break; - case "ButtonB": - viewModel.Config.ButtonB = buttonValue.AsHidType(); - break; - case "ButtonX": - viewModel.Config.ButtonX = buttonValue.AsHidType(); - break; - case "ButtonY": - viewModel.Config.ButtonY = buttonValue.AsHidType(); - break; - case "RightStickButton": - viewModel.Config.RightStickButton = buttonValue.AsHidType(); - break; - case "RightStickUp": - viewModel.Config.RightStickUp = buttonValue.AsHidType(); - break; - case "RightStickDown": - viewModel.Config.RightStickDown = buttonValue.AsHidType(); - break; - case "RightStickRight": - viewModel.Config.RightStickRight = buttonValue.AsHidType(); - break; - case "RightStickLeft": - viewModel.Config.RightStickLeft = buttonValue.AsHidType(); - break; - } + case "ButtonZl": + viewModel.Config.ButtonZl = buttonValue.AsHidType(); + break; + case "ButtonL": + viewModel.Config.ButtonL = buttonValue.AsHidType(); + break; + case "ButtonMinus": + viewModel.Config.ButtonMinus = buttonValue.AsHidType(); + break; + case "LeftStickButton": + viewModel.Config.LeftStickButton = buttonValue.AsHidType(); + break; + case "LeftStickUp": + viewModel.Config.LeftStickUp = buttonValue.AsHidType(); + break; + case "LeftStickDown": + viewModel.Config.LeftStickDown = buttonValue.AsHidType(); + break; + case "LeftStickRight": + viewModel.Config.LeftStickRight = buttonValue.AsHidType(); + break; + case "LeftStickLeft": + viewModel.Config.LeftStickLeft = buttonValue.AsHidType(); + break; + case "DpadUp": + viewModel.Config.DpadUp = buttonValue.AsHidType(); + break; + case "DpadDown": + viewModel.Config.DpadDown = buttonValue.AsHidType(); + break; + case "DpadLeft": + viewModel.Config.DpadLeft = buttonValue.AsHidType(); + break; + case "DpadRight": + viewModel.Config.DpadRight = buttonValue.AsHidType(); + break; + case "LeftButtonSr": + viewModel.Config.LeftButtonSr = buttonValue.AsHidType(); + break; + case "LeftButtonSl": + viewModel.Config.LeftButtonSl = buttonValue.AsHidType(); + break; + case "RightButtonSr": + viewModel.Config.RightButtonSr = buttonValue.AsHidType(); + break; + case "RightButtonSl": + viewModel.Config.RightButtonSl = buttonValue.AsHidType(); + break; + case "ButtonZr": + viewModel.Config.ButtonZr = buttonValue.AsHidType(); + break; + case "ButtonR": + viewModel.Config.ButtonR = buttonValue.AsHidType(); + break; + case "ButtonPlus": + viewModel.Config.ButtonPlus = buttonValue.AsHidType(); + break; + case "ButtonA": + viewModel.Config.ButtonA = buttonValue.AsHidType(); + break; + case "ButtonB": + viewModel.Config.ButtonB = buttonValue.AsHidType(); + break; + case "ButtonX": + viewModel.Config.ButtonX = buttonValue.AsHidType(); + break; + case "ButtonY": + viewModel.Config.ButtonY = buttonValue.AsHidType(); + break; + case "RightStickButton": + viewModel.Config.RightStickButton = buttonValue.AsHidType(); + break; + case "RightStickUp": + viewModel.Config.RightStickUp = buttonValue.AsHidType(); + break; + case "RightStickDown": + viewModel.Config.RightStickDown = buttonValue.AsHidType(); + break; + case "RightStickRight": + viewModel.Config.RightStickRight = buttonValue.AsHidType(); + break; + case "RightStickLeft": + viewModel.Config.RightStickLeft = buttonValue.AsHidType(); + break; } - }; - - _currentAssigner.GetInputAndAssign(assigner, keyboard); - } - else - { - if (_currentAssigner != null) - { - _currentAssigner.Cancel(); - _currentAssigner = null; - button.IsChecked = false; } - } + }; + + _currentAssigner.GetInputAndAssign(assigner, keyboard); } else { - _currentAssigner?.Cancel(); - _currentAssigner = null; + if (_currentAssigner != null) + { + _currentAssigner.Cancel(); + _currentAssigner = null; + button.IsChecked = false; + } } } + else + { + _currentAssigner?.Cancel(); + _currentAssigner = null; + } } private void MouseClick(object sender, PointerPressedEventArgs e) @@ -189,15 +192,6 @@ namespace Ryujinx.Ava.UI.Views.Input PointerPressed -= MouseClick; } - private IButtonAssigner CreateButtonAssigner() - { - IButtonAssigner assigner; - - assigner = new KeyboardKeyAssigner((IKeyboard)(DataContext as KeyboardInputViewModel).ParentModel.SelectedGamepad); - - return assigner; - } - protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { base.OnDetachedFromVisualTree(e); diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml index 31dda8873..03b7cfbe4 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml @@ -273,8 +273,8 @@ - - + + diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs index 88b9bb980..1acee3af5 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs @@ -184,8 +184,10 @@ namespace Ryujinx.Ava.UI.Views.Main if (sender is not MenuItem { Tag: string resolution }) return; - (int height, int width) = resolution.Split(' ') - .Into(parts => (int.Parse(parts[0]), int.Parse(parts[1]))); + (int width, int height) = resolution.Split(' ', 2) + .Into(parts => + (int.Parse(parts[0]), int.Parse(parts[1])) + ); await Dispatcher.UIThread.InvokeAsync(() => { @@ -200,7 +202,7 @@ namespace Ryujinx.Ava.UI.Views.Main public async void CheckForUpdates(object sender, RoutedEventArgs e) { if (Updater.CanUpdate(true)) - await Updater.BeginParse(Window, true); + await Window.BeginUpdateAsync(true); } public async void OpenXCITrimmerWindow(object sender, RoutedEventArgs e) => await XCITrimmerWindow.Show(ViewModel); diff --git a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs index b4f23b5b8..dba762972 100644 --- a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs @@ -63,8 +63,7 @@ namespace Ryujinx.Ava.UI.Views.User private async void Import_OnClick(object sender, RoutedEventArgs e) { - var window = this.GetVisualRoot() as Window; - var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + var result = await ((Window)this.GetVisualRoot()!).StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = false, FileTypeFilter = new List diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 8a6be3c81..24a1b62a2 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -28,6 +28,7 @@ using Ryujinx.UI.Common.Configuration; using Ryujinx.UI.Common.Helper; using System; using System.Collections.Generic; +using System.Linq; using System.Reactive.Linq; using System.Runtime.Versioning; using System.Threading; @@ -349,12 +350,12 @@ namespace Ryujinx.Ava.UI.Windows await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys)); } - if (ConfigurationState.Instance.CheckUpdatesOnStart && Updater.CanUpdate(false)) + if (ConfigurationState.Instance.CheckUpdatesOnStart && Updater.CanUpdate()) { - await Updater.BeginParse(this, false).ContinueWith(task => - { - Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"); - }, TaskContinuationOptions.OnlyOnFaulted); + await this.BeginUpdateAsync() + .ContinueWith( + task => Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}"), + TaskContinuationOptions.OnlyOnFaulted); } } @@ -392,30 +393,17 @@ namespace Ryujinx.Ava.UI.Windows ViewModel.WindowState = ConfigurationState.Instance.UI.WindowStartup.WindowMaximized.Value ? WindowState.Maximized : WindowState.Normal; - if (CheckScreenBounds(savedPoint)) + if (Screens.All.Any(screen => screen.Bounds.Contains(savedPoint))) { Position = savedPoint; } else { + Logger.Warning?.Print(LogClass.Application, "Failed to find valid start-up coordinates. Defaulting to primary monitor center."); WindowStartupLocation = WindowStartupLocation.CenterScreen; } } - private bool CheckScreenBounds(PixelPoint configPoint) - { - for (int i = 0; i < Screens.ScreenCount; i++) - { - if (Screens.All[i].Bounds.Contains(configPoint)) - { - return true; - } - } - - Logger.Warning?.Print(LogClass.Application, "Failed to find valid start-up coordinates. Defaulting to primary monitor center."); - return false; - } - private void SaveWindowSizePosition() { ConfigurationState.Instance.UI.WindowStartup.WindowMaximized.Value = WindowState == WindowState.Maximized; @@ -507,8 +495,7 @@ namespace Ryujinx.Ava.UI.Windows private void VolumeStatus_CheckedChanged(object sender, RoutedEventArgs e) { - var volumeSplitButton = sender as ToggleSplitButton; - if (ViewModel.IsGameRunning) + if (ViewModel.IsGameRunning && sender is ToggleSplitButton volumeSplitButton) { if (!volumeSplitButton.IsChecked) { diff --git a/src/Ryujinx/Updater.cs b/src/Ryujinx/Updater.cs index e8ef02052..7005fe528 100644 --- a/src/Ryujinx/Updater.cs +++ b/src/Ryujinx/Updater.cs @@ -32,6 +32,8 @@ namespace Ryujinx.Ava internal static class Updater { private const string GitHubApiUrl = "https://api.github.com"; + private const string LatestReleaseUrl = $"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest"; + private static readonly GithubReleasesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions()); private static readonly string _homeDir = AppDomain.CurrentDomain.BaseDirectory; @@ -46,9 +48,9 @@ namespace Ryujinx.Ava private static bool _updateSuccessful; private static bool _running; - private static readonly string[] _windowsDependencyDirs = Array.Empty(); + private static readonly string[] _windowsDependencyDirs = []; - public static async Task BeginParse(Window mainWindow, bool showVersionUpToDate) + public static async Task BeginUpdateAsync(this Window mainWindow, bool showVersionUpToDate = false) { if (_running) { @@ -96,9 +98,8 @@ namespace Ryujinx.Ava try { using HttpClient jsonClient = ConstructHttpClient(); - - string buildInfoUrl = $"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest"; - string fetchedJson = await jsonClient.GetStringAsync(buildInfoUrl); + + string fetchedJson = await jsonClient.GetStringAsync(LatestReleaseUrl); var fetched = JsonHelper.Deserialize(fetchedJson, _serializerContext.GithubReleasesJsonResponse); _buildVer = fetched.Name; @@ -159,7 +160,7 @@ namespace Ryujinx.Ava } catch { - Logger.Error?.Print(LogClass.Application, "Failed to convert the received Ryujinx version from Github!"); + Logger.Error?.Print(LogClass.Application, $"Failed to convert the received {App.FullAppName} version from GitHub!"); await ContentDialogHelper.CreateWarningDialog( LocaleManager.Instance[LocaleKeys.DialogUpdaterConvertFailedGithubMessage], @@ -636,7 +637,7 @@ namespace Ryujinx.Ava taskDialog.Hide(); } - public static bool CanUpdate(bool showWarnings) + public static bool CanUpdate(bool showWarnings = false) { #if !DISABLE_UPDATER if (!NetworkInterface.GetIsNetworkAvailable())