示例#1
0
 private void RemoveAvailableLibrariesFromPaths(IEnumerable <string> libraryPaths)
 {
     foreach (var libraryPath in libraryPaths)
     {
         var library = CreateLibraryFromPath(libraryPath);
         while (TryGetLibraryWithNameAndVersion(library, out var otherLibrary))
         {
             AvailableLibraries.Remove(otherLibrary);
             AvailableLibraryItems.Remove(AvailableLibraryItems.FirstOrDefault(x => x.Library == otherLibrary));
         }
     }
 }
示例#2
0
        private void AddLibraryToAvailableIfNewest(NodeLibrary library)
        {
            if (TryGetLibraryWithNameAndVersion(library, out var otherLibrary))
            {
                if (!library.IsNewerVersionThan(otherLibrary))
                {
                    return;
                }

                AvailableLibraries.Remove(otherLibrary);
                AvailableLibraryItems.Remove(AvailableLibraryItems.FirstOrDefault(x => x.Library == otherLibrary));
                AvailableLibraries.Add(library);
                AvailableLibraryItems.Add(new LibraryListItem(library, library.Name));
            }
            else
            {
                AvailableLibraries.Add(library);
                AvailableLibraryItems.Add(new LibraryListItem(library, library.Name));
            }
        }