From 26577eea61b1a6032fd0bf39e2eaab46f60ec941 Mon Sep 17 00:00:00 2001 From: FriendlyFire Date: Sat, 22 Apr 2023 11:36:32 -0400 Subject: [PATCH] Added reinstall loader button and updated for latest addon loader. --- .../Backend/LoaderSetup/LoaderSetup.cs | 21 ++++++++++++------- .../Backend/Updating/UpdateHelpers.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../UI/OpeningPage/OpeningView.xaml | 15 ++++++++++++- .../UI/OpeningPage/OpeningView.xaml.cs | 17 +++++++++++++++ .../Localization/StaticText.Designer.cs | 11 +++++++++- application/Localization/StaticText.resx | 3 +++ 7 files changed, 59 insertions(+), 12 deletions(-) diff --git a/application/GW2 Addon Manager/Backend/LoaderSetup/LoaderSetup.cs b/application/GW2 Addon Manager/Backend/LoaderSetup/LoaderSetup.cs index 6434957..e292fc0 100644 --- a/application/GW2 Addon Manager/Backend/LoaderSetup/LoaderSetup.cs +++ b/application/GW2 Addon Manager/Backend/LoaderSetup/LoaderSetup.cs @@ -1,6 +1,8 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.IO; using System.IO.Compression; +using System.Linq; using System.Net; using System.Threading.Tasks; using GW2_Addon_Manager.App.Configuration; @@ -17,7 +19,7 @@ class LoaderSetup UpdatingViewModel viewModel; string fileName; string latestLoaderVersion; - string loader_dxgi_destination; + string[] loader_dxgi_destination; string loader_d3d11_destination; string loader_self_destination; @@ -36,18 +38,20 @@ public LoaderSetup(IConfigurationManager configurationManager) /// Checks for update to addon loader and downloads if a new release is available /// /// - public async Task HandleLoaderUpdate() + public async Task HandleLoaderUpdate(bool force) { dynamic releaseInfo = UpdateHelpers.GitReleaseInfo(loader_git_url); loader_d3d11_destination = Path.Combine(loader_game_path, "d3d11.dll"); - loader_dxgi_destination = Path.Combine(loader_game_path, "bin64/cef/dxgi.dll"); + loader_dxgi_destination = new string[] { Path.Combine(loader_game_path, "bin64/cef/dxgi.dll"), + Path.Combine(loader_game_path, "bin64/dxgi.dll"), + Path.Combine(loader_game_path, "dxgi.dll") }; loader_self_destination = Path.Combine(loader_game_path, "addonLoader.dll"); latestLoaderVersion = releaseInfo.tag_name; - if (File.Exists(loader_d3d11_destination) && - File.Exists(loader_dxgi_destination) && + if (!force && File.Exists(loader_d3d11_destination) && + loader_dxgi_destination.All(File.Exists) && File.Exists(loader_self_destination) && _configurationManager.UserConfig.LoaderVersion == latestLoaderVersion) return; @@ -80,8 +84,9 @@ private void Install() if (File.Exists(loader_d3d11_destination)) File.Delete(loader_d3d11_destination); - if (File.Exists(loader_dxgi_destination)) - File.Delete(loader_dxgi_destination); + foreach (var x in loader_dxgi_destination) + if (File.Exists(x)) + File.Delete(x); if (File.Exists(loader_self_destination)) File.Delete(loader_self_destination); diff --git a/application/GW2 Addon Manager/Backend/Updating/UpdateHelpers.cs b/application/GW2 Addon Manager/Backend/Updating/UpdateHelpers.cs index bfa54c7..3c6ee7e 100644 --- a/application/GW2 Addon Manager/Backend/Updating/UpdateHelpers.cs +++ b/application/GW2 Addon Manager/Backend/Updating/UpdateHelpers.cs @@ -55,7 +55,7 @@ public static async void UpdateAll() UpdatingViewModel viewModel = UpdatingViewModel.GetInstance; LoaderSetup settingUp = new LoaderSetup(new ConfigurationManager()); - await settingUp.HandleLoaderUpdate(); + await settingUp.HandleLoaderUpdate((bool)Application.Current.Properties["ForceLoader"]); List addons = (List)Application.Current.Properties["Selected"]; diff --git a/application/GW2 Addon Manager/Properties/AssemblyInfo.cs b/application/GW2 Addon Manager/Properties/AssemblyInfo.cs index 983ffeb..bf799cd 100644 --- a/application/GW2 Addon Manager/Properties/AssemblyInfo.cs +++ b/application/GW2 Addon Manager/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.4.0")] +[assembly: AssemblyVersion("1.4.5.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/application/GW2 Addon Manager/UI/OpeningPage/OpeningView.xaml b/application/GW2 Addon Manager/UI/OpeningPage/OpeningView.xaml index f7fadce..c0c336e 100644 --- a/application/GW2 Addon Manager/UI/OpeningPage/OpeningView.xaml +++ b/application/GW2 Addon Manager/UI/OpeningPage/OpeningView.xaml @@ -284,7 +284,7 @@ /> - + @@ -338,6 +338,19 @@ BorderBrush="#FFC9C9C9" Style="{StaticResource BigContentButton}" FontWeight="Bold" /> +