Skip to content

Instantly share code, notes, and snippets.

@JmPotato
Last active December 20, 2015 23:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JmPotato/6209776 to your computer and use it in GitHub Desktop.
Save JmPotato/6209776 to your computer and use it in GitHub Desktop.
Minecraft 正版验证
try
{
label7.Text = "登录中...";
string url = "https://login.minecraft.net/?user=" + Program.username + "&password=" + password + "&version=13";
WebClient client = new WebClient();
Stream data = client.OpenRead(url);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
Console.WriteLine(s);
data.Close();
reader.Close();
string[] loginResult = s.Split(':');
Program.login_parameter = "\"" + loginResult[2] + "\" \"" + loginResult[3] + "\"";
Program.login = true;
label7.Text = "已登录";
MessageBox.Show("验证成功!");
}
catch (Exception)
{
MessageBox.Show("验证失败!请确认用户名或密码正确!");
label7.Text = "登录失败";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment