/* Name: confirmLoginCredentials() Description: As the name implies, this method is called and used to validate that the user has entered the correct login credentials and a correct IPv4 address to connect to the server Parameter(s): None Return: bool status indicating if the login credentials were entered correctly or incorrectly. Or if IPv4 was not correct. */ private bool confirmLoginCredentials() { clientConnect = null; int port = 9000; bool retStatus = false; if (IP_Address.Text == "") { login_Error_Msg.Text = "*Do not leave IP Adress blank!"; login_Error_Msg.Visible = true; //Show error message } login_Error_Msg.Visible = false; //Show error message try { clientConnect = new TriviaLib.TCPIPconnectorClient(port, IPAddress.Parse(IP_Address.Text)); //Entered IPv4 Address by the user } catch (Exception) { login_Error_Msg.Text = "*Invalid IPv4 Address!"; login_Error_Msg.Visible = true; //Show error message } if (verifyAdminName == "root" && verifyAdminPassword == "root") { try { User admin = new User(); if (clientConnect.Connect() == "") { clientConnect.Send("!admin"); clientConnect.Read(); login_Error_Msg.Visible = false; //Hide the error message when user enters credentials in correctly admin.name = verifyAdminName; admin.password = verifyAdminPassword; clientConnect.Send(User.Serialize(admin)); //Notify the server you want to access admin clientConnect.Read(); //Read the garbage value retStatus = true; //Leave the function with a success and going into the main administrative screen } else { login_Error_Msg.Text = "*Unable to Connect to Server!"; login_Error_Msg.Visible = true; //Show error message } } catch (Exception) { login_Error_Msg.Text = "*Server Unavailable!"; login_Error_Msg.Visible = true; //Show error message } } else { login_Error_Msg.Text = "*Invalid User Name or Password!"; login_Error_Msg.Visible = true; //Show error message } return retStatus; }