// This method detects the dependencies and passes the currentfile and dependent file to the DependencyModel for storage.

        public void findDependency(List<string> files)
        {
            TypeModel tm = new TypeModel();
            CStoker.CToker toker = new CStoker.CToker();
            toker.returnComments(false);
            string msg1;
            foreach (string file in files)
            {
                if (!toker.openFile(file))
                {
                    msg1 = "Can't open file " + file;
                    Console.Write("\n\n  {0}", msg1);
                    Console.Write("\n  {0}", new string('-', msg1.Length));
                }
                else
                {
                    string tok = "";
                    DependencyModel dm = new DependencyModel();
                    while ((tok = toker.getTok()) != "")
                        if (tok != "\n")
                            foreach (KeyValuePair<string, List<string>> key in tm.dictionary())
                                if (key.Key == tok)
                                {
                                    foreach (string filename in key.Value)
                                        if (file != filename)
                                            dm.addDependency(file, filename);
                                }
                    toker.close();
                }
            }
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     DependencyModel DM = new DependencyModel();
     TypeModel TM = new TypeModel();
     TM.addType("X", "XFile");
     TM.addType("X", "YFile");
     TM.addType("Y", "ZFile");
     TypeView tv = new TypeView();
     tv.Display();
     Console.Write("\n\n");
     DM.addDependency("XFile", "YFile");
     DependencyView depv = new DependencyView();
     depv.Display();
 }
Beispiel #3
0
        // This method displays the contents of the Dependency Table.
        public void Display()
        {
            Console.Write("\n \n \n DEPENDENCY TABLE CONTENTS");
            Console.Write("\n --------------------------\n\n");

            DependencyModel dm = new DependencyModel();
            foreach (KeyValuePair<string, List<string>> item in dm.dictionary())
            {
                Console.WriteLine();
                Console.WriteLine(" C# FILE  -->  " + item.Key + ": is dependent on the following files \n");
                foreach (string value in item.Value)
                    Console.WriteLine("\t" + value);
                Console.WriteLine("-------------------------------------------\n\n");
            }
        }
Beispiel #4
0
 // This method dispalys the total number of dependencies detected.
 public void displaySum()
 { 
     DependencyModel dm = new DependencyModel();
     Dictionary<string, List<string>> DepTable = dm.dictionary();
     Console.WriteLine(" Total Dependent files found by the Analyzer: {0}", DepTable.Count);
 }