Example #1
0
        private IEnumerable <ProjectTreeElement> ScanProject(FullPath projectFullPath)
        {
            var treeState = new LoadTreeState();

            Queue <ProjectTreeElement> queue = new Queue <ProjectTreeElement>();

            var rootNode = AddProject(treeState, projectFullPath);

            queue.Enqueue(rootNode);

            while (queue.Count != 0)
            {
                var projectContainer = queue.Dequeue();
                _log.Info("Parsing project {0}", projectContainer.Path.Value);
                var modules = projectContainer.Project.Operations().AllModules;

                foreach (IModule module in modules)
                {
                    FullPath modulePath;
                    if (_path.TryResolveModulePath(projectContainer.Path, module.Path, out modulePath))
                    {
                        if (treeState.ScannedProjects.Any(item => item.Path.SameAs(modulePath)))
                        {
                            _log.Warning("Adding second instance of {0}", modulePath.Value);
                        }
                        else
                        {
                            var subProjectNode = AddProject(treeState, modulePath);
                            queue.Enqueue(subProjectNode);
                        }
                    }
                    else
                    {
                        _log.WriteMessage("Project: {0}, module is missing at {1}", projectContainer.Path, module.Path);
                    }
                }
            }

            return(treeState.ScannedProjects);
        }