private void toolStripButton1_Click(object sender, EventArgs e) { //Add report openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); openFileDialog1.Filter = Filter; openFileDialog1.FileName = ""; DialogResult r = openFileDialog1.ShowDialog(this); if (r == System.Windows.Forms.DialogResult.OK) { NessusClientData_v2 data = NessusClientData_v2.Parse(openFileDialog1.FileName); reports.Add(new Report(data)); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string inputPath = textBox1.Text; NessusReports.ReportType reportType = ((ReportTypeSelection)comboBox1.SelectedItem).Type; string outputPath = (string)e.Argument; string ext = Path.GetExtension(outputPath); NessusClientData_v2 data = NessusClientData_v2.Parse(inputPath); if (ext.Equals("html", StringComparison.CurrentCultureIgnoreCase)) { HtmlNessusReport report = new HtmlNessusReport(); report.Path = outputPath; e.Result = report.Export(data, reportType); } else { CsvNessusReport report = new CsvNessusReport(); report.Path = outputPath; e.Result = report.Export(data, reportType); } }