Ejemplo n.º 1
0
 private static void UpdateLatestDictionary(
     ConcurrentDictionary <string, ServerPackage> dictionary,
     ServerPackage package)
 {
     dictionary.AddOrUpdate(
         package.Id,
         package,
         (oldId, oldEntry) => oldEntry.Version < package.Version ? package : oldEntry);
 }
Ejemplo n.º 2
0
        private ServerPackage CreateServerPackage(
            IPackage package,
            bool enableDelisting)
        {
            var packageDerivedData = GetPackageDerivedData(package, enableDelisting);

            var serverPackage = new ServerPackage(
                package,
                packageDerivedData);

            return(serverPackage);
        }
Ejemplo n.º 3
0
        public void Add(ServerPackage entity)
        {
            _syncLock.EnterWriteLock();
            try
            {
                _packages.Remove(entity);
                _packages.Add(entity);

                UpdateLatestVersions(_packages.Where(p => IsMatch(p, entity.Id)));

                _isDirty = true;
            }
            finally
            {
                _syncLock.ExitWriteLock();
            }
        }
Ejemplo n.º 4
0
 private static bool IsMatch(ServerPackage package, string id, SemanticVersion version)
 {
     return(IsMatch(package, id) && package.Version == version);
 }
Ejemplo n.º 5
0
 private static bool IsMatch(ServerPackage package, string id)
 {
     return(StringComparer.OrdinalIgnoreCase.Equals(package.Id, id));
 }