예제 #1
0
        private void CategoriseDocument(DocumentSubject document)
        {
            if (!document.IsLoaded)
            {
                return;
            }

            foreach (ISubject type in document.Children)
            {
                typesCategory.AddSubject(type);

                foreach (Category category in categories.Values)
                {
                    if (category.Condition.IsMet(type))
                    {
                        category.AddSubject(type);
                    }
                }

                foreach (ISubject member in type.Children)
                {
                    membersCategory.AddSubject(member);
                }
            }
        }
예제 #2
0
        private async Task LoadChunkOfProjects(List <Project> projects, IReporter reporter, int totalProjectsCount)
        {
            foreach (Project project in projects)
            {
                if (string.IsNullOrEmpty(project.FilePath) ||
                    (!string.Equals(project.Language, "csharp", StringComparison.OrdinalIgnoreCase) &&
                     !string.Equals(project.Language, "c#", StringComparison.OrdinalIgnoreCase)))
                {
                    continue;
                }

                var projectSubject = new ProjectSubject(project);
                projectSubject.SetParent(root);

                foreach (Document document in project.Documents)
                {
                    if (document.SourceCodeKind != SourceCodeKind.Regular)
                    {
                        continue;
                    }

                    var documentSubject = new DocumentSubject(document);
                    documentSubject.SetParent(projectSubject);

                    await documentSubject.LoadAsync();

                    CategoriseDocument(documentSubject);

                    filesCategory.AddSubject(documentSubject);
                    projectSubject.SetChildren(projectSubject.Children.Add(documentSubject));
                }

                projectsCategory.AddSubject(projectSubject);
                AddLoadedProjectToRoot(projectSubject, reporter, totalProjectsCount);
            }
        }