Beispiel #1
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            var filesToProcess = new List <string>();
            var commandLine    = new StringBuilder();

            //Get files or filelist text
            if (FileListRadio.Checked)
            {
                if (FileListBox.Items.Count == 0)
                {
                    MessageBox.Show("No files to process");
                    return;
                }

                filesToProcess.AddRange(from string item in FileListBox.Items select item);
            }
            else if (String.IsNullOrEmpty(FileBox.Text) || !File.Exists(FileBox.Text))
            {
                MessageBox.Show("No files to process");
                return;
            }
            else
            {
                filesToProcess.Add(String.Format("--filelist|\"{0}\"", FileBox.Text));
            }

            //Get config settings

            if (UseCFGButton.Checked &&
                (String.IsNullOrEmpty(ConfigBox.Text) || !File.Exists(ConfigBox.Text)))
            {
                commandLine.AppendFormat("--config|\"{0}\"|", ConfigBox.Text);
            }

            if (OutputFormatBox.Text != OutputExtensionBox.Text)
            {
                commandLine.AppendFormat("--ext|{0}|", OutputExtensionBox.Text);
            }

            switch (OutputFormatBox.Text)
            {
            case "mzXML":
                commandLine.Append("--mzXML|");
                break;

            case "mz5":
                commandLine.Append("--mz5|");
                break;

            case "mgf":
                commandLine.Append("--mgf|");
                break;

            case "text":
                commandLine.Append("--text|");
                break;

            case "ms2":
                commandLine.Append("--ms2|");
                break;

            case "cms2":
                commandLine.Append("--cms2|");
                break;
            }

            if (Precision32.Checked)
            {
                commandLine.Append("--32|");
            }

            if (!WriteIndexBox.Checked)
            {
                commandLine.Append("--noindex|");
            }

            if (UseZlibBox.Checked)
            {
                commandLine.Append("--zlib|");
            }

            if (GzipBox.Checked)
            {
                commandLine.Append("--gzip|");
            }

            var msLevelsTotal    = String.Empty;
            var peakPickingTotal = String.Empty;
            var scanNumberTotal  = String.Empty;
            var preferVendor     = true;

            foreach (DataGridViewRow row in FilterDGV.Rows)
            {
                switch ((string)row.Cells[0].Value)
                {
                case "msLevel":
                    msLevelsTotal += (string)row.Cells[1].Value + " ";
                    break;

                case "peakPicking":
                    var splitLine = ((string)row.Cells[1].Value ?? "true").Split();
                    preferVendor = bool.Parse(splitLine[0]);
                    if (splitLine.Length > 1)
                    {
                        peakPickingTotal += splitLine[1] + " ";
                    }
                    break;

                case "scanNumber":
                    scanNumberTotal += (string)row.Cells[1].Value + " ";
                    break;

                default:
                    commandLine.AppendFormat("--filter|{0} {1}|", row.Cells[0].Value, row.Cells[1].Value);
                    break;
                }
            }

            string outputFolder = String.IsNullOrEmpty(OutputBox.Text) ? Application.StartupPath
                                                                       : OutputBox.Text;

            if (!Directory.Exists(outputFolder))
            {
                if (MessageBox.Show("The directory \"" + outputFolder + "\" does not exist. Do you want to create it?",
                                    "Create Directory?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                {
                    return;
                }
                Directory.CreateDirectory(outputFolder);
            }

            if (!String.IsNullOrEmpty(msLevelsTotal))
            {
                commandLine.AppendFormat("--filter|msLevel {0}|", msLevelsTotal.Trim());
            }
            if (!String.IsNullOrEmpty(peakPickingTotal))
            {
                commandLine.AppendFormat("--filter|peakPicking {0} {1}|", preferVendor.ToString().ToLower(),
                                         peakPickingTotal.Trim());
            }
            if (!String.IsNullOrEmpty(scanNumberTotal))
            {
                commandLine.AppendFormat("--filter|scanNumber {0}|", scanNumberTotal.Trim());
            }

            var pf = new ProgressForm(filesToProcess, outputFolder, commandLine.ToString());

            pf.Text = "Conversion Progress";
            pf.ShowDialog();
        }
Beispiel #2
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            var filesToProcess = new List<string>();
            var commandLine = ConstructCommandline();

            //Get files or filelist text
            if (FileListRadio.Checked)
            {
                if (FileListBox.Items.Count == 0)
                {
                    MessageBox.Show("No files to process");
                    return;
                }

                filesToProcess.AddRange(from string item in FileListBox.Items select item);
            }
            else if (String.IsNullOrEmpty(FileBox.Text) || !File.Exists(FileBox.Text))
            {
                MessageBox.Show("No files to process");
                return;
            }
            else
            {
                filesToProcess.Add(String.Format("--filelist|\"{0}\"", FileBox.Text));
            }

            string outputFolder = String.IsNullOrEmpty(OutputBox.Text) ? Application.StartupPath
                                                                       : OutputBox.Text;
            if (!Directory.Exists(outputFolder))
            {
                if (MessageBox.Show("The directory \"" + outputFolder + "\" does not exist. Do you want to create it?",
                                    "Create Directory?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                    return;
                Directory.CreateDirectory(outputFolder);
            }

            var pf = new ProgressForm(filesToProcess, outputFolder, commandLine);
            pf.Text = "Conversion Progress";
            pf.ShowDialog();
        }
Beispiel #3
0
 public MainLogic(ProgressForm.JobInfo info)
 {
     _info = info;
     _canceled = false;
 }