public bool Login(CGenericServerWrapper server) { if (!Validate()) { return(false); } string network_name = Settings.Default.NetworkName; string initial_key = Settings.Default.InitialKey; string local_ip = GeneralSettings.LocalAddress.ToString(); _looger.Log(String.Format("Connecting through Network interface with address: {0}", local_ip)); try { bool res = server.OpenConnection(network_name, ServerAddress, ServerPort, initial_key, local_ip, UserName, Password); if (!res) { server.Close(); } return(res); } catch (Exception e) { _looger.Log(String.Format("Error: {0}", e.Message)); MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public bool Login(CGenericServerWrapper server) { if (!Validate()) { return false; } string network_name = Settings.Default.NetworkName; string initial_key = Settings.Default.InitialKey; string local_ip = GeneralSettings.LocalAddress.ToString(); _looger.Log(String.Format("Connecting through Network interface with address: {0}", local_ip)); try { bool res = server.OpenConnection(network_name, ServerAddress, ServerPort, initial_key, local_ip, UserName, Password); if (!res) { server.Close(); } return res; } catch (Exception e) { _looger.Log(String.Format("Error: {0}", e.Message)); MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
private void btnDisconnect_Click(object sender, EventArgs e) { _server.Close(); }