Beispiel #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();
                }
            }
        }
Beispiel #2
0
        //--------------------------<Test Stub for Display>------------------------

#if(TEST_DISPLAY)

        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);

            foreach (string f in files)                  //to populate element Relation
            {
                ElemRelation e = new ElemRelation();
                e.fromClass = "Derived";
                e.toClass = "Original";
                e.relationType = "Inheritance";
                e.fileName = f;
                RelationshipRepository.relationship_.Add(e);
            }
            foreach (string f1 in files)         //to populate types
            {
                Elem elem = new Elem();
                elem.fileName = f1;
                elem.type = "function";
                elem.name = "Derived";
                elem.begin = 1;
                elem.end = 10;
                elem.functionComplexity = 2;
                OutputRepository.output_.Add(elem);
            }

            options.Add("/S");
            patterns.Add("*.cs");
            Display d = new Display();
            d.display(files, path, patterns, options);
            d.displaySummary(files);
            d.displayFunctionComplexity(files);
            d.displayRelation(files);
        }
 /// <summary>
 /// //////////////////////////////////////////////////////////////
 /// analyzer call or the executive for analyzer project
 public void analyzercall(clientconnect cc)
 {
       if (analyzeproj_.Count == 0)
       {
       //    Console.Write("Please enter Command Line Arguments.\n\n");
           //return null;
       }
       Console.Write("\n\nCurrent path:\n {0}", Directory.GetCurrentDirectory());
       CommandLine.CommandLineProcessing clp = new CommandLine.CommandLineProcessing();
       string path = Directory.GetCurrentDirectory();
       path += "/Servers/TestProjects";           
       Console.Write("{0}",path);
       if(CodeAnalysis.Repository.getInstance()!=null)
           CodeAnalysis.Repository.clearInstance();  
       CodeAnalysis.FileMgr fm = new CodeAnalysis.FileMgr();
       string str2 = "";
       foreach (string str1 in cc.patt_)
           str2 += str1;
       string[] commandlinestr = {path,"/X",str2};
       clp.ProcessCommandLine(commandlinestr);
       fm.setrecurseflag(cc.recurse_);
       fm.findFiles(path);
       List<string> files = new List<string>();
       foreach (string str in fm.getFiles())
       {
           foreach (string str1 in cc.analproj_)
               if (str.Contains(str1))
                   files.Add(str);
       }            
       CodeAnalysis.Analyzer.doAnalysis(files.ToArray(), true);
       CodeAnalysis.Display dis = new CodeAnalysis.Display();
       dis.Displayfiles(files);     
       try
       {
           CodeAnalysis.XML xml = new CodeAnalysis.XML();
           dis.DisplayData(clp);
           if (clp.getxmlflag())
               xml.XMLWrite(clp.getrelationshipflag());
           var xmldoc = XDocument.Load("Output.xml");
           cc.data_ = xmldoc.ToString();
       }
       catch (Exception ex)
       {
           Console.Write("\n\n  {0}\n", ex.Message);
       }
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            CommandLine.CommandLineProcessing clp = new CommandLine.CommandLineProcessing();
            clp.ProcessCommandLine(args);
            Display d = new Display();
            d.DisplayData(clp);

        }