private void OKbutton_Click(object sender, System.EventArgs e) { Registry_Settings.Write("test_server", this.textBoxServer.Text); try { int x = System.Int32.Parse(this.textBoxPort.Text); Registry_Settings.Write("test_port", this.textBoxPort.Text); } catch { } this.Close(); }
public SubmitServerForm() { // // Required for Windows Form Designer support // InitializeComponent(); if (Component.BARTPE) { this.textBoxServer.Text = "localhost"; this.textBoxPort.Enabled = false; } string ts = Registry_Settings.Read("test_server"); string tp = Registry_Settings.Read("test_port"); if (ts != null) { this.textBoxServer.Text = ts; } if (tp != null) { this.textBoxPort.Text = tp; } this.Refresh_List(); }
public static void submitHelper() { string filename = submit_filename; bool remember = Component.compiled_flowchart; string s; int num_input_files = 0; bool passed = true; // directory is a special case-- don't allow it if (filename.ToLower() == "directory") { MessageBox.Show("No tests found for: " + filename + "\n\nUse Save As to change filename.\n" + "View available tests using Select Server (Run menu).", "Check filename", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // connect to server and test try { try { string ts = Registry_Settings.Read("test_server"); string tp = Registry_Settings.Read("test_port"); if (!Component.BARTPE) { Connect_To_Server(ts, System.Int32.Parse(tp)); } else { Connect_To_Executable(); } } catch (System.Exception e) { throw new System.Exception(); } try { //string x = this.assignmentsCombo.SelectedItem+"\r\n"; string x = filename + "\r\n"; byte[] buffer = System.Text.Encoding.ASCII.GetBytes(x); if (!Component.BARTPE) { raptor_files_pkg.current_socket.Send(buffer); } else { process.StandardInput.WriteLine(filename); process.StandardInput.Flush(); } } catch { MessageBox.Show("Server terminated abnormally.", "Server failed", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new System.Exception(); } try { if (Component.BARTPE && !process.StandardOutput.EndOfStream) { s = process.StandardOutput.ReadLine(); num_input_files = System.Int32.Parse(s); } else { s = raptor_files_pkg.get_line(); num_input_files = System.Int32.Parse(s); } if (num_input_files == 0) { throw new System.Exception(); } } catch { MessageBox.Show("No tests found for: " + filename + "\n\nUse Save As to change filename.\n" + "View available tests using Select Server (Run menu).", "Check filename", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new System.Exception(); } Runtime.consoleClear(); Component.run_compiled_flowchart = true; try { Compile_Helpers.Compile_Flowchart(Runtime.parent.carlisle.TabPages); } catch (parse_tree.emit_code.illegal_code e) { MessageBox.Show("Illegal flowchart: no graphics allowed when testing against server."); throw; } catch (System.Exception e) { MessageBox.Show(e.Message + '\n', "Compilation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 1; i <= num_input_files; i++) { System.Threading.ThreadPriority priority = System.Threading.Thread.CurrentThread.Priority; System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.BelowNormal; try { Compile_Helpers.Run_Compiled_NoThread(false); } catch { MessageBox.Show("Program terminated abnormally", "Program error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new System.Exception(); } System.Threading.Thread.CurrentThread.Priority = priority; // send the EOF try { string x = "\r\nEOF\r\n"; byte[] buffer = System.Text.Encoding.ASCII.GetBytes(x); if (!Component.BARTPE) { raptor_files_pkg.current_socket.Send(buffer); } else { process.StandardInput.WriteLine(); process.StandardInput.WriteLine("EOF"); process.StandardInput.Flush(); } } catch { MessageBox.Show("Server terminated abnormally", "Network error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new System.Exception(); } try { // loop until EOF at end of input while (true) { s = raptor_files_pkg.get_line(); } } catch { } try { s = raptor_files_pkg.get_line(); if (s == "INCORRECT") { passed = false; } Runtime.consoleMessage(filename + ": test case #" + i + ": " + s); } catch { Runtime.consoleMessage("no response"); passed = false; } } StopRedirection(); if (passed) { Runtime.consoleMessage(filename + ": PASSED"); } else { Runtime.consoleMessage(filename + ": FAILED"); } Component.run_compiled_flowchart = false; } catch (System.Exception e) { try { StopRedirection(); } catch {} Component.run_compiled_flowchart = false; } }