Esempio n. 1
0
        static void Parse(Args args)
        {
            string inputPath = args.InputPath;

            if (inputPath.Contains('.') &&
                ParserHandler.SupportedParsableFiles.Contains(Path.GetExtension(inputPath)))
            {
                // single file
                string           filePath   = inputPath;
                string           sourceText = ParserHandler.GetTextFromFilePath(filePath);
                List <ClassInfo> classInfos = ParserHandler.ClassInfoFromSourceText(
                    filePath,
                    Path.GetExtension(filePath),
                    sourceText).ToList();

                foreach (ClassInfo classInfo in classInfos)
                {
                    PrintClass(classInfo);
                }
            }
            else
            {
                // directory
                string[] allFiles = Directory.GetFiles(inputPath, "*.*", SearchOption.AllDirectories);

                foreach (string filePath in allFiles
                         .Where(filePath => ParserHandler.SupportedParsableFiles
                                .Contains(Path.GetExtension(filePath))))
                {
                    string           sourceText = ParserHandler.GetTextFromFilePath(filePath);
                    List <ClassInfo> classInfos = ParserHandler.ClassInfoFromSourceText(
                        filePath,
                        Path.GetExtension(filePath),
                        sourceText).ToList();

                    foreach (ClassInfo classInfo in classInfos)
                    {
                        PrintClass(classInfo);
                    }
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string filePath = args[0];

            string           sourceText = ParserHandler.GetTextFromFilePath(filePath);
            List <ClassInfo> classInfos = ParserHandler.ClassInfoFromSourceText(
                filePath,
                Path.GetExtension(filePath),
                sourceText).ToList();

            foreach (ClassInfo classInfo in classInfos)
            {
                Console.WriteLine(classInfo.className.FullyQualified);
                foreach (ICodebaseElementInfo codebaseElementInfo in classInfo.Children)
                {
                    Console.WriteLine("Children:");
                    Console.WriteLine(codebaseElementInfo.Name.FullyQualified);
                }
            }
        }