void SyncThread() { while (isRollin) { if (Token != "" && Token != null && username != "" && ((DateTime.Now - LastBalance).TotalSeconds > 15 || ForceUpdateStats)) { try { string sEmitResponse2 = Client.GetStringAsync("customer/sync").Result; RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats2.success) { balance = (decimal.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateBalance(balance); } LastBalance = DateTime.Now; } catch (Exception e) { Parent.updateStatus(e.Message); } } System.Threading.Thread.Sleep(500); } }
void SyncThread() { while (isRollin) { if (Token != "" && Token != null && username != "" && (DateTime.Now - LastBalance).TotalSeconds > 15) { try { HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); if (Prox != null) { betrequest2.Proxy = Prox; } betrequest2.CookieContainer = Cookies; betrequest2.Headers.Add("X-CSRF-Token", Token); HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats2.success) { balance = (double.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0); Parent.updateBalance(balance); } LastBalance = DateTime.Now; } catch (Exception e) { Parent.updateStatus(e.Message); } } System.Threading.Thread.Sleep(500); } }
void PlaceBetThread(object _High) { try { lastbet = DateTime.Now; bool High = (bool)_High; double tmpchance = High ? 99.99 - chance : chance; Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low")); List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("bet_amount", (amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("bet_number", tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("prediction", High ? "bigger" : "smaller")); pairs.Add(new KeyValuePair <string, string>("seed", R.Next(int.MaxValue).ToString())); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string sEmitResponse = Client.PostAsync("games/dice/play", Content).Result.Content.ReadAsStringAsync().Result; RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse); if (tmp.errors != null && tmp.errors.Length > 0) { Parent.updateStatus(tmp.errors[0]); } else { Bet tmp2 = tmp.ToBet(); tmp2.serverhash = server_hash; server_hash = tmp.customer.server_hash; balance = double.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; bets = tmp.statistics.bets; losses = tmp.statistics.losses; profit = double.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0; wagered = double.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0; wins = (tmp.statistics.wins); LastBalance = DateTime.Now; FinishedBet(tmp2); retrycount = 0; } } catch (Exception E) { if (retrycount++ < 3) { PlaceBetThread(High); return; } Parent.updateStatus(E.Message); if (Parent.logging > 1) { using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(E.Message); sw.WriteLine(E.StackTrace); sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data)); } } } }
public override bool Register(string username, string password) { this.username = username; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); Token = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return(false); } HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/settings/username"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; string post = string.Format("username={0}", username); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/settings/password"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; post = string.Format("old=&new={0}&confirm={0}", password); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } EmitResponse = (HttpWebResponse)betrequest.GetResponse(); sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinLoginStats tmpStats = json.JsonDeserialize <RollinLoginStats>(sEmitResponse2); //https://rollin.io/api/customer/sync betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); if (Prox != null) { betrequest2.Proxy = Prox; } betrequest2.CookieContainer = cookies; betrequest2.Headers.Add("X-CSRF-Token", Token); EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null };; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); ClientHandlr.CookieContainer = this.Cookies; Client.DefaultRequestHeaders.Add("X-CSRF-Token", Token); GetDeposit(); balance = decimal.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; //i assume bets = tmpStats.user.bets; profit = decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWagered(decimal.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWins(tmpStats.user.wins); isRollin = true; Thread t = new Thread(new ThreadStart(SyncThread)); t.Start(); finishedlogin(true); return(true); } finishedlogin(false); return(false); }
void PlaceBetThread(object _High) { try { PlaceBetObj tmp9 = _High as PlaceBetObj; bool High = tmp9.High; decimal amount = tmp9.Amount; decimal chance = tmp9.Chance; lastbet = DateTime.Now; //bool High = (bool)_High; decimal tmpchance = High ? maxRoll - chance : chance; string sendchance = tmpchance.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo); Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low")); string jsoncontent = json.JsonSerializer <RollinBetPlace>(new RollinBetPlace { bet_amount = decimal.Parse((amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo), System.Globalization.NumberFormatInfo.InvariantInfo), bet_number = decimal.Parse(sendchance, System.Globalization.NumberFormatInfo.InvariantInfo), prediction = High ? "bigger" : "smaller", seed = R.Next(int.MaxValue).ToString() }); StringContent Content = new StringContent(jsoncontent, Encoding.UTF8, "application/json"); Client.DefaultRequestHeaders.Remove("X-API-Nonce"); string x = mfagenerator.GetCode(Key); Client.DefaultRequestHeaders.Add("X-API-Nonce", x); HttpResponseMessage tmpresp = Client.PostAsync("games/dice/play", Content).Result; string sEmitResponse = tmpresp.Content.ReadAsStringAsync().Result; RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse); if (tmp.errors != null && tmp.errors.Length > 0) { Parent.updateStatus(tmp.errors[0]); } else { Bet tmp2 = tmp.ToBet(); tmp2.serverhash = server_hash; server_hash = tmp.customer.server_hash; balance = decimal.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; bets = tmp.statistics.bets; losses = tmp.statistics.losses; profit = decimal.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wagered = decimal.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0m; wins = (tmp.statistics.wins); LastBalance = DateTime.Now; tmp2.date = DateTime.Now; FinishedBet(tmp2); retrycount = 0; } } catch (Exception E) { if (retrycount++ < 3) { PlaceBetThread(High); return; } Parent.updateStatus(E.Message); if (Parent.logging > 1) { using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(E.Message); sw.WriteLine(E.StackTrace); sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data)); } } } }
public override void Login(string Username, string Password, string twofa) { try { this.username = Username; Token = Password; Key = twofa; var cookies = new CookieContainer(); string csrftoken = ""; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } //var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); csrftoken = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return; } /* * HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/login"); * if (Prox != null) * betrequest.Proxy = Prox; * betrequest.CookieContainer = cookies; * * betrequest.Method = "POST"; * * string post = string.Format("username={0}&password={1}&code={2}", Username, Password, twofa); * betrequest.ContentLength = post.Length; * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; * betrequest.Headers.Add("X-API-KEY", Token); * using (var writer = new StreamWriter(betrequest.GetRequestStream())) * { * * writer.Write(post); * } * HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); * string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); * if (!sEmitResponse.ToLower().Contains("true")) * { * finishedlogin(false); * return; * } * this.Cookies = cookies; * HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); * HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); * string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); * RollinLoginStats tmpStats = json.JsonDeserialize<RollinLoginStats>(sEmitResponse2); * * //https://rollin.io/api/customer/sync * betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); * if (Prox != null) * betrequest2.Proxy = Prox; * betrequest2.CookieContainer = cookies; * betrequest2.Headers.Add("X-CSRF-Token", Token); * EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); * */ ClientHandlr = new HttpClientHandler { UseCookies = true, CookieContainer = cookies, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null };; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); ClientHandlr.CookieContainer = this.Cookies; Client.DefaultRequestHeaders.Add("Origin", "https://rollin.com"); Client.DefaultRequestHeaders.Add("X-API-Key", Token); Client.DefaultRequestHeaders.Add("X-CSRF-Token", csrftoken); /*finishedlogin(true); * return;*/ Client.DefaultRequestHeaders.Remove("X-API-Nonce"); Client.DefaultRequestHeaders.Add("X-API-Nonce", mfagenerator.GetCode(Key)); string sEmitResponse2 = Client.GetStringAsync("customer/info?username="******"X-API-Nonce"); Client.DefaultRequestHeaders.Add("X-API-Nonce", mfagenerator.GetCode(Key)); sEmitResponse2 = Client.GetStringAsync("customer/sync").Result; RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { /*ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression= DecompressionMethods.Deflate| DecompressionMethods.GZip, Proxy= this.Prox, UseProxy=Prox!=null };; * Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") };*/ GetDeposit(); balance = decimal.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; //i assume bets = tmpStats.user.bets; profit = decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWagered(decimal.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWins(tmpStats.user.wins); isRollin = true; Thread t = new Thread(new ThreadStart(SyncThread)); t.Start(); finishedlogin(true); return; } } catch (WebException e) { string s = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); } catch (Exception e) { } finishedlogin(false); }
void PlaceBetThread(object _High) { try { lastbet = DateTime.Now; bool High = (bool)_High; Parent.updateStatus(string.Format("Betting: {0:0.00000000} at {1:0.00000000} {2}", amount, chance, High ? "High" : "Low")); HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/games/dice/play"); betrequest.CookieContainer = Cookies; betrequest.Headers.Add("X-CSRF-Token", Token); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.Method = "POST"; double tmpchance = High ? 99.99 - chance : chance; string post = string.Format("bet_amount={0}&bet_number={1}&prediction={2}&seed={3}", (amount * 1000).ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo), tmpchance.ToString("0.00", System.Globalization.NumberFormatInfo.InvariantInfo), High ? "bigger" : "smaller", R.Next(int.MaxValue)); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); RollinBet tmp = json.JsonDeserialize <RollinBet>(sEmitResponse); if (tmp.errors != null && tmp.errors.Length > 0) { Parent.updateStatus(tmp.errors[0]); } else { Bet tmp2 = tmp.ToBet(); tmp2.serverhash = server_hash; server_hash = tmp.customer.server_hash; balance = double.Parse(tmp.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; bets = tmp.statistics.bets; losses = tmp.statistics.losses; profit = double.Parse(tmp.statistics.profit, System.Globalization.CultureInfo.InvariantCulture) / 1000.0; wagered = double.Parse(tmp.statistics.wagered, System.Globalization.CultureInfo.InvariantCulture) / 1000.0; wins = (tmp.statistics.wins); LastBalance = DateTime.Now; FinishedBet(tmp2); } } catch (Exception E) { Parent.updateStatus(E.Message); if (Parent.logging > 1) { using (StreamWriter sw = File.AppendText("log.txt")) { sw.WriteLine(E.Message); sw.WriteLine(E.StackTrace); sw.WriteLine(json.JsonSerializer <System.Collections.IDictionary> (E.Data)); } } } }
public override void Login(string Username, string Password, string twofa) { try { this.username = Username; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); Token = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return; } HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/login"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; string post = string.Format("username={0}&password={1}&code={2}", Username, Password, twofa); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); if (!sEmitResponse.ToLower().Contains("true")) { finishedlogin(false); return; } this.Cookies = cookies; HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinLoginStats tmpStats = json.JsonDeserialize <RollinLoginStats>(sEmitResponse2); //https://rollin.io/api/customer/sync betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); if (Prox != null) { betrequest2.Proxy = Prox; } betrequest2.CookieContainer = cookies; betrequest2.Headers.Add("X-CSRF-Token", Token); EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { GetDeposit(); balance = double.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; //i assume bets = tmpStats.user.bets; profit = double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0); Parent.updateWagered(double.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0); Parent.updateWins(tmpStats.user.wins); finishedlogin(true); return; } } catch { } finishedlogin(false); }