Skip to content

Commit

Permalink
Update QuiltInstaller.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Jul 16, 2023
1 parent 45129cc commit a56529d
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -28,14 +29,14 @@ public string Install()

public async Task<string> InstallTaskAsync()
{
if (string.IsNullOrEmpty(InheritsFrom))
throw new NullReferenceException("InheritsFrom 不能为 null");
if (string.IsNullOrEmpty(MineCraftVersion))
throw new NullReferenceException("MineCraftVersion 不能为 null");
if (string.IsNullOrEmpty(RootPath))
throw new NullReferenceException("RootPath 不能为 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);
Expand Down Expand Up @@ -69,8 +70,10 @@ public async Task<string> InstallTaskAsync()

if (!string.IsNullOrEmpty(CustomId))
versionModel.Id = CustomId;
if(!string.IsNullOrEmpty(InheritsFrom))
versionModel.InheritsFrom = InheritsFrom;

var id = versionModel.Id;
var id = versionModel.Id!;
var installPath = Path.Combine(RootPath, GamePathHelper.GetGamePath(id));
var di = new DirectoryInfo(installPath);

Expand Down

0 comments on commit a56529d

Please sign in to comment.