Пример #1
0
        //-------------<the parsing is called from this method>-----------------------------------------------
        //-------------<it also calls the display function and XML functions>---------------------------------
        public static void processAnalysis(string[] files, string path, List<string> patterns, List<string> options)
        {
            XMLOutput xml = new XMLOutput();

            Analyzer analyze = new Analyzer();
            Display display = new Display();
            if (options.Contains("/R") || options.Contains("/r"))
            {
                analyze.doAnalysis(files);
                analyze.doAnalysisRelationship(files);
                display.display(files, path, patterns, options);
                display.displaySummary(files);
                display.displayRelation(files);
            }
            else
            {
                analyze.doAnalysis(files);
                display.display(files, path, patterns, options);
                display.displaySummary(files);
                display.displayFunctionComplexity(files);
            }
            if (options.Contains("/X") || options.Contains("/x"))
            {
                xml.displaySummary();

                if (options.Contains("/R") || options.Contains("/r"))
                {
                    xml.displayRelation();
                }
                else
                {
                    xml.displayFunctionAnalysis();
                }
            }
        }
Пример #2
0
        // ----------------------<Test Stub for Analyzer>---------------------
#if(TEST_ANALYZER)

        static void Main(string[] args)
        {
            string path = "../../";
            string[] arg = { "../../", "*.cs" };
            List<string> patterns = new List<string>();
            patterns.Add("*.cs");
            List<string> options = new List<string>();
            string[] files = getFiles(path, patterns);
            Analyzer analyzer = new Analyzer();
            analyzer.doAnalysis(files);
            analyzer.doAnalysisRelationship(files);
            List<Elem> outputList = OutputRepository.output_;
            foreach (object f in files)
            {
                string filename = Convert.ToString(f);
                Console.Write("      Type                     Name           Begin          End ");
                Console.Write("\n-----------------------------------------------------------------");
                foreach (Elem e in outputList)
                {
                    Console.Write("\n  {0,10}, {1,25}, {2,5}, {3,5}", e.type, e.name, e.begin, e.end);
                }
                Console.WriteLine();
                Console.Write("\n\n  That's all folks!\n\n");

            }
            List<ElemRelation> table = RelationshipRepository.relationship_;
            foreach (object f in files)
            {
                string filename = Convert.ToString(f);
                Console.Write("         Relation                 From                        To");
                Console.Write("\n-----------------------------------------------------------------");

                foreach (ElemRelation e in table)
                {
                    Console.Write("\n  {0,10}, {1,25}, {2,5}", e.relationType, e.fromClass, e.toClass);
                }
                Console.WriteLine();
                Console.Write("\n\n \n\n");
            }
        }