From 2c6cc2e208cc6d44f6a21390dcde540627e0d00a Mon Sep 17 00:00:00 2001 From: imJack6 <3486688394@qq.com> Date: Thu, 13 Jul 2023 15:46:08 +0800 Subject: [PATCH 1/2] Quilt requires Minecraft version --- .../ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs | 5 ++++- ProjBobcat/ProjBobcat/Interface/IQuiltInstaller.cs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs index 16ec0da1..ff97c8b5 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs @@ -20,6 +20,7 @@ public class QuiltInstaller : InstallerBase, IQuiltInstaller static HttpClient Client => HttpClientHelper.DefaultClient; public QuiltLoaderModel LoaderArtifact { get; set; } + public string MineCraftVersion { get; set; } public string Install() { @@ -32,10 +33,12 @@ public async Task InstallTaskAsync() throw new NullReferenceException("InheritsFrom 不能为 null"); if (string.IsNullOrEmpty(RootPath)) throw new NullReferenceException("RootPath 不能为 null"); + if (string.IsNullOrEmpty(MineCraftVersion)) + throw new NullReferenceException("MineCraftVersion 不能为 null"); InvokeStatusChangedEvent("开始安装", 0); - var url = $"{DefaultMetaUrl}/v3/versions/loader/{InheritsFrom}/{LoaderArtifact.Version}/profile/json"; + var url = $"{DefaultMetaUrl}/v3/versions/loader/{MineCraftVersion}/{LoaderArtifact.Version}/profile/json"; using var req = new HttpRequestMessage(HttpMethod.Get, url); using var res = await Client.SendAsync(req); diff --git a/ProjBobcat/ProjBobcat/Interface/IQuiltInstaller.cs b/ProjBobcat/ProjBobcat/Interface/IQuiltInstaller.cs index 1e7a59e6..04e7ded5 100644 --- a/ProjBobcat/ProjBobcat/Interface/IQuiltInstaller.cs +++ b/ProjBobcat/ProjBobcat/Interface/IQuiltInstaller.cs @@ -6,6 +6,7 @@ namespace ProjBobcat.Interface; public interface IQuiltInstaller : IInstaller { QuiltLoaderModel LoaderArtifact { get; set; } + string MineCraftVersion { get; set; } string Install(); Task InstallTaskAsync(); } \ No newline at end of file From b906dc3014d0c53b3df303fc0db9a42af76e073b Mon Sep 17 00:00:00 2001 From: imJack6 <3486688394@qq.com> Date: Fri, 14 Jul 2023 17:12:10 +0800 Subject: [PATCH 2/2] Change inappropriate naming InheritsFrom --- .../ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs index ff97c8b5..e2739b1d 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Installer/QuiltInstaller.cs @@ -29,12 +29,10 @@ public string Install() public async Task InstallTaskAsync() { - if (string.IsNullOrEmpty(InheritsFrom)) - throw new NullReferenceException("InheritsFrom 不能为 null"); - if (string.IsNullOrEmpty(RootPath)) - throw new NullReferenceException("RootPath 不能为 null"); if (string.IsNullOrEmpty(MineCraftVersion)) throw new NullReferenceException("MineCraftVersion 不能为 null"); + if (string.IsNullOrEmpty(RootPath)) + throw new NullReferenceException("RootPath 不能为 null"); InvokeStatusChangedEvent("开始安装", 0);