コード例 #1
0
ファイル: Main.cs プロジェクト: Jabestrada/LogsAnalyzer
        private void runAnalysis()
        {
            if (!_logSourceListController.HasSelectedAny())
            {
                MessageBox.Show("Please check one or more log files to analyze, or add files/folders by right-clicking on Log files list",
                                "No log file to analyze", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!_logAnalyzerListController.IsAnyAnalyzerSelected() && string.IsNullOrWhiteSpace(adhocRegexTextbox.Text))
            {
                MessageBox.Show("Please check one or more analyzers to run, or enter adhoc Regex pattern",
                                "Select analyzer(s)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!adhocRegexIsValid())
            {
                return;
            }

            AnalysisArgs analysisArgs = _logAnalyzerListController.BuildAnalysisArgs();

            analysisArgs.AdhocRegExpression = adhocRegexTextbox.Text;
            var logSources  = _logSourceListController.BuildLogSourceDefinitionFromSelection();
            var resultsForm = new AnalysisResultsForm(analysisArgs, logSources, AnalyzersConfigFile);

            resultsForm.Show();
        }
コード例 #2
0
        public AnalysisResultsForm(AnalysisArgs analysisArgs, LogSourceDefinition logSources, string renderersConfigFile)
        {
            InitializeComponent();

            _logSourceListController = new LogSourceTreeViewController <TreeView>(logFilesList);

            AnalysisArgs = analysisArgs;
            LogSources   = logSources;

            Analyzers      = buildAnalyzers(analysisArgs);
            AnalyzerChains = buildAnalyzerChains(analysisArgs);

            populateLists();
            formCaptionTextbox.Text = this.Text;
            FormState = FormStateEnum.Ready;

            var renderersBuilder = new RenderersBuilder(renderersConfigFile);
            var renderers        = renderersBuilder.BuildRenderers();

            foreach (var r in renderers)
            {
                _rendererList.Add(r.AnalyzerType, r);
            }

            runAnalysisThread();
        }
コード例 #3
0
        private List <BaseLogAnalyzer> buildAnalyzers(AnalysisArgs analysisArgs)
        {
            var analyzerBuilder = new AnalyzersBuilder(analysisArgs.AnalyzerConfigurations);
            var analyzers       = analyzerBuilder.BuildAnalyzers();

            addAdHocRegexAnalyzerIfNeeded(analyzers);
            return(analyzers);
        }
コード例 #4
0
        private List <AnalyzerShortCircuitChain> buildAnalyzerChains(AnalysisArgs analysisArgs)
        {
            var analyzerChains = new List <AnalyzerShortCircuitChain>();

            foreach (var chainConfig in analysisArgs.AnalyzerChainConfigurations)
            {
                var analyzerChain        = new AnalyzerShortCircuitChain(chainConfig.DisplayName);
                var analyzerChainBuilder = new AnalyzersBuilder(chainConfig.AnalyzerConfigurations.Where(ac => ac.Enabled).ToList());
                analyzerChain.Analyzers.AddRange(analyzerChainBuilder.BuildAnalyzers());
                analyzerChains.Add(analyzerChain);
            }
            return(analyzerChains);
        }