コード例 #1
0
        static void Main(string[] args)
        {
            _av = new ArgsValidator(args);
            if (!_av.ValidArguments)
            {
                return;
            }
            _analysis = _av.GetAnalysisJob;
            var analyzer = new DumpAnalyzer();

            if (!string.IsNullOrEmpty(_analysis.MonitoredFolder))
            {
                Logger.PrintTrace("--------- Automatic Dump Analyzer ---------");
                Logger.PrintTrace($"Monitoring {_analysis.MonitoredFolder} for dump files");
                var priorites = Enum.GetNames(typeof(DumpPriority)).Length;

                var dumpsCollection = new BlockingCollection <DumpFileInfo>(new ConcurrentPriorityQueue <int, DumpFileInfo>(x => priorites - (int)x.Priority));
                var consumer        = new DumpFileConsumer(dumpsCollection, _analysis);
                var watcher         = new DumpFileWatcher(_analysis.MonitoredFolder, dumpsCollection);

                var cts = new CancellationTokenSource();
                Console.CancelKeyPress += (sender, eventArgs) => cts.Cancel();

                consumer.Start(cts.Token);
            }
            else
            {
                analyzer.RunAnalysis(_analysis);
            }
        }
コード例 #2
0
 static void Main(string[] args)
 {
     //Console.ReadKey();
     _av = new ArgsValidator(args);
     if (!_av.ValidArguments)
     {
         return;
     }
     _analysis = _av.GetAnalysisJob;
     RunAnalysis();
 }
コード例 #3
0
        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();
                }
            }
        }
コード例 #4
0
 public DumpFileConsumer(BlockingCollection <DumpFileInfo> dumpsCollection, AnalysisJob defaultAnalysis)
 {
     _dumpsCollection = dumpsCollection;
     _defaultAnalysis = defaultAnalysis;
     _dumpAnalyzer    = new DumpAnalyzer();
 }