Skip to content

Instantly share code, notes, and snippets.

@JmPotato
Last active Dec 20, 2015
Embed
What would you like to do?
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