protected override bool internalWithdraw(double Amount, string Address) { try { HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://dadice.com/api/withdraw"); betrequest.Method = "POST"; string post = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "username={0}&key={1}&coin=btc&payee={2}&amount={3:0.00000000}", username, key, Address, Amount); betrequest.ContentLength = post.Length; if (Prox != null) { betrequest.Proxy = Prox; } betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); DADICEBlance tmp = json.JsonDeserialize <DADICEBlance>(sEmitResponse2); return(tmp.status); } catch (Exception E) { Parent.updateStatus(E.Message); } return(false); }
public void GetBalanceThread() { while (this.isdd) { if (username != "" && key != "" && (DateTime.Now - LastBalance).TotalSeconds > 15) { 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>("key", key)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("balance", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize <DADICEBlance>(Resp); } if (tmp.status) { balance = (decimal)tmp.balance; } Parent.updateBalance(balance); } catch (Exception E) { Parent.updateStatus(E.Message); } LastBalance = DateTime.Now; } Thread.Sleep(100); } }
protected override bool internalWithdraw(decimal Amount, string Address) { 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>("key", key)); pairs.Add(new KeyValuePair <string, string>("amount", Amount.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair <string, string>("payee", Address)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("withdraw", Content)) { string sEmitResponse2 = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize <DADICEBlance>(sEmitResponse2); } LastBalance = DateTime.Now.AddMinutes(-1); return(tmp.status); } catch (Exception E) { Parent.updateStatus(E.Message); } return(false); }
public void GetBalanceThread() { while (this.isdd) { if (username != "" && key != "" && (DateTime.Now - LastBalance).TotalSeconds > 15) { try { HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://dadice.com/api/balance"); betrequest.Method = "POST"; string post = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "username={0}&key={1}", username, key); betrequest.ContentLength = post.Length; if (Prox != null) { betrequest.Proxy = Prox; } betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); DADICEBlance tmp = json.JsonDeserialize <DADICEBlance>(sEmitResponse2); if (tmp.status) { balance = (double)tmp.balance; } Parent.updateBalance(balance); } catch (Exception E) { Parent.updateStatus(E.Message); } LastBalance = DateTime.Now; } Thread.Sleep(100); } }
public override void Login(string Username, string Password, string twofa) { ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null };; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://dadice.com/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); username = Username; key = Password; List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("username", username)); pairs.Add(new KeyValuePair <string, string>("key", key)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("balance", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize <DADICEBlance>(Resp); } if (tmp.status) { pairs.Add(new KeyValuePair <string, string>("coin", "btc")); Content = new FormUrlEncodedContent(pairs); DADICEBlance dep = new DADICEBlance(); using (var response = Client.PostAsync("deposit", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; dep = json.JsonDeserialize <DADICEBlance>(Resp); } if (dep.status) { Parent.updateDeposit(dep.address); } balance = (decimal)tmp.balance; HttpWebRequest loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://stats.dadice.com/api/userinfo?username="******"application/x-www-form-urlencoded; charset=UTF-8"; HttpWebResponse EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); LastBalance = DateTime.Now.AddSeconds(-20); DADICEStatsBase tmp2 = json.JsonDeserialize <DADICEStatsBase>(sEmitResponse); this.wagered = decimal.Parse(tmp2.user.stats.wagered, System.Globalization.NumberFormatInfo.InvariantInfo); this.bets = tmp2.user.stats.bets; this.wins = tmp2.user.stats.won; this.losses = tmp2.user.stats.lost; this.profit = decimal.Parse(tmp2.user.stats.profit); Parent.updateBalance((decimal)(balance)); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); Parent.updateBalance(balance); finishedlogin(true); } else { finishedlogin(false); } }
protected override bool internalWithdraw(double Amount, string Address) { 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>("key", key)); pairs.Add(new KeyValuePair<string, string>("amount", Amount.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair<string, string>("payee", Address)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("withdraw", Content)) { string sEmitResponse2 = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize<DADICEBlance>(sEmitResponse2); } LastBalance = DateTime.Now.AddMinutes(-1); return tmp.status; } catch (Exception E) { Parent.updateStatus(E.Message); } return false; }
public override void Login(string Username, string Password, string twofa) { ClientHandlr = new HttpClientHandler { UseCookies = true }; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://dadice.com/api/") }; username = Username; key = Password; List<KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>(); pairs.Add(new KeyValuePair<string, string>("username", username)); pairs.Add(new KeyValuePair<string, string>("key", key)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("balance", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize<DADICEBlance>(Resp); } if (tmp.status) { pairs.Add(new KeyValuePair<string, string>("coin", "btc")); Content = new FormUrlEncodedContent(pairs); DADICEBlance dep = new DADICEBlance(); using (var response = Client.PostAsync("deposit", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; dep = json.JsonDeserialize<DADICEBlance>(Resp); } if (dep.status) Parent.updateDeposit(dep.address); balance = (double)tmp.balance; HttpWebRequest loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://stats.dadice.com/api/userinfo?username="******"application/x-www-form-urlencoded; charset=UTF-8"; HttpWebResponse EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); LastBalance = DateTime.Now.AddSeconds(-20); DADICEStatsBase tmp2 = json.JsonDeserialize<DADICEStatsBase>(sEmitResponse); this.wagered = double.Parse(tmp2.user.stats.wagered, System.Globalization.NumberFormatInfo.InvariantInfo); this.bets = tmp2.user.stats.bets; this.wins = tmp2.user.stats.won; this.losses = tmp2.user.stats.lost; this.profit = double.Parse(tmp2.user.stats.profit); Parent.updateBalance((decimal)(balance)); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); Parent.updateBalance(balance); finishedlogin(true); } else { finishedlogin(false); } }
public void GetBalanceThread() { while (this.isdd) { if (username != "" && key != "" && (DateTime.Now - LastBalance).TotalSeconds>15) { 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>("key", key)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); DADICEBlance tmp = new DADICEBlance(); using (var response = Client.PostAsync("balance", Content)) { string Resp = response.Result.Content.ReadAsStringAsync().Result; tmp = json.JsonDeserialize<DADICEBlance>(Resp); } if (tmp.status) balance = (double)tmp.balance; Parent.updateBalance(balance); } catch (Exception E) { Parent.updateStatus(E.Message); } LastBalance = DateTime.Now; } Thread.Sleep(100); } }
public override void Login(string Username, string Password, string twofa) { username = Username; key = Password; HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://dadice.com/api/balance"); betrequest.Method = "POST"; string post = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "username={0}&key={1}", username, key); betrequest.ContentLength = post.Length; if (Prox != null) { betrequest.Proxy = Prox; } betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); DADICEBlance tmp = json.JsonDeserialize <DADICEBlance>(sEmitResponse2); if (tmp.status) { HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://dadice.com/api/deposit"); betrequest2.Method = "POST"; string post2 = string.Format(System.Globalization.NumberFormatInfo.InvariantInfo, "username={0}&key={1}&coin=btc", username, key); betrequest2.ContentLength = post.Length; if (Prox != null) { betrequest.Proxy = Prox; } betrequest2.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(betrequest2.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse3 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse3 = new StreamReader(EmitResponse3.GetResponseStream()).ReadToEnd(); DADICEBlance dep = json.JsonDeserialize <DADICEBlance>(sEmitResponse3); if (dep.status) { Parent.updateDeposit(dep.address); } balance = (double)tmp.balance; HttpWebRequest loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://stats.dadice.com/api/userinfo?username="******"application/x-www-form-urlencoded; charset=UTF-8"; HttpWebResponse EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); LastBalance = DateTime.Now.AddSeconds(-20); DADICEStatsBase tmp2 = json.JsonDeserialize <DADICEStatsBase>(sEmitResponse); this.wagered = double.Parse(tmp2.user.stats.wagered, System.Globalization.NumberFormatInfo.InvariantInfo); this.bets = tmp2.user.stats.bets; this.wins = tmp2.user.stats.won; this.losses = tmp2.user.stats.lost; this.profit = double.Parse(tmp2.user.stats.profit); Parent.updateBalance((decimal)(balance)); Parent.updateBets(bets); Parent.updateLosses(losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(wins); Parent.updateBalance(balance); finishedlogin(true); } else { finishedlogin(false); } }