private void treeView_ScanDir_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { //open node contents and display to main text box try { //call helper to set working file path var f = getFullPathFromTreeViewNode(e.Node.FullPath); if (f != null) { UIVars.SetWorkingFilePath(f + e.Node.FullPath); //set the text box contents richTextBox_main.Text = File.ReadAllText(UIVars.GetWorkingFilePath()); richTextBox_output.AppendText("Displaying contents for: " + UIVars.WorkingFileName + "\n"); } else { //was null show message richTextBox_output.AppendText(e.Node + ": is not a file.\n"); } } catch (Exception ex) { //TODO: Add Logging richTextBox_error.Text = "Error opening: " + e.Node.FullPath + " " + ex.Message; } }
private void treeView_scan_results_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { try { if (e.Node.FullPath.Contains("ID: ")) { string[] sa = Regex.Split(e.Node.FullPath, "ID: "); string s = sa[1]; string[] sa1 = s.Split('\\'); var id = sa1[0]; richTextBox_output.Text = ""; ScanResult sr = GetScanResult(id); StringBuilder sb = new StringBuilder(); sb.AppendFormat("Selected Details for:\nID: {0}\n", sr.ID); sb.AppendFormat("Scanner: {0}\n", sr.ScannerName); sb.AppendFormat("Found in: {0}\n", sr.FilePath); sb.AppendFormat("Line: {0}\n", sr.LineNumber); sb.AppendFormat("Pattern Used: {0}\n", sr.PatternUsed); richTextBox_output.Text = sb.ToString(); //set main out workingFilePath = sr.FilePath; UIVars.SetWorkingFilePath(sr.FilePath); richTextBox_main.Text = File.ReadAllText(sr.FilePath); //highlight the text getMatch(sr.PatternUsed); textDetailUpdate(); tabControl_Panel_main_bottom.SelectedIndex = 2; } } catch (Exception ex) { richTextBox_error.Text = ex.Message; } }