public async Task GetDependencies(HashSet <int> dependecies, HashSet <int> returnDependencies)
        {
            foreach (int depPackageId in dependecies)
            {
                if (!returnDependencies.Contains(depPackageId) && !InstalledPackages.Any(x => x.PackageId == depPackageId))
                {
                    Package dependencyPackage = CachedPackages.FirstOrDefault(x => x.PackageId == depPackageId);
                    if (dependencyPackage == default)
                    {
                        dependencyPackage = await WebWrapper.GetPackage(depPackageId);

                        lock (CachedPackages)
                        {
                            CachedPackages.Add(dependencyPackage);
                        }
                    }

                    if (!dependencyPackage.IsPaid)
                    {
                        returnDependencies.Add(depPackageId);
                    }

                    await GetDependencies(dependencyPackage.Dependencies.ToHashSet(), returnDependencies);
                }
            }
        }
Exemple #2
0
 protected override bool CanDowngrade()
 {
     return(InstalledPackages.Any(i =>
                                  StringComparer.OrdinalIgnoreCase.Equals(i.Id, Id) &&
                                  i.Version > _allPackages.Min()));
 }
 public bool IsEmpty() => InstalledPackages == null || !InstalledPackages.Any();