private void ExtractCodeNamespaces(string filePath) { FileAccess access = new FileAccess(); string fileContent = access.GetFileContent(filePath).ToString(); CodeReader codeReader = new CodeReader(); CodeSections = codeReader.GetAllCodeElements(filePath, fileContent, 0, 0); foreach (CodeSection codeSection in CodeSections) { CodeElement codeElement = codeReader.ConvertToDataModel(codeSection); if (codeSection.BlockType == "namespace") { ElementNamespace elementNamespace = new ElementNamespace(); elementNamespace.ElementName = filePath; //elementNamespace.ElementFile = filePath; ElementProgram.CodeNamespaces.Add(elementNamespace); } } }
public CodeSection(string filePath, string fileContent, int beginSection, int level) { Visibility = (int) Visible.Internal; FilePath = filePath; this.beginSection = beginSection; //this.endSection = endSection; //this.codeContent = fileContent.Substring(beginSection, endSection - beginSection).Trim(); CodeReader codeReader = new CodeReader(); CodeSections = codeReader.GetAllCodeElements(filePath, fileContent, beginSection, level+1); ReturnType = "Undefined"; }