void GetBalanceThread() { while (IsBitsler) { if ((DateTime.Now - lastupdate).TotalSeconds > 15) { lastupdate = DateTime.Now; try { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("getuserstats", Content).Result.Content.ReadAsStringAsync().Result; bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsstatsbase != null) { if (bsstatsbase._return != null) { if (bsstatsbase._return.success == "true") { switch (Currency.ToLower()) { case "btc": balance = bsstatsbase._return.btc_balance; profit = bsstatsbase._return.btc_profit; wagered = bsstatsbase._return.btc_wagered; break; case "ltc": balance = bsstatsbase._return.ltc_balance; profit = bsstatsbase._return.ltc_profit; wagered = bsstatsbase._return.ltc_wagered; break; case "doge": balance = bsstatsbase._return.doge_balance; profit = bsstatsbase._return.doge_profit; wagered = bsstatsbase._return.doge_wagered; break; } bets = int.Parse(bsstatsbase._return.bets); wins = int.Parse(bsstatsbase._return.wins); losses = int.Parse(bsstatsbase._return.losses); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); } else { if (bsstatsbase._return.value != null) { Parent.updateStatus(bsstatsbase._return.value); } } } } } catch { } } Thread.Sleep(1000); } }
void GetBalanceThread() { while (IsBitsler) { if ((DateTime.Now - lastupdate).TotalSeconds > 60 || ForceUpdateStats) { lastupdate = DateTime.Now; try { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); HttpResponseMessage resp = Client.PostAsync("api/getuserstats", Content).Result; string s1 = ""; string sEmitResponse = "";// resp.Content.ReadAsStringAsync().Result; if (resp.IsSuccessStatusCode) { sEmitResponse = resp.Content.ReadAsStringAsync().Result; } else { sEmitResponse = ""; if (resp.StatusCode == HttpStatusCode.ServiceUnavailable) { s1 = resp.Content.ReadAsStringAsync().Result; //cflevel = 0; System.Threading.Tasks.Task.Factory.StartNew(() => { System.Windows.Forms.MessageBox.Show(Name + " has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute."); }); if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "www.bitsler.com")) { //return; } } else { } } if (sEmitResponse != "") { bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsstatsbase != null) { if (bsstatsbase._return != null) { if (bsstatsbase._return.success == "true") { switch (Currency.ToLower()) { case "btc": balance = bsstatsbase._return.btc_balance; profit = bsstatsbase._return.btc_profit; wagered = bsstatsbase._return.btc_wagered; break; case "ltc": balance = bsstatsbase._return.ltc_balance; profit = bsstatsbase._return.ltc_profit; wagered = bsstatsbase._return.ltc_wagered; break; case "doge": balance = bsstatsbase._return.doge_balance; profit = bsstatsbase._return.doge_profit; wagered = bsstatsbase._return.doge_wagered; break; case "eth": balance = bsstatsbase._return.eth_balance; profit = bsstatsbase._return.eth_profit; wagered = bsstatsbase._return.eth_wagered; break; case "burst": balance = bsstatsbase._return.burst_balance; profit = bsstatsbase._return.burst_profit; wagered = bsstatsbase._return.burst_wagered; break; case "dash": balance = bsstatsbase._return.dash_balance; profit = bsstatsbase._return.dash_profit; wagered = bsstatsbase._return.dash_wagered; break; case "zec": balance = bsstatsbase._return.zec_balance; profit = bsstatsbase._return.zec_profit; wagered = bsstatsbase._return.zec_wagered; break; case "bch": balance = bsstatsbase._return.bch_balance; profit = bsstatsbase._return.bch_profit; wagered = bsstatsbase._return.bch_wagered; break; case "xmr": balance = bsstatsbase._return.xmr_balance; profit = bsstatsbase._return.xmr_profit; wagered = bsstatsbase._return.xmr_wagered; break; case "etc": balance = bsstatsbase._return.etc_balance; profit = bsstatsbase._return.etc_profit; wagered = bsstatsbase._return.etc_wagered; break; } bets = int.Parse(bsstatsbase._return.bets); wins = int.Parse(bsstatsbase._return.wins); losses = int.Parse(bsstatsbase._return.losses); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); } else { if (bsstatsbase._return.value != null) { Parent.updateStatus(bsstatsbase._return.value); } } } } } } catch { } } Thread.Sleep(1000); } }
public override void Login(string Username, string Password, string twofa) { string error = ""; ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null }; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://www.bitsler.com/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); Client.DefaultRequestHeaders.Add("User-Agent", "DiceBot"); try { string actual2fa = ""; if (twofa.Contains("&")) { string[] pars = twofa.Split('&'); actual2fa = pars[1]; twofa = pars[0]; } HttpResponseMessage resp = Client.GetAsync("https://www.bitsler.com").Result; string s1 = ""; if (resp.IsSuccessStatusCode) { s1 = resp.Content.ReadAsStringAsync().Result; } else { if (resp.StatusCode == HttpStatusCode.ServiceUnavailable) { s1 = resp.Content.ReadAsStringAsync().Result; //cflevel = 0; System.Threading.Tasks.Task.Factory.StartNew(() => { System.Windows.Forms.MessageBox.Show(Name + " has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute."); }); if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "www.bitsler.com")) { return; } } else { } } List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("username", Username)); pairs.Add(new KeyValuePair <string, string>("password", Password)); //pairs.Add(new KeyValuePair<string, string>("api_key", "0b2edbfe44e98df79665e52896c22987445683e78")); if (!string.IsNullOrWhiteSpace(actual2fa)) { pairs.Add(new KeyValuePair <string, string>("twofactor", actual2fa)); } pairs.Add(new KeyValuePair <string, string>("api_key", twofa)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); HttpResponseMessage tmpresp = Client.PostAsync("api/login", Content).Result; byte[] bytes = tmpresp.Content.ReadAsByteArrayAsync().Result; string sEmitResponse = tmpresp.Content.ReadAsStringAsync().Result; //getuserstats bsloginbase bsbase = json.JsonDeserialize <bsloginbase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsbase != null) { if (bsbase._return != null) { if (bsbase._return.success == "true") { accesstoken = bsbase._return.access_token; IsBitsler = true; lastupdate = DateTime.Now; pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); Content = new FormUrlEncodedContent(pairs); sEmitResponse = Client.PostAsync("api/getuserstats", Content).Result.Content.ReadAsStringAsync().Result; bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsstatsbase != null) { if (bsstatsbase._return != null) { if (bsstatsbase._return.success == "true") { switch (Currency.ToLower()) { case "btc": balance = bsstatsbase._return.btc_balance; profit = bsstatsbase._return.btc_profit; wagered = bsstatsbase._return.btc_wagered; break; case "ltc": balance = bsstatsbase._return.ltc_balance; profit = bsstatsbase._return.ltc_profit; wagered = bsstatsbase._return.ltc_wagered; break; case "doge": balance = bsstatsbase._return.doge_balance; profit = bsstatsbase._return.doge_profit; wagered = bsstatsbase._return.doge_wagered; break; case "eth": balance = bsstatsbase._return.eth_balance; profit = bsstatsbase._return.eth_profit; wagered = bsstatsbase._return.eth_wagered; break; case "burst": balance = bsstatsbase._return.burst_balance; profit = bsstatsbase._return.burst_profit; wagered = bsstatsbase._return.burst_wagered; break; case "dash": balance = bsstatsbase._return.dash_balance; profit = bsstatsbase._return.dash_profit; wagered = bsstatsbase._return.dash_wagered; break; case "zec": balance = bsstatsbase._return.zec_balance; profit = bsstatsbase._return.zec_profit; wagered = bsstatsbase._return.zec_wagered; break; case "bch": balance = bsstatsbase._return.bch_balance; profit = bsstatsbase._return.bch_profit; wagered = bsstatsbase._return.bch_wagered; break; case "xmr": balance = bsstatsbase._return.xmr_balance; profit = bsstatsbase._return.xmr_profit; wagered = bsstatsbase._return.xmr_wagered; break; case "etc": balance = bsstatsbase._return.etc_balance; profit = bsstatsbase._return.etc_profit; wagered = bsstatsbase._return.etc_wagered; break; } bets = int.Parse(bsstatsbase._return.bets == null?"0": bsstatsbase._return.bets); wins = int.Parse(bsstatsbase._return.wins == null ? "0" : bsstatsbase._return.wins); losses = int.Parse(bsstatsbase._return.losses == null ? "0" : bsstatsbase._return.losses); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); this.username = Username; } else { if (bsstatsbase._return.value != null) { Parent.updateStatus(bsstatsbase._return.value); } } } } IsBitsler = true; Thread t = new Thread(GetBalanceThread); t.Start(); finishedlogin(true); return; } else { if (bsbase._return.value != null) { Parent.updateStatus(bsbase._return.value); } } } } } catch (Exception e) { Parent.DumpLog(e.ToString(), 0); } finishedlogin(false); }
protected override void CurrencyChanged() { base.CurrencyChanged(); lastupdate = DateTime.Now; if (accesstoken != "" && IsBitsler) { try { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("api/getuserstats", Content).Result.Content.ReadAsStringAsync().Result; bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsstatsbase != null) { if (bsstatsbase._return != null) { if (bsstatsbase._return.success == "true") { switch (Currency.ToLower()) { case "btc": balance = bsstatsbase._return.btc_balance; profit = bsstatsbase._return.btc_profit; wagered = bsstatsbase._return.btc_wagered; break; case "ltc": balance = bsstatsbase._return.ltc_balance; profit = bsstatsbase._return.ltc_profit; wagered = bsstatsbase._return.ltc_wagered; break; case "doge": balance = bsstatsbase._return.doge_balance; profit = bsstatsbase._return.doge_profit; wagered = bsstatsbase._return.doge_wagered; break; case "eth": balance = bsstatsbase._return.eth_balance; profit = bsstatsbase._return.eth_profit; wagered = bsstatsbase._return.eth_wagered; break; case "burst": balance = bsstatsbase._return.burst_balance; profit = bsstatsbase._return.burst_profit; wagered = bsstatsbase._return.burst_wagered; break; case "dash": balance = bsstatsbase._return.dash_balance; profit = bsstatsbase._return.dash_profit; wagered = bsstatsbase._return.dash_wagered; break; case "zec": balance = bsstatsbase._return.zec_balance; profit = bsstatsbase._return.zec_profit; wagered = bsstatsbase._return.zec_wagered; break; case "bch": balance = bsstatsbase._return.bch_balance; profit = bsstatsbase._return.bch_profit; wagered = bsstatsbase._return.bch_wagered; break; case "xmr": balance = bsstatsbase._return.xmr_balance; profit = bsstatsbase._return.xmr_profit; wagered = bsstatsbase._return.xmr_wagered; break; case "etc": balance = bsstatsbase._return.etc_balance; profit = bsstatsbase._return.etc_profit; wagered = bsstatsbase._return.etc_wagered; break; } bets = int.Parse(bsstatsbase._return.bets); wins = int.Parse(bsstatsbase._return.wins); losses = int.Parse(bsstatsbase._return.losses); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); } else { if (bsstatsbase._return.value != null) { Parent.updateStatus(bsstatsbase._return.value); } } } } } catch { } } }
public override void Login(string Username, string Password, string twofa) { string error = ""; ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null }; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://www.bitsler.com/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); try { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("username", Username)); pairs.Add(new KeyValuePair <string, string>("password", Password)); pairs.Add(new KeyValuePair <string, string>("api_key", "0b2edbfe44e98df79665e52896c22987445683e78")); //if (!string.IsNullOrWhiteSpace(twofa)) { pairs.Add(new KeyValuePair <string, string>("twofactor", twofa)); } FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("login", Content).Result.Content.ReadAsStringAsync().Result; //getuserstats bsloginbase bsbase = json.JsonDeserialize <bsloginbase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsbase != null) { if (bsbase._return != null) { if (bsbase._return.success == "true") { accesstoken = bsbase._return.access_token; IsBitsler = true; lastupdate = DateTime.Now; pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken)); Content = new FormUrlEncodedContent(pairs); sEmitResponse = Client.PostAsync("getuserstats", Content).Result.Content.ReadAsStringAsync().Result; bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":")); if (bsstatsbase != null) { if (bsstatsbase._return != null) { if (bsstatsbase._return.success == "true") { switch (Currency.ToLower()) { case "btc": balance = bsstatsbase._return.btc_balance; profit = bsstatsbase._return.btc_profit; wagered = bsstatsbase._return.btc_wagered; break; case "ltc": balance = bsstatsbase._return.ltc_balance; profit = bsstatsbase._return.ltc_profit; wagered = bsstatsbase._return.ltc_wagered; break; case "doge": balance = bsstatsbase._return.doge_balance; profit = bsstatsbase._return.doge_profit; wagered = bsstatsbase._return.doge_wagered; break; } bets = int.Parse(bsstatsbase._return.bets); wins = int.Parse(bsstatsbase._return.wins); losses = int.Parse(bsstatsbase._return.losses); Parent.updateBalance(balance); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); } else { if (bsstatsbase._return.value != null) { Parent.updateStatus(bsstatsbase._return.value); } } } } IsBitsler = true; Thread t = new Thread(GetBalanceThread); t.Start(); finishedlogin(true); return; } else { if (bsbase._return.value != null) { Parent.updateStatus(bsbase._return.value); } } } } } catch { } finishedlogin(false); }