// 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();
                }
            }
        }
Example #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();
 }