Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string root = args[0];

            IFileReader       fileReader       = new FileReader();
            IDirectoryBrowser directoryBrowser = new DirectoryBrowser(root, fileReader, new string[] { "node_modules", "$tf", "packages" });

            IDatabaseParser  efDatabaseParser = new EntityFrameworkDatabaseParser();
            IProcedureParser procedureParser  = new InformixProcedureParser();

            IFileParser csFileParser  = new CSFileParser(efDatabaseParser);
            IFileParser sqlFileParser = new SQLFileParser(procedureParser);

            IProjectParser netCoreProjectParser = new NETCoreProjectParser(csFileParser);

            List <ProcedureParseReport> procedureList = new List <ProcedureParseReport>();
            List <ProjectParseReport>   projectList   = new List <ProjectParseReport>();

            int total = 0;

            DirFile file;

            while ((file = directoryBrowser.NextFile()) != null)
            {
                if (file.Extension == "csproj")
                {
                    ProjectParseReport projectReport = netCoreProjectParser.Parse(file);

                    if (projectReport != null)
                    {
                        projectList.Add(projectReport);
                    }
                }
                else if (file.Extension == "sql")
                {
                    FileParseReport procedureReport = sqlFileParser.Parse(file);

                    if (procedureReport != null)
                    {
                        procedureList.AddRange(procedureReport.Procedures);
                    }
                }

                total++;
                UpdateConsoleStatus(total, file.Path, root);
            }

            JsonFileWriter.WriteToFile(procedureList, "procedureReport.json");
            JsonFileWriter.WriteToFile(projectList, "projectReport.json");
        }