Пример #1
0
 protected override void _UpdateStats()
 {
     try
     {
         string sEmitResponse = Client.GetStringAsync("user/" + CurrentCurrency + "/" + accesstoken).Result;
         cgUser tmpBal        = json.JsonDeserialize <cgUser>(sEmitResponse);
         Stats.Balance = tmpBal.Balance;
         Stats.Wagered = tmpBal.Wagered;
         Stats.Profit  = tmpBal.Profit;
         Stats.Bets    = tmpBal.TotalBets;
     }
     catch { }
 }
Пример #2
0
        protected override void _Login(LoginParamValue[] LoginParams)
        {
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://api.crypto-games.net/v1/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            try
            {
                accesstoken = LoginParams[0].Value;

                string sEmitResponse = Client.GetStringAsync("user/" + CurrentCurrency + "/" + accesstoken).Result;
                cgUser tmpBal        = json.JsonDeserialize <cgUser>(sEmitResponse);
                sEmitResponse = Client.GetStringAsync("nextseed/" + CurrentCurrency + "/" + accesstoken).Result;
                cgNextSeed tmpSeed = json.JsonDeserialize <cgNextSeed>(sEmitResponse);
                CurrenyHash   = tmpSeed.NextServerSeedHash;
                Stats.Balance = tmpBal.Balance;
                Stats.Wagered = tmpBal.Wagered;
                Stats.Profit  = tmpBal.Profit;
                Stats.Bets    = tmpBal.TotalBets;
                //Get stats
                //assign vals to stats

                Thread t = new Thread(GetBalanceThread);
                iscg = true;
                t.Start();

                callLoginFinished(true);
            }
            catch (AggregateException e)
            {
                Logger.DumpLog(e.ToString(), -1);
                callLoginFinished(false);
            }
            catch (Exception e)
            {
                Logger.DumpLog(e.ToString(), -1);
                callLoginFinished(false);
            }
        }