コード例 #1
0
        /// <summary>
        /// Aggregates the projects.
        /// </summary>
        public async Task AggregateProjectsAsync()
        {
            var projectPaths         = _projectSearchProvider.GetProjectPaths();
            var deserializationTasks = projectPaths
                                       .AsParallel()
                                       .Select(path => _projectBuilder.DeserializeFromXmlAsync(path));
            var projects = await Task.WhenAll(deserializationTasks);

            var aggregationInfo = new AggregationInfo
            {
                ProjectDictionary = projects.ToDictionary(project => project.ProjectName, StringComparer.OrdinalIgnoreCase),
                BuildSet          = new HashSet <Project>(projects.Length),
                OrderedList       = new LinkedList <Project>()
            };

            foreach (var project in projects.OrderBy(p => p.ProjectName))
            {
                AddProjectToAggregationInfo(aggregationInfo, project);
            }

            _outputChannel.DisplayOutput(aggregationInfo.OrderedList
                                         , (IReadOnlyDictionary <string, Project>)aggregationInfo.ProjectDictionary);
        }