void metroButton1_Click(object sender, EventArgs e) { this.metroButton1.Enabled = false; using (var WebClient = new WebClient()) { WebClient.Proxy = null; WebClient.Headers.Add("user-agent", Settings.User_Agent); Settings.HWID = Hwid.UserID(); var temp = Authentication.Login( Settings.Username, Settings.Password, Settings.HWID); dynamic Results = JsonConvert.DeserializeObject(temp); WebClient.DownloadProgressChanged += DownloadChanged; WebClient.DownloadDataCompleted += DownloadCompleted; if (Stable) { WebClient.DownloadDataAsync(new Uri(Results.stableurl.ToString())); } if (Beta) { WebClient.DownloadDataAsync(new Uri(Results.betaurl.ToString())); } } }
void metroButton3_Click(object sender, EventArgs e) { /* Register Button */ Settings.Username = metroTextBox5.Text; Settings.Password = metroTextBox6.Text; if (string.IsNullOrEmpty(Settings.Username)) { return; } if (string.IsNullOrEmpty(Settings.Password)) { return; } Settings.HWID = Hwid.UserID(); var temp = Authentication.Register( Settings.Username, Settings.Password, Settings.HWID); dynamic Results = JsonConvert.DeserializeObject(temp); switch (bool.Parse(Results.Authenticated.ToString())) { case true: MessageBox.Show(Results.Description.ToString()); break; case false: MessageBox.Show(Results.Description.ToString()); break; default: MessageBox.Show("connection error"); break; } }
void metroButton2_Click(object sender, EventArgs e) { /* Login Button */ Settings.Username = metroTextBox4.Text; Settings.Password = metroTextBox3.Text; if (string.IsNullOrEmpty(Settings.Username)) { return; } if (string.IsNullOrEmpty(Settings.Password)) { return; } Settings.HWID = Hwid.UserID(); var temp = Authentication.Login( Settings.Username, Settings.Password, Settings.HWID); dynamic Results = JsonConvert.DeserializeObject(temp); Settings.Username = Results.Username.ToString(); Settings.Expires = Results.Expires.ToString(); switch (bool.Parse(Results.Authenticated.ToString())) { case true: var StreamWriter = new System.IO.StreamWriter(System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "HyperHook\\Credentials") ); StreamWriter.WriteLine(Extensions.Base64Encode(Settings.Username)); StreamWriter.WriteLine(Extensions.Base64Encode(Settings.Password)); StreamWriter.Close(); Settings.Betastatus = int.Parse(Results.Betastatus.ToString()); MessageBox.Show(Results.Description.ToString()); var Form2 = new Form2(); Hide(); Form2.Closed += (s, args) => Close(); Form2.Show(); break; case false: MessageBox.Show(Results.Description.ToString()); break; default: MessageBox.Show("connection error"); break; } }