可能重复:
错误地检查响应 c#
我有一个代码:
Match match = regex.Match(responseFromServer);
if (match.Success)
{
var input = responseFromServer;
var split = input.Split(':');
var final = split[3];
ProcessStartInfo mcStartInfo = new Shitocode;
Process.Start(mcStartInfo);
this.Close();
}
else if (responseFromServer == " Bad Login")
{
MessageBox.Show("Uncorrect login/password!");
}
else if (responseFromServer == " Old version")
{
MessageBox.Show("Launcher is old!");
}
为什么最后两次检查没有显示消息框?
我试图以不同的方式做事:
if (match.Success)
{
var input = responseFromServer;
var split = input.Split(':');
var final = split[3];
ProcessStartInfo mcStartInfo = new Shitocode;
Process.Start(mcStartInfo);
this.Close();
}
else if (responseFromServer.Equals("Bad Login"))
{
MessageBox.Show("Uncorrect login/password!");
}
else if (responseFromServer.Equals("Old Version"))
{
MessageBox.Show("Launcher is old!");
}
我输入了错误的密码,但没有打开消息框