public void GetDepositAddress() { if (sessionCookie != "" && sessionCookie != null) { List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >(); pairs.Add(new KeyValuePair <string, string>("a", "GetDepositAddress")); pairs.Add(new KeyValuePair <string, string>("s", sessionCookie)); pairs.Add(new KeyValuePair <string, string>("Currency", Currency)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); string responseData = ""; using (var response = Client.PostAsync("", Content)) { try { responseData = response.Result.Content.ReadAsStringAsync().Result; } catch (AggregateException e) { if (e.InnerException.Message.Contains("ssl")) { GetDepositAddress(); return; } } } d999deposit tmp = json.JsonDeserialize <d999deposit>(responseData); Parent.updateDeposit(tmp.Address); } }
public void GetDepositAddress() { if (sessionCookie != "" && sessionCookie != null) { HttpWebRequest loginrequest = HttpWebRequest.Create("https://www.999dice.com/api/web.aspx") as HttpWebRequest; if (Prox != null) { loginrequest.Proxy = Prox; } string post = "a=GetDepositAddress&s=" + sessionCookie + "&Currency=" + Currency; loginrequest.Method = "POST"; loginrequest.ContentLength = post.Length; loginrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; using (var writer = new StreamWriter(loginrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)loginrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); d999deposit tmp = json.JsonDeserialize <d999deposit>(sEmitResponse); Parent.updateDeposit(tmp.Address); } }