private static Graph Generate(Options options) { IEnumerable <string> patterns; IEnumerable <string> searchPaths; AssemblySearchHelper.OptionsToNamesAndSearchPath(options, out patterns, out searchPaths); var assemblyFullNames = AssemblySearchHelper.GetAssemblyFullNames(patterns, searchPaths); Console.WriteLine("{0} files found.", assemblyFullNames.Count); if (assemblyFullNames.Count == 0) { Environment.Exit(1); } Console.WriteLine("Loading assemblies:"); var rootName = GenerateResultFileName(assemblyFullNames); var ePrev = AnalyzesProgress.Started(); var analyzer = new Analyzer(eCurrent => { ePrev = ConsoleProgress(eCurrent, ePrev); }); using (var loadHelper = new AssemblyLoadHelper(searchPaths)) { var assemblies = assemblyFullNames.Select(loadHelper.Load); analyzer.Analyze(assemblies, rootName); } return(analyzer.GetGraph()); }
private static AnalyzesProgress ConsoleProgress(AnalyzesProgress eCurrent, AnalyzesProgress ePrev) { if (eCurrent.IsFinished) { Console.WriteLine("Analyzes finished."); return ePrev; } var currentPercentage = eCurrent.Actual*100/eCurrent.Max; int prevPercentage = ePrev.Actual*100/ePrev.Max; if (currentPercentage != prevPercentage) { Console.Write("\r{0} {1}% ", eCurrent.Message, currentPercentage); ePrev = eCurrent; } return ePrev; }
private static AnalyzesProgress ConsoleProgress(AnalyzesProgress eCurrent, AnalyzesProgress ePrev) { if (eCurrent.IsFinished) { Console.WriteLine("Analyzes finished."); return(ePrev); } var currentPercentage = eCurrent.Actual * 100 / eCurrent.Max; int prevPercentage = ePrev.Actual * 100 / ePrev.Max; if (currentPercentage != prevPercentage) { Console.Write("\r{0} {1}% ", eCurrent.Message, currentPercentage); ePrev = eCurrent; } return(ePrev); }
private void InvokeOnProgress(AnalyzesProgress eventArgs) { Progress = eventArgs; if (m_OnProgres == null) return; m_OnProgres.Invoke(eventArgs); }