private void openScanConfig(string filePath) { try { ParaObjSerializer pos = new ParaObjSerializer(); ScanConfig sc = pos.LoadScanConfig(filePath); textBox_scanner_name.Text = sc.Name; richTextBox_Scanner_Description.Text = sc.Description; comboBox_finding_type.Text = sc.Type; comboBox_risk.Text = sc.Risk; //add patterns to list box listBox_Scan.Items.Clear(); foreach (var item in sc.Patterns) { listBox_Scan.Items.Add(item); } //add file extensions to list box listBox_FileExt.Items.Clear(); foreach (var item in sc.FileExtensions) { listBox_FileExt.Items.Add(item); } } catch (Exception ex) { richTextBox_error.Text = ex.Message; } }
private void saveScanConfig(string fileName) { ScanConfig sc = new ScanConfig(); sc.Name = textBox_scanner_name.Text; sc.Description = richTextBox_Scanner_Description.Text; sc.Type = comboBox_finding_type.Text; sc.Risk = comboBox_risk.Text; //add patterns foreach (var item in listBox_Scan.Items) { if (!sc.Patterns.Contains(item.ToString())) { sc.Patterns.Add(item.ToString()); } } //add file extensions foreach (var item in listBox_FileExt.Items) { if (!sc.FileExtensions.Contains(item.ToString())) { sc.FileExtensions.Add(item.ToString()); } } //serialize and save to ParaData/ScanConfigs ParaObjSerializer pos = new ParaObjSerializer(); pos.SaveParaObj(fileName, sc); }
private void loadProject(string filename) { ParaObjSerializer pos = new ParaObjSerializer(); workingProject = pos.LoadProject(filename); textBox_projName.Text = workingProject.Name; richTextBox_ProjectDes.Text = workingProject.Description; listBox_scanConfigs.Items.Clear(); foreach (var item in workingProject.ScanConfigs) { listBox_scanConfigs.Items.Add(item.Name); } }
private void initAvailScanConfigs() { availableScanConfigs = new List <ScanConfig>(); ParaObjSerializer pos = new ParaObjSerializer(); FileUtil fu = new FileUtil(); var configs = fu.GetFiles(Environment.CurrentDirectory + "\\ParaData\\ScanConfigs"); foreach (var f in configs) { ScanConfig sc = pos.LoadScanConfig(f); availableScanConfigs.Add(sc); } comboBox_projScanConfigSelect.Items.Clear(); foreach (var sc in availableScanConfigs) { comboBox_projScanConfigSelect.Items.Add(sc.Name); } }
private void saveProject(string fileName) { ParadigmProject pp = new ParadigmProject(); pp.Name = textBox_projName.Text; pp.Description = richTextBox_ProjectDes.Text; foreach (string item in listBox_scanConfigs.Items) { foreach (var sc in availableScanConfigs) { if (item == sc.Name) { pp.ScanConfigs.Add(sc); break; } } } //serialize and save to ParaData//Projects ParaObjSerializer pos = new ParaObjSerializer(); pos.SaveParaObj(fileName, pp); }