コード例 #1
0
        static void Main(string[] args)
        {
            string            path        = null;
            List <string>     patterns    = new List <string>();
            List <string>     options     = null;
            FileMgr           fileManager = new FileMgr();
            CommandLineParser arguments   = new CommandLineParser();
            bool x_display = false;
            bool r_display = false;

            //****************fetches for the path,patterns and options given by the user***************//
            path     = arguments.processPath(args);
            patterns = arguments.processPattern(args);
            options  = arguments.processOptions(args);



            if ((options.Contains("/x")) || (options.Contains("/X"))) //Checks if the user wants the display in XML format
            {
                x_display = true;
            }
            if ((options.Contains("/s")) || (options.Contains("/S"))) //Checks if the user wants to search for the files in the sub directories
            {
                fileManager.recursion = true;
            }
            if ((options.Contains("/r")) || (options.Contains("/R"))) //Checks if the user wants to view the relationships
            {
                r_display = true;
            }
            Analyzer anal = new Analyzer();

            Display DispObj = new Display();

            string[] files = fileManager.getFiles(path, patterns); //returns all the files
            anal.doAnalysis(files);
            anal.reldoAnalysis(files);

            xml_class xml_obj = new xml_class();

            if ((r_display != true) && (x_display != true))
            {
                DispObj.DisplayReport(anal.typesBetweenFiles);
                DispObj.complete(anal.rel_BetweenFiles);
            }
            if (r_display)
            {
                DispObj.complete(anal.rel_BetweenFiles);
            }

            if (x_display)
            {
                xml_obj.display(anal.typesBetweenFiles, anal.rel_BetweenFiles);
            }
        }
コード例 #2
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();
                }
            }
        }
コード例 #3
0
ファイル: Analyzer.cs プロジェクト: monishalp/CodeAnalyzer
        void Main(string[] args)
        {
            FileMgr       file     = new FileMgr();
            List <string> patterns = new List <string>();
            string        path     = ("../../");

            patterns.Add("*.*");
            string[] files    = file.getFiles(path, patterns);
            Analyzer analyzer = new Analyzer();

            analyzer.doAnalysis(files);
            analyzer.reldoAnalysis(files);
            foreach (Elem e in typesBetweenFiles)
            {
                Console.Write("\n  {0,-10}  {1,-25}  {2,-5}  {3,-5}  {4,-5}  {5,5} ", e.type, e.name, e.begin, e.end, e.size, e.prog_complexity);
            }

            Console.WriteLine("\n \n The relationships between the types above are as follows\n");
            foreach (relationelem e in list_relations)
            {
                if (e.isInheritance == true)
                {
                    Console.WriteLine("\n  {0} is inheriting from {1}", e.b_class, e.a_class);
                }
            }


            foreach (relationelem e in list_relations)
            {
                if (e.isAggregation == true)
                {
                    Console.Write("\n  {0} is aggregating  {1}", e.a_class, e.b_class);
                }
            }



            foreach (relationelem e in list_relations)
            {
                if (e.isComposition == true)
                {
                    Console.Write("\n  {0} Composition  {1}", e.a_class, e.b_class);
                }
            }
        }
コード例 #4
0
ファイル: Analyzer.cs プロジェクト: nisha-choudhary/Projects
        // ----------------------<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");
            }
        }
コード例 #5
0
ファイル: Analyzer.cs プロジェクト: WaverV/Projects
        // ----------------------<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");
            }
        }
コード例 #6
0
ファイル: Executive.cs プロジェクト: WaverV/Projects
        //-------------<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();
                }
            }
        }