Пример #1
0
        public async Task <IEnumerable <Guid> > GetMediaIdsAsync(
            Album album,
            CancellationToken cancellationToken)
        {
            HashSet <Guid> ids = new();

            foreach (AlbumInclude include in album.Includes)
            {
                switch (include.Type)
                {
                case AlbumIncludeType.Ids:
                    ids.AddRange(include.MediaIds);
                    break;

                case AlbumIncludeType.Folder:

                    foreach (var folder in include.Folders !)
                    {
                        IEnumerable <Guid> folderIds = await _mediaStore.GetIdsByFolderAsync(folder, cancellationToken);

                        ids.AddRange(folderIds);
                    }
                    break;

                case AlbumIncludeType.Query:
                    IEnumerable <Guid> queryIds = await GetIdsFromFilter(include.Filters, cancellationToken);

                    ids.AddRange(queryIds);
                    break;
                }
            }

            return(ids);
        }