示例#1
0
        public static async Task UpdateRepoAsync(string login, Repo repo)
        {
            var item = AllRepos.Find(o => o.id == repo.id);

            if (item == null)
            {
                AllRepos.Add(repo);
            }
            item = repo;
            await SaveCategoryReposAsync(login);
        }
示例#2
0
        private IEnumerable <TagInfo> GetAllTags()
        {
            IEnumerable <ImageInfo> images = AllRepos
                                             .SelectMany(repo => repo.AllImages)
                                             .ToArray();
            IEnumerable <TagInfo> sharedTags = images
                                               .SelectMany(image => image.SharedTags);
            IEnumerable <TagInfo> platformTags = images
                                                 .SelectMany(image => image.AllPlatforms)
                                                 .SelectMany(platform => platform.Tags);

            return(sharedTags
                   .Concat(platformTags));
        }
示例#3
0
        public PlatformInfo GetPlatformByTag(string fullTagName)
        {
            PlatformInfo result = AllRepos
                                  .SelectMany(repo => repo.AllImages)
                                  .SelectMany(image => image.AllPlatforms)
                                  .FirstOrDefault(platform => platform.Tags.Any(tag => tag.FullyQualifiedName == fullTagName));

            if (result == null)
            {
                throw new InvalidOperationException($"Unable to find platform for the tag '{fullTagName}'");
            }

            return(result);
        }
示例#4
0
 public static async Task SaveCategoryReposAsync(string user)
 {
     var temp = AllRepos.FindAll(x => x.CategoriesId.Length != 0);
     await BlobCache.LocalMachine.InsertObject <List <Repo> >(CacheKeys.RepositoriesKey, temp);
 }
示例#5
0
 public static List <Repo> GetRepoOfCategory(int catId) => AllRepos?.FindAll(obj => obj.CategoriesId.Contains(catId));
示例#6
0
 public RepoInfo GetRepoById(string id)
 {
     return(AllRepos.FirstOrDefault(repo => repo.Id == id));
 }
示例#7
0
 public RepoInfo GetRepoByImage(ImageInfo image) =>
 AllRepos
 .FirstOrDefault(repoImage => repoImage.AllImages.Contains(image));
示例#8
0
 public RepoInfo GetRepoByModelName(string name)
 {
     return(AllRepos.FirstOrDefault(repo => repo.Model.Name == name));
 }
示例#9
0
 public IEnumerable <ImageInfo> GetAllImages() => AllRepos.SelectMany(repo => repo.AllImages);