private void Scan() { if (!string.IsNullOrEmpty(this.SourceCodeDirectory)) { this.lblStatus.Text = "Scanning..."; this.sourceCodeAnalyzer = new SourceCodeAnalyzer(this.SourceCodeDirectory, this.Completed, this.Debug); this.sourceCodeAnalyzerThread = new Thread(this.sourceCodeAnalyzer.OnThread); this.sourceCodeAnalyzerThread.Start(); } }
private void Completed(SourceCodeAnalyzer analyzer) { this.FindForm().Invoke(new Action(() => { foreach (IVulnerability v in analyzer.Vulnerabilities) { string s = GetSeverityForColor(v.GetSeverity()); // // add the severity level. // if (!treeViewResults.Nodes.ContainsKey(s)) { TreeNode tnSeverityNode = new TreeNode(s); tnSeverityNode.Name = s; tnSeverityNode.BackColor = v.GetSeverity(); treeViewResults.Nodes.Add(tnSeverityNode); } // // add the type level. // //treeViewResults.Nodes[s] if (treeViewResults.Nodes[s].Nodes == null) { MessageBox.Show("huh."); } if (!treeViewResults.Nodes[s].Nodes.ContainsKey(v.GetType())) { TreeNode tnTypeNode = new TreeNode(v.GetType()); tnTypeNode.Name = v.GetType(); tnTypeNode.BackColor = v.GetSeverity(); treeViewResults.Nodes[s].Nodes.Add(tnTypeNode); } // // add the actual vuln. // TreeNode vulnNode = new TreeNode(v.GetFilename()); vulnNode.BackColor = v.GetSeverity(); vulnNode.Tag = v.GetId(); treeViewResults.Nodes[s].Nodes[v.GetType()].Nodes.Add(vulnNode); } this.lblStatus.Text = "Finished."; })); }