Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Aug 8, 2024
1 parent 16932c3 commit f856483
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/OneWare.PackageManager/Services/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,30 @@ private async Task<bool> LoadPackageRepositoryAsync(string url, CancellationToke
if (repository is { Packages: not null })
foreach (var manifest in repository.Packages)
{
if (manifest.ManifestUrl == null) continue;
try
{
if (manifest.ManifestUrl == null) continue;

var downloadManifest =
await _httpService.DownloadTextAsync(manifest.ManifestUrl,
cancellationToken: cancellationToken);

var downloadManifest =
await _httpService.DownloadTextAsync(manifest.ManifestUrl,
cancellationToken: cancellationToken);
var package = JsonSerializer.Deserialize<Package>(downloadManifest!, SerializerOptions);

var package = JsonSerializer.Deserialize<Package>(downloadManifest!, SerializerOptions);
if (package == null) continue;

if (package == null) continue;
if (package.Id != null && Packages.TryGetValue(package.Id, out var pkg))
{
pkg.Package = package;
continue;
}

if (package.Id != null && Packages.TryGetValue(package.Id, out var pkg))
AddPackage(package);
}
catch (Exception e)
{
pkg.Package = package;
continue;
_logger.Error(e.Message, e);
}

AddPackage(package);
}
else throw new Exception("Packages empty");
}
Expand Down

0 comments on commit f856483

Please sign in to comment.