Exemplo n.º 1
0
        /// <summary>
        /// A chaque changement de monnaie dans la ListBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBoxCoin_SelectedIndexChanged(object sender, EventArgs e)
        {
            string coin = GetSelectedCoin();
            string key  = GetAPIKey();

            if (coin != null && key != "")
            {
                buttonBet.Enabled = false;
                labelCoin.Text    = coin;
                labelBalance.Text = JsonGetBalance(coin, key).Balance.ToString();
                BetSettings b = JsonGetBetSettings(coin);
                numericUpDownBet.Minimum    = b.MinBet;
                numericUpDownBet.Increment  = b.MinBet;
                numericUpDownPayout.Minimum = b.MinRatio;
                numericUpDownPayout.Maximum = b.MaxRatio;
                //if (numericUpDownBet.Value < b.MinBet)
                numericUpDownBet.Value = b.MinBet;
                if (numericUpDownPayout.Value < b.MinRatio)
                {
                    numericUpDownPayout.Value = b.MinRatio;
                }
                labelMinMaxBet.Text    = "(" + b.MinBet + " - ???)";
                labelMinMaxPayout.Text = "(" + b.MinRatio + " - " + b.MaxRatio + ")";
                buttonBet.Enabled      = true;
            }
            else
            {
                AddOutputLine("Coin or API Key invalid.");
            }
        }
Exemplo n.º 2
0
        public static BetSettings FromJSONDynamic(dynamic json)
        {
            BetSettings s = new BetSettings();

            s.Coin     = json.Coin;
            s.MinBet   = json.MinBet;
            s.MaxWin   = json.MaxWin;
            s.MinRatio = json.MinRatio;
            s.MaxRatio = json.MaxRatio;
            s.Edge     = json.Edge;
            return(s);
        }
Exemplo n.º 3
0
        private void buttonBetSettings_Click(object sender, EventArgs e)
        {
            string coin = GetSelectedCoin();

            if (coin != null)
            {
                BetSettings betSet = JsonGetBetSettings(coin);
                AddOutputLine(betSet.ToString());
            }
            else
            {
                AddOutputLine("Select a Coin first");
            }
        }
Exemplo n.º 4
0
        private BetSettings JsonGetBetSettings(string coin)
        {
            if (coin != null)
            {
                string url = "https://api.crypto-games.net/v1/settings/" + coin;

                WebRequest req = WebRequest.Create(url);

                using (WebResponse res = req.GetResponse())
                    using (var reader = new StreamReader(res.GetResponseStream()))
                    {
                        string  responseJSON = reader.ReadToEnd();
                        dynamic json         = System.Web.Helpers.Json.Decode(responseJSON);

                        BetSettings betSet = BetSettings.FromJSONDynamic(json);
                        return(betSet);
                    }
            }
            else
            {
                AddOutputLine("Select a Coin first");
            }
            return(new BetSettings());
        }