Esempio n. 1
0
        private async Task <bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List <FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
        {
            var newItems   = LibraryManager.FindExtras(this, fileSystemChildren, options.DirectoryService).ToList();
            var newItemIds = newItems.Select(i => i.Id).ToArray();

            var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);

            var ownerId = Id;

            var tasks = newItems.Select(i =>
            {
                var subOptions = new MetadataRefreshOptions(options);

                if (i.OwnerId != ownerId)
                {
                    i.OwnerId            = ownerId;
                    subOptions.ForceSave = true;
                }

                return(RefreshMetadataForOwnedItem(i, false, subOptions, cancellationToken));
            });

            await Task.WhenAll(tasks).ConfigureAwait(false);

            SpecialFeatureIds = newItemIds;

            return(itemsChanged);
        }
Esempio n. 2
0
        private async Task <bool> RefreshSpecialFeatures(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true)
        {
            var newItems   = LoadSpecialFeatures().ToList();
            var newItemIds = newItems.Select(i => i.Id).ToList();

            var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);

            var tasks = newItems.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false));

            var results = await Task.WhenAll(tasks).ConfigureAwait(false);

            SpecialFeatureIds = newItemIds;

            return(itemsChanged || results.Contains(true));
        }
Esempio n. 3
0
        private async Task <bool> RefreshSpecialFeatures(MetadataRefreshOptions options, IEnumerable <FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
        {
            var newItems   = LoadSpecialFeatures(fileSystemChildren, options.DirectoryService).ToList();
            var newItemIds = newItems.Select(i => i.Id).ToList();

            var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);

            var tasks = newItems.Select(i => i.RefreshMetadata(options, cancellationToken));

            await Task.WhenAll(tasks).ConfigureAwait(false);

            SpecialFeatureIds = newItemIds;

            return(itemsChanged);
        }