Example #1
0
      // This method dispalys the total number of types detected.
    public void displaySum()
    {
        TypeModel tm = new TypeModel();
        Dictionary<string, List<string>> TypeTable = tm.dictionary();
        Console.WriteLine("\n Total Types found in the analyzed files are: {0}", TypeTable.Count);

    }
        // 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 #3
0
      // This method displays the contents of the TypeTable.
    public void Display()
    {
      Console.Write("\n \n \n TYPE TABLE CONTENTS");
      Console.Write("\n --------------------");

      TypeModel tm = new TypeModel();
      Dictionary<string, List<string>> TypeTable = tm.dictionary();
      foreach (string key in TypeTable.Keys)
      {
        Console.Write("\n\n\n >>>>>> Type: {0}  ", key);
        foreach (string item in TypeTable[key])
        {
          Console.Write("\n        <");
          Console.Write("File {0}", item);

          Console.Write("> <<<<<<");
        }
      }
    }