Ejemplo n.º 1
0
        internal override AnalysisArgs BuildAnalysisArgs()
        {
            var analysisArgs = new AnalysisArgs();
            List <AnalyzerConfiguration> selectedAnalyzers = new List <AnalyzerConfiguration>();

            foreach (TreeNode item in ListView.Nodes)
            {
                if (item.Checked)
                {
                    if (item.Tag.GetType() == typeof(AnalyzerConfiguration))
                    {
                        analysisArgs.AnalyzerConfigurations.Add(item.Tag as AnalyzerConfiguration);
                    }
                    else if (item.Tag.GetType() == typeof(AnalyzerChainConfiguration))
                    {
                        var analyzerChainConfig = (AnalyzerChainConfiguration)item.Tag;
                        foreach (TreeNode subNode in item.Nodes)
                        {
                            var analyzerConfig = (AnalyzerConfiguration)subNode.Tag;
                            analyzerConfig.Enabled = subNode.Checked;
                        }
                        analysisArgs.AnalyzerChainConfigurations.Add(analyzerChainConfig);
                    }
                }
            }
            return(analysisArgs);
        }
Ejemplo n.º 2
0
        internal AnalysisArgs GetAnalysisScopeArgs()
        {
            var args = new AnalysisArgs
            {
                RuleSets       = new List <RuleSet>(),
                Rules          = new List <Rule>(),
                FileExclusions = txtExclusions.Text.Split(',').Select(e => e.Trim()).Where(e => !string.IsNullOrEmpty(e)).ToList()
            };

            if (rbScopeRuleset.Checked && cbRuleset.SelectedItem is RuleSet ruleset)
            {
                args.RuleSets.Add(ruleset);
            }
            else if (rbScopeRules.Checked)
            {
                foreach (ListViewItem item in lvRules.CheckedItems)
                {
                    if (item.Tag is Rule rule)
                    {
                        args.Rules.Add(rule);
                    }
                }
            }
            return(args);
        }
Ejemplo n.º 3
0
 internal void SetArgs(AnalysisArgs args)
 {
     Reset();
     txtCorrId.Text         = args.CorrId.ToString();
     txtExclusions.Text     = string.Join(", ", args.FileExclusions);
     txtRulesets.Text       = string.Join(", ", args.RuleSets.Select(r => r.Name));
     lbRules.DataSource     = args.Rules;
     dgSolutions.DataSource = args.Solutions;
     dgSolutions.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
 }
Ejemplo n.º 4
0
        private void BtnSeatView_Click(object sender, RoutedEventArgs e)
        {
            AnalysisArgs args = new AnalysisArgs();

            if (AnalysisEvent != null)
            {
                AnalysisEvent(this, args);
            }
            else
            {
                String errorText = "로딩에 실패했습니다.";
                btnSeatView.Content = errorText;
            }
        }
Ejemplo n.º 5
0
        private void ExportSolution(AnalysisArgs analysisargs, Solution solution)
        {
            if (LastExportTry == solution)
            {
                ShowError($"Failed to export {solution}");
                return;
            }
            LastExportTry = solution;
            Enable(false);
            var solname = solution.UniqueName;

            WorkAsync(new WorkAsyncInfo
            {
                Message       = $"Exporting {solname}",
                AsyncArgument = solname,
                Work          = (worker, args) =>
                {
                    var sol = args.Argument as string;
                    var req = new ExportSolutionRequest
                    {
                        SolutionName = sol,
                        Managed      = false
                    };
                    args.Result = Service.Execute(req) as ExportSolutionResponse;
                },
                PostWorkCallBack = (args) =>
                {
                    if (args.Error != null)
                    {
                        ShowError(args.Error);
                    }
                    else if (args.Result is ExportSolutionResponse resp)
                    {
                        var exportXml = resp.ExportSolutionFile;
                        var filepath  = WorkingFolder;
                        var filename  = $"{solname} {solution.Version}";
                        var fullpath  = Path.Combine(filepath, filename + ".zip");
                        int i         = 0;
                        while (File.Exists(fullpath))
                        {
                            fullpath = Path.Combine(filepath, $"{filename} ({++i}).zip");
                        }
                        File.WriteAllBytes(fullpath, exportXml);
                        solution.LocalFilePath = fullpath;
                    }
                    Enable(true);
                    SendAnalysis(analysisargs);
                }
            });