static void RunAnalysis() { using (NetAnalyzer analyzer = new NetAnalyzer()) { List <AnalysisRuleInfo> ari = _analysis.AnalisysRuleInfos; if (ari.Count < 1 && _analysis.Modules.Count < 1) { ErrorHandler.ReportError("Could not find any rule that matches the parameters.\r\n"); ErrorHandler.ShowCommandLineOptions(); return; } Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\r\nThe Dump Files being analyzed are: \n\r"); Console.ResetColor(); foreach (string dumpName in _analysis.DumpFiles) { Console.WriteLine(dumpName); } Console.WriteLine(); foreach (Assembly module in _analysis.Modules) { analyzer.AddAnalysisRulesToRunList(module); } //analyzer.AnalysisRuleInfos = analysisRuleInfos; analyzer.AnalysisRuleInfos.AddRange(ari); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("The rules being executed are: \n\r"); Console.ResetColor(); foreach (AnalysisRuleInfo ruleInfo in analyzer.AnalysisRuleInfos) { Console.WriteLine(ruleInfo.DisplayName); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("The symbols sources are: \n\r"); Console.ResetColor(); Console.WriteLine(_analysis.Symbols); Console.WriteLine(); //Add Dump list to Analizer object so we can analyze them with the debugger analyzer.AddDumpFiles(_analysis.DumpFiles, _analysis.Symbols); NetProgress np = new NetProgress(); np.OnSetOverallStatusChanged += new EventHandler <SetOverallStatusEventArgs>(np_OnSetOverallStatusChanged); //np.OnSetCurrentPositionChanged += new EventHandler<SetCurrentPositionEventArgs>(np_OnSetCurrentPositionChanged); np.OnSetCurrentStatusChanged += new EventHandler <SetCurrentStatusEventArgs>(np_OnSetCurrentStatusChanged); np.OnEnd += new EventHandler(np_OnEnd); Console.WriteLine(string.Format("{0} - Start Analysis", DateTime.Now.ToLongTimeString())); stopwatch.Start(); try { analyzer.RunAnalysisRules(np, _analysis.Symbols, "", _analysis.ReportPath); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { stopwatch.Stop(); } np.End(); if (_analysis.ShowResults) { analyzer.ShowReportFiles(); } } }
public void RunAnalysis(AnalysisJob analysis) { using (NetAnalyzer analyzer = new NetAnalyzer()) { List <AnalysisRuleInfo> ari = analysis.AnalisysRuleInfos; if (ari.Count < 1 && analysis.Modules.Count < 1) { Logger.ReportError("Could not find any rule that matches the parameters.\r\n"); Logger.ShowCommandLineOptions(); return; } Logger.PrintProgress(("\r\nThe Dump Files being analyzed are: \n\r")); foreach (string dumpName in analysis.DumpFiles) { Logger.PrintTrace(dumpName); } Logger.PrintTrace(); foreach (Assembly module in analysis.Modules) { analyzer.AddAnalysisRulesToRunList(module); } //analyzer.AnalysisRuleInfos = analysisRuleInfos; analyzer.AnalysisRuleInfos.AddRange(ari); Logger.PrintProgress("The rules being executed are: \n\r"); foreach (AnalysisRuleInfo ruleInfo in analyzer.AnalysisRuleInfos) { Logger.PrintTrace(ruleInfo.DisplayName); } Logger.PrintTrace(""); Logger.PrintProgress("The symbols sources are: \n\r"); Logger.PrintTrace(analysis.Symbols); Logger.PrintTrace(""); //Add Dump list to Analizer object so we can analyze them with the debugger analyzer.AddDumpFiles(analysis.DumpFiles, analysis.Symbols); NetProgress np = new NetProgress(); np.OnSetOverallStatusChanged += new EventHandler <SetOverallStatusEventArgs>(np_OnSetOverallStatusChanged); //np.OnSetCurrentPositionChanged += new EventHandler<SetCurrentPositionEventArgs>(np_OnSetCurrentPositionChanged); np.OnSetCurrentStatusChanged += new EventHandler <SetCurrentStatusEventArgs>(np_OnSetCurrentStatusChanged); np.OnEnd += new EventHandler(np_OnEnd); Logger.PrintTrace($"{DateTime.Now.ToLongTimeString()} - Start Analysis"); _stopwatch.Start(); try { analyzer.RunAnalysisRules(np, analysis.Symbols, "", analysis.ReportPath); } catch (Exception ex) { Logger.PrintError(ex); } finally { _stopwatch.Stop(); } np.End(); if (analysis.ShowResults) { analyzer.ShowReportFiles(); } } }