コード例 #1
0
ファイル: Form_main.cs プロジェクト: gene71/PD
        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;
            }
        }
コード例 #2
0
ファイル: Form_main.cs プロジェクト: gene71/PD
        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);
        }
コード例 #3
0
ファイル: Form_main.cs プロジェクト: gene71/PD
        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);
            }
        }
コード例 #4
0
ファイル: Form_main.cs プロジェクト: gene71/PD
        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);
            }
        }
コード例 #5
0
ファイル: Form_main.cs プロジェクト: gene71/PD
        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);
        }