fabric loader descriptors support

This commit is contained in:
2025-01-02 18:42:19 +05:00
parent 679d89b4b0
commit 23ec6dd194
5 changed files with 41 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ public class LibrariesDownloadTaskFactory : INetworkTaskFactory
foreach (var l in _libraries.Libs)
{
if (!HashHelper.CheckFileSHA1(l.jarFilePath, l.artifact.sha1, checkHashes))
if (!HashHelper.CheckFileSHA1(l.jarFilePath, l.artifact?.sha1, checkHashes))
{
_libsToDownload.Add(l);
}
@@ -60,7 +60,7 @@ public class LibrariesDownloadTaskFactory : INetworkTaskFactory
{
long total = 0;
foreach (var l in _libsToDownload)
total += l.artifact.size;
total += l.artifact?.size ?? 0;
return total;
}
@@ -76,7 +76,7 @@ public class LibrariesDownloadTaskFactory : INetworkTaskFactory
await Parallel.ForEachAsync(_libsToDownload, opt, async (l, _ct) =>
{
LauncherApp.Logger.LogDebug(nameof(NetworkHelper), $"downloading library '{l.name}' to '{l.jarFilePath}'");
if(string.IsNullOrEmpty(l.artifact.url))
if(string.IsNullOrEmpty(l.artifact?.url))
throw new Exception($"library '{l.name}' doesn't have a url to download");
await DownloadFile(l.artifact.url, l.jarFilePath, _ct, pr.AddBytesCount);
if (l is Libraries.NativeLib n)