private void startServer() { if (isServerRunning()) { return; } if (this.server != null) { this.server.stop(); } ProcessStartInfo info = null; string cmd = null; string args = null; string configfile = createServerConfig(); if (this.checkUseCmd.Checked) { cmd = "cmd.exe"; string scmd = Path.Combine(myPath, "anav.cmd"); if (!File.Exists(scmd)) { MessageBox.Show("server command " + scmd + " not found"); return; } args = cmd + " /K " + scmd; serverStartedWithCmd = true; } else { cmd = Path.Combine(serverpath, "avnav_server.py"); if (!File.Exists(cmd)) { MessageBox.Show("server command " + cmd + " not found"); return; } args = ""; serverStartedWithCmd = false; } info = new ProcessStartInfo(cmd); args += " -c \"" + Path.Combine(textOutdir.Text, "out") + "\" "; args += " -u \"viewer=" + viewerpath + "\""; args += " \"" + configfile + "\""; info.Arguments = args; info.RedirectStandardInput = false; info.RedirectStandardOutput = false; info.UseShellExecute = true; info.WorkingDirectory = scriptpath; serverProcess = new Process(); serverProcess.StartInfo = info; if (this.rbModeTest.Checked) { double delayS = 0.3; try { char a = Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); delayS = Convert.ToDouble(txTestDelay.Text.Replace(',', a).Replace('.', a)); } catch (Exception e) { MessageBox.Show("invalid delay time " + txTestDelay.Text + ", using 0.3s"); } this.server = new SocketServer(this.txTestData.Text, Convert.ToInt32(txTestPort.Text), Convert.ToInt32(delayS * 1000)); this.server.start(); } serverProcess.Start(); this.lbServerRunning.Text = "Server pid " + serverProcess.Id; this.lbServerRunning.ForeColor = System.Drawing.Color.FromArgb(0, 192, 0); this.btnStopServer.Visible = true; if (cbBrowser.Checked) { Process.Start(tbUrl.Text); } }