Esempio n. 1
0
        //------------------<Test Stub for File Manager>----------------------

#if (TEST_FILEMGR)
        static void Main(string[] args)
        {
            Console.Write("\n  Testing FileMgr Class");
            Console.Write("\n =======================\n");

            string        path     = "../../";
            List <string> patterns = new List <string>();
            List <string> options  = new List <string>();

            options.Add("/S");
            patterns.Add("*.cs");

            FileMgr fm = new FileMgr();

            fm.addPattern("*.cs");
            fm.findFiles("../../");
            fm.subDirectoriesCheck(options);


            List <string> files = fm.getFiles1();

            string[] files1 = fm.getFiles(path, patterns);
            for (int i = 0; i < files1.Length; i++)
            {
                Console.WriteLine("\n{0}", files1[i]);
            }
            Console.Write("\n\n");
        }
Esempio n. 2
0
 static public string[] getFiles(string path, List<string> patterns) { 
     FileMgr fm=new FileMgr();
     foreach (string pattern in patterns)
         fm.addPattern(pattern);
     fm.findFiles(path);
     return fm.getFiles().ToArray();
 }
 static public string[] getFiles(string path)
 {
   FileMgr fm = new FileMgr();
   fm.addPattern("*.cs");
   fm.findFiles(path);
   return fm.getFiles();
 }
Esempio n. 4
0
 public static string[] getFiles(string path, List<string> patterns, bool sub_flag)
 {
     FileMgr fm = new FileMgr();
     foreach (string pattern in patterns)
         fm.addPattern(pattern);
     fm.findFiles(path,sub_flag);                //control files will be searched
     return fm.getFiles().ToArray();
 }
Esempio n. 5
0
        static public string[] getFiles(string path)
        {
            FileMgr fm = new FileMgr();

            fm.addPattern("*.cs");
            fm.findFiles(path);
            return(fm.getFiles());
        }
Esempio n. 6
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);
            }
        }
Esempio n. 7
0
        //-------------------<prcocesses the files>-------------------------
        public static string[] processFiles(string path, List <string> patterns, List <string> options)
        {
            FileMgr fileManager = new FileMgr();

            if (options.Contains("/S") || options.Contains("/s"))
            {
                fileManager.subDirectoriesCheck(options);
            }

            string[] files = fileManager.getFiles(path, patterns);

            return(files);
        }
Esempio n. 8
0
 static void Main(string[] args)
 {
     Console.Write("\n  Testing FileMgr Class");
     Console.Write("\n =======================\n");
     FileMgr fm = new FileMgr();
     fm.addPattern("*.cs");
     fm.findFiles("../../");
     List<string> files = fm.getFiles();
     foreach (string file in files)
     Console.Write("\n  {0}", file);
     Console.Write("\n\n");
     
 }
Esempio n. 9
0
        static void Main(string[] args)
        {
            Console.Write("\n  Testing FileMgr class");
            Console.Write("\n =======================\n");
            FileMgr fm = new FileMgr();

            //fm.addPattern("*.cs");
            fm.findFiles("../../../");
            string[] files = fm.getFiles();
            foreach (string file in files)
            {
                Console.Write("\n  {0}", Path.GetFileName(file));
            }
            Console.Write("\n\n");
        }
Esempio n. 10
0
        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);
                }
            }
        }
Esempio n. 11
0
        //-------------------<prcocesses the files>-------------------------
        public static string[] processFiles(string path, List<string> patterns, List<string> options)
        {
            FileMgr fileManager = new FileMgr();
            if (options.Contains("/S") || options.Contains("/s"))
            {
                fileManager.subDirectoriesCheck(options);

            }

            string[] files = fileManager.getFiles(path, patterns);

            return 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);
       }
 }
Esempio n. 13
0
 static void Main(string[] args)
 {
   Console.Write("\n  Testing FileMgr class");
   Console.Write("\n =======================\n");
   FileMgr fm = new FileMgr();
   //fm.addPattern("*.cs");
   fm.findFiles("../../../");
   string[] files = fm.getFiles();
   foreach (string file in files)
     Console.Write("\n  {0}", Path.GetFileName(file));
   Console.Write("\n\n");
 }
Esempio n. 14
0
        //------------------<Test Stub for File Manager>----------------------

#if(TEST_FILEMGR)
        static void Main(string[] args)
        {
            Console.Write("\n  Testing FileMgr Class");
            Console.Write("\n =======================\n");

            string path = "../../";
            List<string> patterns = new List<string>();
            List<string> options = new List<string>();
            options.Add("/S");
            patterns.Add("*.cs");

            FileMgr fm = new FileMgr();
            fm.addPattern("*.cs");
            fm.findFiles("../../");
            fm.subDirectoriesCheck(options);


            List<string> files = fm.getFiles1();
            string[] files1 = fm.getFiles(path, patterns);
            for (int i = 0; i < files1.Length; i++)
            {
                Console.WriteLine("\n{0}", files1[i]);
            }
            Console.Write("\n\n");


        }