Beispiel #1
0
        public void RestoreNugets(RunnerOptions options, IProgressTask task)
        {
            if (options.NoRestore)
            {
                task.Increment(100);
                return;
            }

            Solutions.IncrementForEach(task, 100, sln => sln.RestoreNugets(options));
        }
Beispiel #2
0
        public static void IncrementForEach <T>(this IEnumerable <T> enumerable, IProgressTask progress, double value, Action <T> predicate)
        {
            var list           = enumerable.ToList();
            var incrementValue = value / list.Count;

            foreach (var item in list)
            {
                predicate(item);
                progress.Increment(incrementValue);
            }
        }
Beispiel #3
0
        public static async Task IncrementForEach <T>(this IEnumerable <T> enumerable, IProgressTask progress, double value, Func <T, Task> predicate)
        {
            var list           = enumerable.ToList();
            var incrementValue = value / list.Count;

            foreach (var item in list)
            {
                await predicate(item);

                progress.Increment(incrementValue);
            }
        }
Beispiel #4
0
        public static async Task DeduplicateProjects(List <Solution> solutions, IProgressTask createWorkspaceTask)
        {
            var projects = await solutions.Select(sln => sln.Projects.Value)
                           .WhenAll(projs => projs.SelectMany(projs => projs)
                                    .DistinctBy(proj => proj.Filepath)
                                    .ToList());

            foreach (var sln in solutions)
            {
                await sln.ReplaceProjects(projects);

                createWorkspaceTask.Increment(33.0 / solutions.Count);
            }
        }
Beispiel #5
0
        public static Task IncrementWhenAll(this IEnumerable <Task> enumerable, IProgressTask task, double value)
        {
            var tasksList = enumerable.ToList();

            return(Task.WhenAll(tasksList.Select(async t => { await t; task.Increment(value / tasksList.Count); })));
        }