private void OptionChanged( object sender, OptionUpdatedEventArgs e ) { _exe.optionsModified(e); }
private void option_accept_Click(object sender, EventArgs e) { int timeout = 0; int tasks = 0; if ( int.TryParse( textBox1.Text, out timeout ) ) { if ( timeout > 0 ) { if ( int.TryParse( textBox2.Text, out tasks ) ) { if ( tasks >= 1 && tasks <= 2000 ) { PortsParserResult ppr = PortsParser.Tryparse( textBox3.Text ); if ( ppr.Result != null ) { OptionUpdatedEventArgs args = new OptionUpdatedEventArgs( new Option() { Ping = option_ping.Checked, Timeout = timeout, Arping = option_ARPing.Checked, Arp = option_ARP.Checked, Dns = option_DNS.Checked, Port = option_port.Checked, PortToTestString = textBox3.Text, MaximumTasks = tasks, NbPacketToSend = (int)option_nbPacketToSend.Value, WaitTime = (int)option_waitTime.Value, TCPPort = (ushort)option_TCPPort.Value, UDPPort = (ushort)option_UDPPort.Value, RandomTCPPort = option_RandomTCPPort.Checked, RandomUDPPort = option_RandomUDPPort.Checked, } ); OptionUpdated( this, args ); this.Close(); } else { MessageBox.Show( "Incorect input for the ports to search", "Error in port format" ); } } else { MessageBox.Show( "The number of running tasks must be between 1 and 2000, 4 is recommended", "Error in tasks format" ); } } else { MessageBox.Show( "Tasks must be a number", "Error in tasks format" ); } } else { MessageBox.Show( "Timeout must be positive", "Error in timeout format" ); } } else { MessageBox.Show( "Timeout must be a number", "Error in timeout format" ); } }