Esempio n. 1
0
        public void RemoveKnownPackage(Hash packageId)
        {
            lock (syncLock)
            {
                if (!KnownPackages.ContainsKey(packageId))
                {
                    return;
                }
                KnownPackages = KnownPackages.Where(p => !p.Key.Equals(packageId)).ToDictionary(p => p.Key, p => p.Value);
            }

            KnownPackageChanged?.Invoke(this);
        }
Esempio n. 2
0
        public void ReplaceKnownPackages(PackageStatus[] newPackages)
        {
            bool changed = false;

            lock (syncLock)
            {
                if (newPackages.Length != KnownPackages.Count || !newPackages.All(k => KnownPackages.ContainsKey(k.Meta.PackageId)))
                {
                    KnownPackages = newPackages.ToDictionary(p => p.Meta.PackageId);
                    changed       = true;
                }
            }
            if (changed)
            {
                KnownPackageChanged?.Invoke(this);
            }
        }