private void btnSend_Click(object sender, EventArgs e) { if (AdvancedMode == false) { if (cmbBoxCommand1.SelectedItem == "Get") { string[] args = { "-h", txtboxAddress1.Text, txtboxName1.Text }; ClientClass.ExecuteClient(args); richTextBox1.Text = ClientClass.serverResponseText; txtboxLocation1.Text = ClientClass.location; } else //update { string[] args = { "-h", txtboxAddress1.Text, txtboxName1.Text, txtboxLocation1.Text }; ClientClass.ExecuteClient(args); richTextBox1.Text = ClientClass.serverResponseText; } } else { string protocol = ""; if (radioButtonWhoIs.Checked == true) { protocol = "-w"; } if (radioButtonHttp0_9.Checked == true) { protocol = "-h9"; } if (radioButtonHttp1_0.Checked == true) { protocol = "-h0"; } if (radioButtonHttp1_1.Checked == true) { protocol = "-h1"; } if (cmbBoxCommand1.SelectedItem == "Get") { string[] args = { "-h", txtboxAddress1.Text, txtboxName1.Text, protocol, "-p", txtboxPort.Text }; ClientClass.ExecuteClient(args); richTextBox1.Text = ClientClass.serverResponseText; txtboxLocation1.Text = ClientClass.location; } else //update { string[] args = { "-h", txtboxAddress1.Text, txtboxName1.Text, txtboxLocation1.Text, protocol, "-p", txtboxPort.Text }; ClientClass.ExecuteClient(args); richTextBox1.Text = ClientClass.serverResponseText; } } }
static void Main(string[] args) { //A windows form is launched when no arguments are sent into the program. //Else it passes the arguments onto the client class and executes the server. if (args.Length == 0) { Console.WriteLine("Windows form launched."); MainForm f = new MainForm(); Application.Run(f); } else { ClientClass.ExecuteClient(args); } }