public CSharpFile(CSharpProject project, string fileName) { Project = project; FileName = fileName; OriginalText = File.ReadAllText(fileName, Encoding.Default); var p = new CSharpParser(project.CompilerSettings); SyntaxTree = p.Parse(OriginalText, fileName); UnresolvedTypeSystemForFile = SyntaxTree.ToTypeSystem(); LinesOfCode = 1 + OriginalText.Count(c => c == '\n'); }
internal void ParseProjectNamespaces(CSharpProject project) { var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList(); for (int i = 0; i < types.Count; i++) { HandleOnItemParseStart(types[i].Namespace); if (!_sharpDoxConfig.ExcludedIdentifiers.Contains(types[i].Namespace)) { _repository.AddNamespace(GetParsedNamespace(types[i])); } } }
internal void ParseProjectTypes(CSharpProject project) { var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList(); for (int i = 0; i < types.Count; i++ ) { if (types[i].Kind != TypeKind.Delegate) { HandleOnItemParseStart(string.Format("{0}.{1}", types[i].Namespace, types[i].Name)); if (!IsMemberExcluded(types[i].GetIdentifier(), types[i].Accessibility.ToString())) { var sdType = GetParsedType(types[i].GetDefinition(), false); _repository.AddNamespaceTypeRelation(types[i].Namespace, sdType.Identifier); } } } }
private void LoadProjectFile(string title, string pathToProjectFile) { var project = new CSharpProject(this, title, pathToProjectFile); Projects.Add(project); }
private void ParseTypes(CSharpProject project, SDRepository sdRepository, ICoreConfigSection sharpDoxConfig) { var typeParser = new TypeParser(sdRepository, sharpDoxConfig); typeParser.OnItemParseStart += (n) => { PostParseMessage(_parserStrings.ParsingClass + ": " + n); }; typeParser.ParseProjectTypes(project); }
private void ParseNamespaces(CSharpProject project, SDRepository sdRepository, ICoreConfigSection sharpDoxConfig, Dictionary<string, string> tokens) { var namespaceParser = new NamespaceParser(sdRepository, sharpDoxConfig, sharpDoxConfig.InputFile, tokens); namespaceParser.OnDocLanguageFound += ExecuteOnDocLanguageFound; namespaceParser.OnItemParseStart += (n) => { PostParseMessage(_parserStrings.ParsingNamespace + ": " + n); }; namespaceParser.ParseProjectNamespaces(project); }
private void StructureParseTypes(CSharpProject project, SDRepository sdRepository) { var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList(); for (int j = 0; j < types.Count; j++) { var type = types[j]; if (types[j].Kind != TypeKind.Delegate) { PostParseMessage(_parserStrings.ParsingClass + ": " + string.Format("{0}.{1}", types[j].Namespace, types[j].Name)); var nameSpace = sdRepository.GetNamespaceByIdentifier(type.Namespace); var namespaceRef = nameSpace ?? new SDNamespace(type.Namespace) { IsProjectStranger = true }; var sdType = new SDType(type.GetIdentifier(), type.Name, namespaceRef) { Accessibility = type.GetDefinition().Accessibility.ToString().ToLower() }; sdRepository.AddType(sdType); EventParser.ParseMinimalFields(sdType, types[j]); PropertyParser.ParseMinimalProperties(sdType, types[j]); FieldParser.ParseMinimalFields(sdType, types[j]); MethodParser.ParseMinimalConstructors(sdType, types[j]); MethodParser.ParseMinimalMethods(sdType, types[j]); sdRepository.AddNamespaceTypeRelation(types[j].Namespace, sdType.Identifier); } } }
private void StructureParseNamespaces(CSharpProject project, SDRepository sdRepository) { var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList(); for (int j = 0; j < types.Count; j++) { PostParseMessage(_parserStrings.ParsingNamespace + ": " + types[j].Namespace); var sdNamespace = new SDNamespace(types[j].Namespace); sdRepository.AddNamespace(sdNamespace); } }