CNCMaps.GUI.MainForm.GetCommandLine C# (CSharp) Method

GetCommandLine() private method

private GetCommandLine ( ) : string
return string
        private string GetCommandLine()
        {
            string cmd = string.Empty;

            cmd += "-i \"" + tbInput.Text + "\" ";
            if (cbOutputPNG.Checked) {
                cmd += "-p ";
                if (nudCompression.Value != 6)
                    cmd += "-c " + nudCompression.Value.ToString(CultureInfo.InvariantCulture) + " ";
            }

            if (rbCustomFilename.Checked) cmd += "-o \"" + tbCustomOutput.Text + "\" ";
            if (cbOutputJPG.Checked) {
                cmd += "-j ";
                if (nudEncodingQuality.Value != 90)
                    cmd += "-q " + nudEncodingQuality.Value.ToString(CultureInfo.InvariantCulture) + " ";
            }

            if (cbModConfig.Checked)
                cmd += "-M \"" + tbModConfig.Text + "\" ";
            else if (!string.IsNullOrWhiteSpace(tbMixDir.Text) && tbMixDir.Text != FindMixDir(rbEngineAuto.Checked || rbEngineRA2.Checked || rbEngineYR.Checked))
                cmd += "-m " + "\"" + tbMixDir.Text + "\" ";

            if (cbEmphasizeOre.Checked) cmd += "-r ";
            if (cbTiledStartPositions.Checked) cmd += "-s ";
            if (cbSquaredStartPositions.Checked) cmd += "-S ";

            if (rbEngineRA2.Checked) cmd += "-y ";
            else if (rbEngineYR.Checked) cmd += "-Y ";
            else if (rbEngineTS.Checked) cmd += "-t ";
            else if (rbEngineFS.Checked) cmd += "-T ";

            if (rbSizeLocal.Checked) cmd += "-f ";
            else if (rbSizeFullmap.Checked) cmd += "-F ";

            //if (rbPreferSoftwareRendering.Checked) cmd += "-g ";
            //else if (rbPreferHardwareRendering.Checked) cmd += "-G ";

            if (cbReplacePreview.Checked)
                cmd += cbOmitSquareMarkers.Checked ? "-K" : "-k ";

            if (cbOutputThumbnail.Checked) {
                var wh = tbThumbDimensions.Text.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
                int w, h;
                if (wh.Count == 2 && int.TryParse(wh[0], out w) && int.TryParse(wh[1], out h)) {
                    cmd += "-z ";
                    if (cbPreserveThumbAspect.Checked)
                        cmd += "+";
                    cmd += string.Format("({0},{1})", w, h);
                }
                if (!cmd.EndsWith(" ")) cmd += " ";
                if (cbMarkersType.Text == "None")
                    cmd += "--preview-markers-none ";
                else if (cbMarkersType.Text == "Squared")
                    cmd += "--preview-markers-squared ";
                else if (cbMarkersType.Text == "Aro")
                    cmd += "--preview-markers-aro ";
                else if (cbMarkersType.Text == "Bittah")
                    cmd += "--preview-markers-bittah ";
            }

            return cmd;
        }