Example #1
0
        static void Main(string[] args)
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            //AssemblyPath = EverythingFileSearcher.Searcher.Search(string.Format(@"{0}\Ref\bin !{0}\Ref\bin\3rd (.dll|.exe)", InitPath)).ToList();
            AssemblyPath = SampleFileSearcher.SearchFiles($@"{InitPath}\Ref\Bin\Lib|{InitPath}\Ref\Bin\Impl", "*.dll|*.exe");
            Console.WriteLine(Resources.Program_Main_Total_file_count__0__, AssemblyPath.Count);
            prjInfoDic         = new Dictionary <string, PrjInfo>();
            prjInfoFileNameDic = new Dictionary <string, PrjInfo>();
            errorPrjInfo       = new List <PrjInfo>();
            root = new List <PrjInfo>();
            AssemblyPath.ForEach(assPath =>
            {
                if (!assPath.EndsWith("dll") && !assPath.EndsWith("exe"))
                {
                    return;
                }
                CreatePrjInfo(assPath);
            }
                                 );
            Console.WriteLine(Resources.Program_Main_Total_aasembly_count__0_, prjInfoDic.Count);
            RebuildRef();


            var csprojFilePathList = SampleFileSearcher.SearchFiles($"{InitPath}\\Src", "*.csproj");


            foreach (var csprjFile in csprojFilePathList)
            {
                var analyzer = new ProjectAnalyzer(csprjFile);
                var assName  = analyzer.GetAssemblyName();

                if (string.IsNullOrEmpty(assName))
                {
                    Console.WriteLine($"Prj File {csprjFile} could not output a assembly");
                    continue;
                }
                if (!prjInfoFileNameDic.ContainsKey(assName))
                {
                    Console.WriteLine($"Prj File {csprjFile} output assembly:{assName} did not registed");
                    continue;
                }
                var pf      = new FileInfo(csprjFile);
                var prjInfo = prjInfoFileNameDic[assName];
                prjInfo.PrjFilePath = pf.DirectoryName;
                prjInfo.PrjFileName = pf.Name;
            }
            PrintAss();
        }