POSTリクエストからの応答を取得するコードがあります。
//Запрос авторизации бухаря
WebRequest request = WebRequest.Create("http://clannr.org/scripts/login/auth.php");
request.Method = "POST";
string postData = "user=" + Login.Text + "&password=" + Password.Text + "&version=13";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
しかし、応答を確認するとき:
Match match = regex.Match(responseFromServer);
if (match.Success)
{
var input = responseFromServer;
var split = input.Split(':');
var final = split[3];
ProcessStartInfo mcStartInfo = new ProcessStartInfo("javaw", "-Xms1024m -Xmx1024m -cp \"" + appData + "\\.ClanNR\\bin\\minecraft1.jar;" + appData + "\\.ClanNR\\bin\\jinput.jar;" + appData + "\\.ClanNR\\bin\\lwjgl.jar;" + appData + "\\.ClanNR\\bin\\lwjgl_util.jar \" -Djava.library.path=\"" + appData + "\\.ClanNR\\bin\\natives\" net.minecraft.client.Minecraft" + " " + username + " " + final + " " + server1);
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!");
}
私のコードは2つの関数、つまりshow2MessageBoxを呼び出しました
それを修正する方法は?
更新しました