Esempio n. 1
0
        public override void Login(string Username, string Password, string otp)
        {
            try
            {
                GraphQLRequest LoginReq = new GraphQLRequest
                {
                    Query = "mutation{loginUser(name:\"" + Username + "\", password:\"" + Password + "\"" + (string.IsNullOrWhiteSpace(otp) ? "" : ",tfaToken:\"" + otp + "\"") + ") {activeSeed { serverSeedHash clientSeed nonce} id balances{available{currency amount value}} throttles{key value ttl type refType refId} statistic {bets wins losses amount profit currency value}}}"
                };
                GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                pdUser          user = Resp.GetDataFieldAs <pdUser>("loginUser");
                userid = user.id;
                if (string.IsNullOrWhiteSpace(userid))
                {
                    finishedlogin(false);
                }
                else
                {
                    foreach (Statistic x in user.statistic)
                    {
                        if (x.currency.ToLower() == Currency.ToLower())
                        {
                            this.bets    = (int)x.bets;
                            this.wins    = (int)x.wins;
                            this.losses  = (int)x.losses;
                            this.profit  = (decimal)x.profit;
                            this.wagered = (decimal)x.amount;
                            break;
                        }
                    }
                    foreach (Balance x in user.balances)
                    {
                        if (x.available.currency.ToLower() == Currency.ToLower())
                        {
                            balance = (decimal)x.available.amount;
                            break;
                        }
                    }

                    finishedlogin(true);
                    return;
                }
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                }
                finishedlogin(false);
            }
            catch (Exception e)
            {
                finishedlogin(false);
            }
        }
Esempio n. 2
0
 void GetBalanceThread()
 {
     try
     {
         while (ispd)
         {
             if (userid != null && ((DateTime.Now - lastupdate).TotalSeconds >= 30 || ForceUpdateStats))
             {
                 ForceUpdateStats = false;
                 lastupdate       = DateTime.Now;
                 GraphQLRequest LoginReq = new GraphQLRequest
                 {
                     Query = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}"
                 };
                 GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                 pdUser          user = Resp.GetDataFieldAs <pdUser>("user");
                 foreach (Statistic x in user.statistic)
                 {
                     if (x.currency.ToLower() == Currency.ToLower() && x.game == StatGameName)
                     {
                         this.bets    = (int)x.bets;
                         this.wins    = (int)x.wins;
                         this.losses  = (int)x.losses;
                         this.profit  = (decimal)x.profit;
                         this.wagered = (decimal)x.betAmount;
                         break;
                     }
                 }
                 foreach (Balance x in user.balances)
                 {
                     if (x.available.currency.ToLower() == Currency.ToLower())
                     {
                         balance = (decimal)x.available.amount;
                         break;
                     }
                 }
                 Parent.updateBalance(balance);
                 Parent.updateWagered(wagered);
                 Parent.updateProfit(profit);
                 Parent.updateBets(bets);
                 Parent.updateWins(wins);
                 Parent.updateLosses(losses);
             }
             Thread.Sleep(1000);
         }
     }
     catch (Exception e)
     {
         Parent.DumpLog(e.ToString(), -1);
     }
 }
Esempio n. 3
0
 void GetBalanceThread()
 {
     try
     {
         while (ispd)
         {
             if (userid != null)
             {
                 GraphQLRequest LoginReq = new GraphQLRequest
                 {
                     Query = "query{user {activeSeed { serverSeedHash clientSeed nonce} id balances{available{currency amount value}} throttles{key value ttl type refType refId} statistic {bets wins losses amount profit currency value}}}"
                 };
                 GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                 pdUser          user = Resp.GetDataFieldAs <pdUser>("user");
                 foreach (Statistic x in user.statistic)
                 {
                     if (x.currency.ToLower() == Currency.ToLower())
                     {
                         this.bets    = (int)x.bets;
                         this.wins    = (int)x.wins;
                         this.losses  = (int)x.losses;
                         this.profit  = (decimal)x.profit;
                         this.wagered = (decimal)x.amount;
                         break;
                     }
                 }
                 foreach (Balance x in user.balances)
                 {
                     if (x.available.currency.ToLower() == Currency.ToLower())
                     {
                         balance = (decimal)x.available.amount;
                         break;
                     }
                 }
                 Parent.updateBalance(balance);
                 Parent.updateWagered(wagered);
                 Parent.updateProfit(profit);
                 Parent.updateBets(bets);
                 Parent.updateWins(wins);
                 Parent.updateLosses(losses);
             }
             Thread.Sleep(1000);
         }
     }
     catch (Exception e)
     {
         Parent.DumpLog(e.ToString(), -1);
     }
 }
Esempio n. 4
0
 protected override void _UpdateStats()
 {
     try
     {
         ForceUpdateStats = false;
         lastupdate       = DateTime.Now;
         GraphQLRequest LoginReq = new GraphQLRequest
         {
             Query = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}"
         };
         GraphQLResponse <pdUser> Resp = GQLClient.SendMutationAsync <pdUser>(LoginReq).Result;
         pdUser user = Resp.Data;
         foreach (Statistic x in user.statistic)
         {
             if (x.currency.ToLower() == Currencies[Currency].ToLower() && x.game == StatGameName)
             {
                 this.Stats.Bets    = (int)x.bets;
                 this.Stats.Wins    = (int)x.wins;
                 this.Stats.Losses  = (int)x.losses;
                 this.Stats.Profit  = x.profit;
                 this.Stats.Wagered = x.amount;
                 break;
             }
         }
         foreach (Balance x in user.balances)
         {
             if (x.available.currency.ToLower() == Currencies[Currency].ToLower())
             {
                 this.Stats.Balance = x.available.amount;
                 break;
             }
         }
     }
     catch (Exception e)
     {
         Logger.DumpLog(e);
     }
 }
Esempio n. 5
0
        public override void Login(string Username, string Password, string otp)
        {
            try
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                //RequireCaptchaEventArgs Captchaval = new RequireCaptchaEventArgs { PublicKey = CaptchaKey, Domain=this.URL };
                //RequireCaptcha(Captchaval);
                GQLClient = new GraphQL.Client.GraphQLClient(URL);

                /*GraphQLRequest LoginReq = new GraphQLRequest
                 * {
                 *  Query = "mutation{loginUser(captcha:\""+Captchaval.ResponseValue+ "\" name:\"" + Username + "\", password:\"" + Password + "\"" + (string.IsNullOrWhiteSpace(otp) ? "" : ",tfaToken:\"" + otp + "\"") + ") {activeServerSeed { seedHash seed nonce} activeClientSeed {seed} id statistic {bets wins losses amount profit currency} balances{available{currency amount}} }}"
                 * };
                 *
                 * GQLClient
                 * GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                 * if (Resp.Errors != null)
                 * {
                 *  if (Resp.Errors.Length > 0)
                 *  {
                 *      Parent.DumpLog(Resp.Errors[0].Message, -1);
                 *      Parent.updateStatus(Resp.Errors[0].Message);
                 *      finishedlogin(false);
                 *      return;
                 *  }
                 * }
                 * pdUser user = Resp.GetDataFieldAs<pdUser>("loginUser");*/
                GQLClient.DefaultRequestHeaders.Add("x-access-token", Password);

                /*
                 * var subscriptionResult = GQLClient.SendSubscribeAsync(@"subscription { chatMessages(chatId: "14939265 - 52a4 - 404e-8a0c - 6e3e10d915b4") { id chat { id name isPublic } createdAt user { id name roles { name } } data { ... on ChatMessageDataBot { message } ... on ChatMessageDataText { message } ... on ChatMessageDataTip { tip { id amount currency sender: sendBy { id name } receiver: user { id name } } } } } } ").Result;
                 * subscriptionResult.OnReceive += (res) => { Console.WriteLine(res.Data.messageAdded.content); };
                 */


                GraphQLRequest LoginReq = new GraphQLRequest
                {
                    Query = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}"
                };
                GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                pdUser          user = Resp.GetDataFieldAs <pdUser>("user");

                userid = user.id;
                if (string.IsNullOrWhiteSpace(userid))
                {
                    finishedlogin(false);
                }
                else
                {
                    foreach (Statistic x in user.statistic)
                    {
                        if (x.currency.ToLower() == Currency.ToLower() && x.game == StatGameName)
                        {
                            this.bets    = (int)x.bets;
                            this.wins    = (int)x.wins;
                            this.losses  = (int)x.losses;
                            this.profit  = (decimal)x.profit;
                            this.wagered = (decimal)x.betAmount;
                            break;
                        }
                    }
                    foreach (Balance x in user.balances)
                    {
                        if (x.available.currency.ToLower() == Currency.ToLower())
                        {
                            balance = (decimal)x.available.amount;
                            break;
                        }
                    }

                    finishedlogin(true);
                    ispd = true;
                    Thread t = new Thread(GetBalanceThread);
                    t.Start();
                    return;
                }
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                }
                finishedlogin(false);
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
                finishedlogin(false);
            }
        }
Esempio n. 6
0
        public override void Login(string Username, string Password, string otp)
        {
            try
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                //RequireCaptchaEventArgs Captchaval = new RequireCaptchaEventArgs { PublicKey = CaptchaKey, Domain=this.URL };
                //RequireCaptcha(Captchaval);
                GQLClient = new GraphQL.Client.GraphQLClient(URL);

                /*GraphQLRequest LoginReq = new GraphQLRequest
                 * {
                 *  Query = "mutation{loginUser(captcha:\""+Captchaval.ResponseValue+ "\" name:\"" + Username + "\", password:\"" + Password + "\"" + (string.IsNullOrWhiteSpace(otp) ? "" : ",tfaToken:\"" + otp + "\"") + ") {activeServerSeed { seedHash seed nonce} activeClientSeed {seed} id statistic {bets wins losses amount profit currency} balances{available{currency amount}} }}"
                 * };
                 *
                 * GQLClient
                 * GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                 * if (Resp.Errors != null)
                 * {
                 *  if (Resp.Errors.Length > 0)
                 *  {
                 *      Parent.DumpLog(Resp.Errors[0].Message, -1);
                 *      Parent.updateStatus(Resp.Errors[0].Message);
                 *      finishedlogin(false);
                 *      return;
                 *  }
                 * }
                 * pdUser user = Resp.GetDataFieldAs<pdUser>("loginUser");*/
                GQLClient.DefaultRequestHeaders.Add("x-access-token", Password);
                GraphQLRequest LoginReq = new GraphQLRequest
                {
                    Query = "query{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {bets wins losses amount profit currency}}}"
                };
                GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                pdUser          user = Resp.GetDataFieldAs <pdUser>("user");

                userid = user.id;
                if (string.IsNullOrWhiteSpace(userid))
                {
                    finishedlogin(false);
                }
                else
                {
                    foreach (Statistic x in user.statistic)
                    {
                        if (x.currency.ToLower() == Currency.ToLower())
                        {
                            this.bets    = (int)x.bets;
                            this.wins    = (int)x.wins;
                            this.losses  = (int)x.losses;
                            this.profit  = (decimal)x.profit;
                            this.wagered = (decimal)x.amount;
                            break;
                        }
                    }
                    foreach (Balance x in user.balances)
                    {
                        if (x.available.currency.ToLower() == Currency.ToLower())
                        {
                            balance = (decimal)x.available.amount;
                            break;
                        }
                    }

                    finishedlogin(true);
                    ispd = true;
                    Thread t = new Thread(GetBalanceThread);
                    t.Start();
                    return;
                }
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                }
                finishedlogin(false);
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
                finishedlogin(false);
            }
        }
Esempio n. 7
0
        public override void Login(string Username, string Password, string otp)
        {
            try
            {
                GQLClient = new GraphQL.Client.GraphQLClient(URL);
                GraphQLRequest LoginReq = new GraphQLRequest
                {
                    Query = "mutation{loginUser(name:\"" + Username + "\", password:\"" + Password + "\"" + (string.IsNullOrWhiteSpace(otp) ? "" : ",tfaToken:\"" + otp + "\"") + ") {activeServerSeed { seedHash seed nonce} activeClientSeed {seed} id statistic {bets wins losses amount profit currency} balances{available{currency amount}} }}"
                };
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

                GraphQLResponse Resp = GQLClient.PostAsync(LoginReq).Result;
                if (Resp.Errors != null)
                {
                    if (Resp.Errors.Length > 0)
                    {
                        Parent.DumpLog(Resp.Errors[0].Message, -1);
                        Parent.updateStatus(Resp.Errors[0].Message);
                        finishedlogin(false);
                        return;
                    }
                }
                pdUser user = Resp.GetDataFieldAs <pdUser>("loginUser");
                userid = user.id;
                if (string.IsNullOrWhiteSpace(userid))
                {
                    finishedlogin(false);
                }
                else
                {
                    foreach (Statistic x in user.statistic)
                    {
                        if (x.currency.ToLower() == Currency.ToLower())
                        {
                            this.bets    = (int)x.bets;
                            this.wins    = (int)x.wins;
                            this.losses  = (int)x.losses;
                            this.profit  = (decimal)x.profit;
                            this.wagered = (decimal)x.amount;
                            break;
                        }
                    }
                    foreach (Balance x in user.balances)
                    {
                        if (x.available.currency.ToLower() == Currency.ToLower())
                        {
                            balance = (decimal)x.available.amount;
                            break;
                        }
                    }

                    finishedlogin(true);
                    ispd = true;
                    Thread t = new Thread(GetBalanceThread);
                    t.Start();
                    return;
                }
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                }
                finishedlogin(false);
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
                finishedlogin(false);
            }
        }
Esempio n. 8
0
        protected override void _Login(LoginParamValue[] LoginParams)
        {
            try
            {
                string APIKey = "";
                GQLClient = new GraphQL.Client.Http.GraphQLHttpClient(
                    new GraphQLHttpClientOptions {
                    EndPoint = new Uri(URL), OnWebsocketConnected = OnWSConnected
                }, new NewtonsoftJsonSerializer());

                foreach (LoginParamValue x in LoginParams)
                {
                    if (x.Param.Name.ToLower() == "api key")
                    {
                        APIKey = x.Value;
                    }
                }

                GQLClient.HttpClient.DefaultRequestHeaders.Add("x-access-token", APIKey);
                GQLClient.InitializeWebsocketConnection();
                GraphQLRequest LoginReq = new GraphQLRequest
                {
                    Query = "query {user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}"
                };
                //var /*GraphQLResponse<pdUser>*/ Resp2 = GQLClient.SendQueryAsync<dynamic>(LoginReq).Result;
                var /*GraphQLResponse<pdUser>*/ Resp = GQLClient.SendQueryAsync <pdUser>(LoginReq).Result;
                pdUser user = Resp.Data.User;
                userid = user.id;
                if (string.IsNullOrWhiteSpace(userid))
                {
                    callLoginFinished(false);
                }
                else
                {
                    foreach (Statistic x in user.statistic)
                    {
                        if (x.currency.ToLower() == Currencies[Currency].ToLower() && x.game == StatGameName)
                        {
                            this.Stats.Bets    = (int)x.bets;
                            this.Stats.Wins    = (int)x.wins;
                            this.Stats.Losses  = (int)x.losses;
                            this.Stats.Profit  = x.profit;
                            this.Stats.Wagered = x.amount;

                            break;
                        }
                    }
                    foreach (Balance x in user.balances)
                    {
                        if (x.available.currency.ToLower() == Currencies[Currency].ToLower())
                        {
                            this.Stats.Balance = x.available.amount;
                            break;
                        }
                    }

                    callLoginFinished(true);
                    return;
                }
            }
            catch (WebException e)
            {
                Logger.DumpLog(e);
                if (e.Response != null)
                {
                }
                callLoginFinished(false);
            }
            catch (Exception e)
            {
                Logger.DumpLog(e);
                callLoginFinished(false);
            }
        }