Пример #1
0
        BalanceData BalanceStopShouldStop(out bool ShouldStop)
        {
            try
            {
                if (!GameConfig.CheckBalance)
                {
                    ShouldStop = false;
                    return(null);
                }
                Log("Checking balance...");
                string resp       = string.Empty;
                string Parameters = string.Format("secret={0}", GameConfig.PlayerHash);
                using (WebClient wc = new WebClient())
                {
                    wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                    resp = wc.UploadString(new Uri("https://satoshimines.com/action/refresh_balance.php"), "POST", Parameters);
                }
                BalanceData bd = Deserialize <BalanceData>(resp);
                if (bd == null || bd.status != "success")
                {
                    ShouldStop = false;
                    return(null);
                }

                float checkVal = bd.balance * 1000000;

                this.Invoke((MethodInvoker) delegate()
                {
                    liveBitsBox.Text = string.Format("Bits | {0}", checkVal);
                });

                if (GameConfig.BalanceStopAbove != -1)
                {
                    if (checkVal > GameConfig.BalanceStopAbove)
                    {
                        ShouldStop = true;
                        return(bd);
                    }
                }

                if (GameConfig.BalanceStopBelow != -1)
                {
                    if (checkVal < GameConfig.BalanceStopBelow)
                    {
                        ShouldStop = true;
                        return(bd);
                    }
                }

                ShouldStop = false;
                return(null);
            }
            catch
            {
                ShouldStop = false;
                return(null);
            }
        }
Пример #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            try
            {
                string resp = await GetBalance(textBox1.Text);

                BalanceData bd = Deserialize <BalanceData>(resp);
                if (bd == null || bd.status != "success")
                {
                    throw new Exception();
                }
                balanceLabel.Text = bd.balance.ToString();
            }
            catch
            {
                balanceLabel.Text = "Failed";
            }
            button1.Enabled = true;
        }