private async void button1_Click(object sender, EventArgs e) { Logging.ToggleVisible(); button1.ToggleVisible(); button2.ToggleVisible(); var server = comboBox1.SelectedItem == null ? string.Empty : comboBox1?.SelectedItem.ToString(); string responseAuth; if (server == string.Empty) { responseAuth = await Login("int7"); } else { responseAuth = await Login(server); } if (string.IsNullOrEmpty(responseAuth)) { Logging.ToggleVisible(); button1.ToggleVisible(); button2.ToggleVisible(); MessageBox.Show(@"Error during LogIn"); return; } Console.WriteLine(@"Setting Cookies"); var authCookie = http.GetResponseHeader("Set-Cookie"); var authBpSecureSid = authCookie.Substring("dosid=", "; path=/"); Console.WriteLine(@"Parsing new account to memory"); tempAccount = new Account { Nick = UsernameText.Text, Password = PassText.Text, DOSID = authBpSecureSid }; accountFactory.AddData(tempAccount); var account = accountFactory.GetAccountFromMD5HashName(Cryptography.GetStringMD5Hash(MD5.Create(), UsernameText.Text)); account.Logged = true; account.Premium = premium; account.Server = "int7"; accountFactory.LoggedAccount = account; Console.WriteLine(@"Parsing done"); Console.WriteLine(@"Initializing data grid view"); await UpdateDataGridView(true); //UpdateWorker.RunWorkerAsync(); await SetupGates(); var uri = new UriBuilder( $"https://{accountFactory.LoggedAccount.Server}.darkorbit.com/indexInternal.es?action=internalStart&acceptDailyLoginBonus=1") .Uri; Console.WriteLine($"{uri.AbsoluteUri}\nCookie"); foreach (Cookie cookie in http.Cookies.GetCookies(uri)) { Console.WriteLine($"\t{cookie.Name} : {cookie.Value} /*{cookie.Comment}*/"); } if (webBrowser1.Document != null) { var browserCookie = webBrowser1.Document?.Cookie; var cookies = browserCookie?.Split(' '); browserCookie = string.Empty; for (var i = 0; i < cookies?.Length; i++) { var temp = cookies[i]; var subS = cookies[i].Trim(); var replace = string.Empty; if (subS.StartsWith("dosid")) { var hash = subS.Substring("dosid=", ";"); replace = subS.Replace(hash, accountFactory.LoggedAccount.DOSID); } if (!string.IsNullOrEmpty(replace)) { browserCookie += $"{replace} "; } else { browserCookie += $"{temp} "; } } var url = new UriBuilder($"https://{accountFactory.LoggedAccount.Server}.darkorbit.bigpoint.com/" + $"indexInternal.es?action=internalMapRevolution&dosid={accountFactory.LoggedAccount.DOSID}").Uri; if (url.SetCookie(accountFactory.LoggedAccount.DOSID)) { try { webBrowser1.Navigate(url); } catch (Exception ex) { Console.WriteLine(ex); } } else { Console.WriteLine(@"Error Setting Cookie"); } } Logging.ToggleVisible(); button1.ToggleVisible(); button2.ToggleVisible(); Start.ToggleActive(); Stop.ToggleActive(); }