From 48e18b80dbdcab3eebc07d95bd0c059f15a09150 Mon Sep 17 00:00:00 2001 From: GamerVII-NET <111225722+GamerVII-NET@users.noreply.github.com> Date: Sun, 7 Jul 2024 05:10:09 +0300 Subject: [PATCH] Add method to get Forge versions for specific Minecraft version (#5) * Add method to get Forge versions for specific Minecraft version A new public method, `GetForgeVersions`, has been added to the `ForgeInstaller.cs` class. This method returns the available Forge versions for a specific Minecraft version, improving the process of version management and installation. * Disable ad display and update package references The ad display function `showAd()` in `ForgeInstaller.cs` has been commented out to disable showing of ads. In addition, a package reference for "CmlLib.Core" in `CmlLib.Core.Installer.Forge.csproj` was removed and a new project reference to "CmlLib.Core.csproj" was added. This change will ensure the use of the most recent and relevant references. * Revert "Disable ad display and update package references" This reverts commit 9040df87a6d1f25b37bf4718fcf77634110adc66. --- CmlLib.Core.Installer.Forge/ForgeInstaller.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CmlLib.Core.Installer.Forge/ForgeInstaller.cs b/CmlLib.Core.Installer.Forge/ForgeInstaller.cs index 7b5246a..50a480e 100644 --- a/CmlLib.Core.Installer.Forge/ForgeInstaller.cs +++ b/CmlLib.Core.Installer.Forge/ForgeInstaller.cs @@ -38,6 +38,11 @@ public async Task Install( return await Install(bestVersion, options); } + public Task> GetForgeVersions(string mcVersion) + { + return _versionLoader.GetForgeVersions(mcVersion); + } + public Task Install(string mcVersion, string forgeVersion) => Install(mcVersion, forgeVersion, new ForgeInstallOptions()); @@ -62,8 +67,8 @@ public async Task Install( return installer.VersionName; var version = await checkAndDownloadVanillaVersion( - forgeVersion.MinecraftVersionName, - options.FileProgress, + forgeVersion.MinecraftVersionName, + options.FileProgress, options.ByteProgress); if (string.IsNullOrEmpty(options.JavaPath)) @@ -105,6 +110,7 @@ private string getJavaPath(IVersion version) javaPath = _launcher.GetDefaultJavaPath(); if (string.IsNullOrEmpty(javaPath) || !File.Exists(javaPath)) throw new InvalidOperationException("Cannot find any java binary. Set java binary path"); + return javaPath; }