Пример #1
0
        // ----------------< perform In Coming dependency using Complete TypeTable >----------------
        public void dependencyAnalysisAll(string directoryName)
        {
            List <string> pattern = new List <string>();

            pattern.Add("*.cs");

            FileManager fm = new FileManager();

            string[] files = fm.getFiles(pathNameForFatching, pattern, true).ToArray();

            if (files.Length != 0)
            {
                try
                {
                    Analyzer.doRelationAnalysis(files);
                    List <ElemRelation> relationship = Analyzer.getRelationshipTable();

                    PackageDependency  pd      = new PackageDependency();
                    List <ElemPackage> package = pd.getPackageDependency();

                    RemoveDuplicate     rd            = new RemoveDuplicate();
                    List <ElemRelation> relationship1 = rd.removeDuplicate(relationship);
                    List <ElemPackage>  package1      = rd.removePDuplicate(package);

                    List <ElemRelation> relationshipTo = new List <ElemRelation>();
                    foreach (ElemRelation er in relationship1)
                    {
                        if (Path.GetDirectoryName(er.filenameto).Equals(directoryName))
                        {
                            relationshipTo.Add(er);
                        }
                    }

                    List <ElemPackage> packageTo = new List <ElemPackage>();
                    foreach (ElemPackage ep in package)
                    {
                        if (Path.GetDirectoryName(ep.filenameto).Equals(directoryName))
                        {
                            ElemPackage e = new ElemPackage();
                            e.filenamefrom = ep.filenamefrom;
                            e.filenameto   = ep.filenameto;
                            packageTo.Add(e);
                        }
                    }

                    XMLEncoderDecoder xe = new XMLEncoderDecoder();
                    dependencyAllResult = xe.dependencyResultXML(relationshipTo, packageTo);
                }
                catch { }
            }
            else
            {
                return;
            }
        }
        static void Main(string[] args)
        {
            string[]      dir  = Directory.GetDirectories(Path.GetFullPath("../../../TESTFOLDER"));
            List <string> dir1 = new List <string>();

            foreach (string d in dir)
            {
                dir1.Add(d);
            }
            XMLEncoderDecoder xed = new XMLEncoderDecoder();

            Console.Write("ProjectList:\n{0}", xed.projectXML(dir1));

            repositoryForTestUP();
            Console.Write("\nType Table XML:\n{0}", xed.typeTableXML(RepositoryForOutput.storageForOutput_));

            List <ElemPackage> package = new List <ElemPackage>();
            ElemPackage        ep      = new ElemPackage();

            ep.filenamefrom = "file1";
            ep.filenameto   = "file2";
            ElemPackage ep1 = new ElemPackage();

            ep1.filenamefrom = "file3";
            ep1.filenameto   = "file4";
            package.Add(ep);
            package.Add(ep1);
            Console.Write("\nDependency Result XML:\n{0}", xed.dependencyResultXML(RepositoryForRelation.storageForRelationship_, package));

            List <Elem> type = xed.typeTableDecoding(xed.typeTableXML(RepositoryForOutput.storageForOutput_));

            foreach (Elem e in type)
            {
                Console.Write("\n {0} {1} {2} {3}", e.filename, e.namespacename, e.type, e.name);
            }
        }
Пример #3
0
        // ----------------< perform Out Going dependency using Complete TypeTable >----------------
        public void dependencyAnalysis(string directoryName)
        {
            List <string> pattern = new List <string>();

            pattern.Add("*.cs");

            FileManager fm = new FileManager();

            string[] files = fm.getFiles(directoryName, pattern, true).ToArray();

            if (files.Length != 0)
            {
                try
                {
                    Analyzer.doRelationAnalysis(files);
                    List <ElemRelation> relationship = Analyzer.getRelationshipTable();

                    PackageDependency  pd      = new PackageDependency();
                    List <ElemPackage> package = pd.getPackageDependency();

                    RemoveDuplicate     rd            = new RemoveDuplicate();
                    List <ElemRelation> relationship1 = rd.removeDuplicate(relationship);
                    List <ElemPackage>  package1      = rd.removePDuplicate(package);

                    XMLEncoderDecoder xe = new XMLEncoderDecoder();
                    dependencyResult = xe.dependencyResultXML(relationship1, package1);

                    Console.Write("\n\n {0}", dependencyResult);
                }
                catch { }
            }
            else
            {
                return;
            }
        }
        static void Main(string[] args)
        {
            string[] dir = Directory.GetDirectories(Path.GetFullPath("../../../TESTFOLDER"));
            List<string> dir1 = new List<string>();
            foreach (string d in dir)
                dir1.Add(d);
            XMLEncoderDecoder xed=new XMLEncoderDecoder();
            Console.Write("ProjectList:\n{0}", xed.projectXML(dir1));

            repositoryForTestUP();
            Console.Write("\nType Table XML:\n{0}", xed.typeTableXML(RepositoryForOutput.storageForOutput_));

            List<ElemPackage> package = new List<ElemPackage>();
            ElemPackage ep = new ElemPackage();
            ep.filenamefrom = "file1";
            ep.filenameto = "file2";
            ElemPackage ep1 = new ElemPackage();
            ep1.filenamefrom = "file3";
            ep1.filenameto = "file4";
            package.Add(ep);
            package.Add(ep1);
            Console.Write("\nDependency Result XML:\n{0}", xed.dependencyResultXML(RepositoryForRelation.storageForRelationship_,package));

            List<Elem> type = xed.typeTableDecoding(xed.typeTableXML(RepositoryForOutput.storageForOutput_));
            foreach (Elem e in type)
                Console.Write("\n {0} {1} {2} {3}", e.filename, e.namespacename, e.type, e.name);
        }