withSIX.Sync.Core.Packages.PackageManager.FetchAllRequestedPackages C# (CSharp) Method

FetchAllRequestedPackages() private method

private FetchAllRequestedPackages ( IReadOnlyCollection specificVersions ) : Task
specificVersions IReadOnlyCollection
return Task
        private Task FetchAllRequestedPackages(IReadOnlyCollection<SpecificVersion> specificVersions) {
            var i = 0;
            var totalCount = specificVersions.Count;
            var lObject = new object();
            var allRemotes =
                specificVersions.SelectMany(x => FindRemotesWithPackage(x.GetFullName())).Distinct().ToArray();
            return
                SyncEvilGlobal.DownloadHelper.DownloadFilesAsync(allRemotes, StatusRepo,
                    specificVersions.ToDictionary(x => new FileFetchInfo("packages/" + x.GetFullName() + ".json"),
                        x =>
                            (ITransferStatus)
                            new Status(x.GetFullName(), StatusRepo) {
                                RealObject = "packages/" + x + ".json",
                                OnComplete =
                                    () => {
                                        lock (lObject)
                                            Progress.PackageFetching.Update(null, (++i).ToProgress(totalCount));
                                        return TaskExt.Default;
                                    }
                            }),
                    Repo.RootPath);
        }