Example #1
0
 void GetBalance()
 {
     if (sessionCookie != "" && sessionCookie != null && (DateTime.Now - Lastbalance).TotalSeconds > 60)
     {
         Lastbalance = DateTime.Now;
         List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
         pairs.Add(new KeyValuePair <string, string>("a", "GetBalance"));
         pairs.Add(new KeyValuePair <string, string>("s", sessionCookie));
         pairs.Add(new KeyValuePair <string, string>("Currency", Currency));
         pairs.Add(new KeyValuePair <string, string>("Stats", "1"));
         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"))
                 {
                     GetBalance();
                     return;
                 }
             }
         }
         try
         {
             d999Login tmplogin = json.JsonDeserialize <d999Login>(responseData);
             balance = (decimal)tmplogin.Balance / 100000000.0m;
             wagered = Wagered = -(decimal)tmplogin.TotalPayIn / 100000000.0m;
             profit  = tmplogin.TotalProfit / 100000000.0m;;
             bets    = (int)tmplogin.TotalBets;
             wins    = (int)tmplogin.TotalWins;
             losses  = (int)tmplogin.TotalLoseCount;
             if (balance != 0)
             {
                 Parent.updateBalance((decimal)balance);
                 Parent.updateBets(bets);
                 Parent.updateWagered(wagered);
                 Parent.updateProfit(profit);
                 Parent.updateWins(wins);
                 Parent.updateLosses(losses);
             }
         }
         catch
         {
         }
     }
 }
Example #2
0
        public override void Login(string Username, string Password, string twofa)
        {
            HttpWebRequest loginrequest = HttpWebRequest.Create("https://www.999dice.com/api/web.aspx") as HttpWebRequest;

            if (Prox != null)
            {
                loginrequest.Proxy = Prox;
            }
            string post = "a=Login&key=7a3ada10cb804ec695cda315db6b8789&Username="******"&Password="******"" ? "&Totp=" + twofa : "");

            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();
            d999Login       tmpU          = json.JsonDeserialize <d999Login>(sEmitResponse);

            if (tmpU.SessionCookie != "" && tmpU.SessionCookie != null)
            {
                sessionCookie = tmpU.SessionCookie;

                profit  = (double)tmpU.Profit / 100000000.0;
                Wagered = tmpU.Wagered / 100000000m;
                bets    = (int)tmpU.BetCount;
                wins    = (int)tmpU.BetWinCount;
                losses  = (int)tmpU.BetLoseCount;
                GetBalance();
                Parent.updateBalance((decimal)(balance));
                Parent.updateBets(tmpU.BetCount);
                Parent.updateLosses(tmpU.BetLoseCount);
                Parent.updateProfit(profit);
                Parent.updateWagered(Wagered);
                Parent.updateWins(tmpU.BetWinCount);
                try
                {
                    Parent.updateDeposit(tmpU.DepositAddress);
                }
                catch { }
                uid = tmpU.Accountid;
            }
            else
            {
            }
            finishedlogin(sessionCookie != "");
        }
Example #3
0
        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://www.999dice.com/api/web.aspx")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();

            pairs.Add(new KeyValuePair <string, string>("a", "Login"));
            pairs.Add(new KeyValuePair <string, string>("key", "7a3ada10cb804ec695cda315db6b8789"));
            if (twofa != "" && twofa != null)
            {
                pairs.Add(new KeyValuePair <string, string>("Totp", twofa));
            }

            pairs.Add(new KeyValuePair <string, string>("Username", Username));
            pairs.Add(new KeyValuePair <string, string>("Password", Password));

            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"))
                    {
                        Login(Username, Password, twofa);
                        return;
                    }
                }
            }

            d999Login tmpU = json.JsonDeserialize <d999Login>(responseData);

            if (tmpU.SessionCookie != "" && tmpU.SessionCookie != null)
            {
                Lastbalance   = DateTime.Now;
                sessionCookie = tmpU.SessionCookie;
                balance       = (double)tmpU.Balance / 100000000.0;
                profit        = (double)tmpU.Profit / 100000000.0;
                Wagered       = tmpU.Wagered / 100000000m;
                bets          = (int)tmpU.BetCount;
                wins          = (int)tmpU.BetWinCount;
                losses        = (int)tmpU.BetLoseCount;
                GetBalance();
                Parent.updateBalance((decimal)(balance));
                Parent.updateBets(tmpU.BetCount);
                Parent.updateLosses(tmpU.BetLoseCount);
                Parent.updateProfit(profit);
                Parent.updateWagered(Wagered);
                Parent.updateWins(tmpU.BetWinCount);
                Lastbalance = DateTime.Now.AddMinutes(-2);
                GetBalance();
                try
                {
                    Parent.updateDeposit(tmpU.DepositAddress);
                }
                catch { }
                uid = tmpU.Accountid;
            }
            else
            {
            }
            finishedlogin(sessionCookie != "");
        }
Example #4
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                string sitea = SiteA[site];

                /*switch (site)
                 * {
                 *  case 0: sitea = "https://www.999dice.com/api/web.aspx"; break;
                 *  case 1: sitea = "https://www.999doge.com/api/web.aspx"; break;
                 *  case 2: sitea = "https://www.999-dice.com/api/web.aspx"; break;
                 *  case 3: sitea = "http://999again.ddns.net:999/"; break;
                 * }*/
                ClientHandlr = new HttpClientHandler {
                    UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
                };;
                Client = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri(sitea)
                };
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("a", "Login"));
                pairs.Add(new KeyValuePair <string, string>("key", "7a3ada10cb804ec695cda315db6b8789"));
                if (twofa != "" && twofa != null)
                {
                    pairs.Add(new KeyValuePair <string, string>("Totp", twofa));
                }

                pairs.Add(new KeyValuePair <string, string>("Username", Username));
                pairs.Add(new KeyValuePair <string, string>("Password", Password));

                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string responseData           = "";
                using (var response = Client.PostAsync("", Content))
                {
                    try
                    {
                        responseData = response.Result.Content.ReadAsStringAsync().Result;
                    }
                    catch (AggregateException e)
                    {
                        if (site++ < SiteA.Length - 1)
                        {
                            Login(Username, Password, twofa);
                        }
                        else
                        {
                            finishedlogin(false);
                        }
                        return;
                    }
                }

                d999Login tmpU = json.JsonDeserialize <d999Login>(responseData);
                if (tmpU.SessionCookie != "" && tmpU.SessionCookie != null)
                {
                    Lastbalance   = DateTime.Now;
                    sessionCookie = tmpU.SessionCookie;
                    balance       = tmpU.Balance / 100000000.0m;
                    profit        = tmpU.Profit / 100000000.0m;
                    Wagered       = tmpU.Wagered / 100000000m;
                    bets          = (int)tmpU.BetCount;
                    wins          = (int)tmpU.BetWinCount;
                    losses        = (int)tmpU.BetLoseCount;
                    GetBalance();
                    Parent.updateBalance((decimal)(balance));
                    Parent.updateBets(tmpU.BetCount);
                    Parent.updateLosses(tmpU.BetLoseCount);
                    Parent.updateProfit(profit);
                    Parent.updateWagered(Wagered);
                    Parent.updateWins(tmpU.BetWinCount);
                    Lastbalance = DateTime.Now.AddMinutes(-2);
                    GetBalance();
                    try
                    {
                        Parent.updateDeposit(tmpU.DepositAddress);
                    }
                    catch { }
                    uid = tmpU.Accountid;
                }
                else
                {
                }
                if (sessionCookie != "")
                {
                    isD999 = true;
                    Thread t = new Thread(GetBalanceThread);
                    t.Start();
                }
            }
            catch {
                if (site++ < 2)
                {
                    Login(Username, Password, twofa);
                }
            }
            if (!thing)
            {
                finishedlogin(sessionCookie != "");
                thing = true;
            }
        }