Alright, so I've been trying to fix this for a good while now. I have a "warning" within my code - "Unreachable Code Detected". I'm not sure how to fix this, which is why I'm posting here. Below is the code:
public static byte Authenticate(string UserName, string Password)
{
try
{
MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection);
DataSet DSet = new DataSet();
DataAdapter.Fill(DSet, "Account");
if (DSet != null && DSet.Tables["Account"].Rows.Count > 0)
{
DataRow DR = DSet.Tables["Account"].Rows[0];
string Pass = (string)DR["Password"];
if (Pass == Password || Pass == "")
{
if (Pass == "")
{
MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection);
Command.ExecuteNonQuery();
}
uint LogonCount = (uint)DR["LogonCount"];
LogonCount++;
MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection);
Comm.ExecuteNonQuery();
return Convert.ToByte((uint)DR["LogonType"]);
}
else
return 0;
}
else
return 0;
}
catch (Exception Exc) { General.WriteLine(Exc.ToString()); return 0; General.ServerRestart(); }
}
I don't know how to highlight it red, so I'll post the specific line:
catch (Exception Exc) { General.WriteLine(Exc.ToString()); return 0; General.ServerRestart(); }
The warning is "General".ServerRestart();