From 15ab287078ffd3df54494cbf5d6108d59bcde931 Mon Sep 17 00:00:00 2001 From: Bolton Date: Mon, 27 May 2024 20:25:41 +0200 Subject: [PATCH] fix: loader can't find dependency --- Exiled.Loader/Updater.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Exiled.Loader/Updater.cs b/Exiled.Loader/Updater.cs index 7e6453eb7f..759ac88f56 100644 --- a/Exiled.Loader/Updater.cs +++ b/Exiled.Loader/Updater.cs @@ -113,8 +113,11 @@ internal static Updater Initialize(Config config) internal void CheckUpdate() { using HttpClient client = CreateHttpClient(); - if (Busy = FindUpdate(client, !File.Exists(Path.Combine(Paths.Dependencies, "Exiled.API.dll")), out NewVersion newVersion)) + if (FindUpdate(client, out NewVersion newVersion)) + { + Busy = true; Update(client, newVersion); + } } /// @@ -137,10 +140,9 @@ private HttpClient CreateHttpClient() /// Finds an update using the client. /// /// The HTTP Client. - /// Whether the detection was forced. /// Whether there is a new version of EXILED. /// Whether there is an update. - private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersion) + private bool FindUpdate(HttpClient client, out NewVersion newVersion) { try { @@ -149,7 +151,7 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio Log.Info($"Found the smallest version of Exiled - {smallestVersion.Library.GetName().Name}:{smallestVersion.Version}"); TaggedRelease[] releases = TagReleases(client.GetReleases(REPO_ID, new GetReleasesSettings(50, 1)).GetAwaiter().GetResult()); - if (FindRelease(releases, out Release targetRelease, smallestVersion, forced)) + if (FindRelease(releases, out Release targetRelease, smallestVersion)) { if (!FindAsset(InstallerName, targetRelease, out ReleaseAsset asset)) { @@ -289,9 +291,8 @@ private TaggedRelease[] TagReleases(Release[] releases) /// The list of releases (array). /// The most recent release of Exiled. /// Finds the smallest version of the Exiled Library. - /// Whether this update was forced or not. /// Whether the specific release was found. - private bool FindRelease(TaggedRelease[] releases, out Release release, ExiledLib smallestVersion, bool forced = false) + private bool FindRelease(TaggedRelease[] releases, out Release release, ExiledLib smallestVersion) { bool includePRE = config.ShouldDownloadTestingReleases || ExiledLib.Any(l => l.Version.PreRelease is not null); Version gameVersion = new(GameCore.Version.Major, GameCore.Version.Minor, GameCore.Version.Revision); @@ -302,7 +303,7 @@ private bool FindRelease(TaggedRelease[] releases, out Release release, ExiledLi if (!taggedRelease.Release.Description.Contains($"[Game Version: {gameVersion}]") || (taggedRelease.Release.PreRelease && !includePRE)) continue; - if (taggedRelease.Version > smallestVersion.Version || forced) + if (taggedRelease.Version > smallestVersion.Version) { release = taggedRelease.Release; return true;