예제 #1
0
        void JD_OnOldBets(Bet bet, bool IsMine)
        {
            if (InvokeRequired)
            {
                Invoke(new dOnOldBets(JD_OnOldBets), bet, IsMine);
                return;
            }
            string target = (bet.high) ? ">" + (100.0 - double.Parse(bet.chance)) : "<" + bet.chance;
            if (IsMine)
            {
                updateMeLine();
                UpdateTextBox(txtNonce, JD.Nonce.ToString());
                dgvMy.Rows.Insert(0, bet.name + "(" + bet.uid + ")", jdInstance.ToDateTime(bet.date.ToString()), bet.betid, bet.lucky / 10000.0, target, bet.bet, bet.payout, bet.this_profit);
                if (dgvMy.Rows.Count > 0)
                {
                    if (bet.this_profit.Contains("-"))
                    {
                        dgvMy.Rows[0].DefaultCellStyle.BackColor = Color.Pink;
                    }
                    else
                    {
                        dgvMy.Rows[0].DefaultCellStyle.BackColor = Color.LightGreen;
                    }

                }
                while (dgvMy.Rows.Count > 100)
                    dgvMy.Rows.RemoveAt(100);
                if (JD.Settings.allbetsme)
                {
                    dgvAll.Rows.Insert(0, bet.name + "(" + bet.uid + ")", jdInstance.ToDateTime(bet.date.ToString()), bet.betid, bet.lucky / 10000.0, target, bet.bet, bet.payout, bet.this_profit);
                    if (bet.this_profit.Contains("-"))
                    {
                        dgvAll.Rows[0].DefaultCellStyle.BackColor = Color.Pink;
                    }
                    else
                    {
                        dgvAll.Rows[0].DefaultCellStyle.BackColor = Color.LightGreen;
                    }

                    while (dgvAll.Rows.Count > 100)
                        dgvAll.Rows.RemoveAt(100);
                }

            }
            else
            {
                string[] stmp = Regex.Split(JD.Settings.watch_player, @"\D+");
                if ((JD.Settings.min_risk <= double.Parse(bet.bet) || JD.Settings.min_change <= (double.Parse(bet.this_profit) < 0 ? -double.Parse(bet.this_profit) : double.Parse(bet.this_profit))) &&
                   (Regex.Split(JD.Settings.watch_player, @"\D+").Contains(bet.uid) || Regex.Split(JD.Settings.watch_player, @"\D+")[0] == "" || Regex.Split(JD.Settings.watch_player, @"\D+")[0] == "0"))
                {
                    dgvAll.Rows.Insert(0, bet.name + "(" + bet.uid + ")", jdInstance.ToDateTime(bet.date.ToString()), bet.betid, bet.lucky / 10000.0, target, bet.bet, bet.payout, bet.this_profit);
                    if (bet.this_profit.Contains("-"))
                    {
                        dgvAll.Rows[0].DefaultCellStyle.BackColor = Color.Pink;
                    }
                    else
                    {
                        dgvAll.Rows[0].DefaultCellStyle.BackColor = Color.LightGreen;
                    }

                    while (dgvAll.Rows.Count > 100)
                        dgvAll.Rows.RemoveAt(100);
                }

                if ((JD.Settings.chat_min_risk <= double.Parse(bet.bet) || JD.Settings.chat_min_change <= (double.Parse(bet.this_profit) < 0 ? -double.Parse(bet.this_profit) : double.Parse(bet.this_profit))) && (Regex.Split(JD.Settings.chat_watch_player, @"\D+").Contains(bet.uid) || Regex.Split(JD.Settings.chat_watch_player, @"\D+")[0] == "" || Regex.Split(JD.Settings.chat_watch_player, @"\D+")[0] == "0"))
                {
                    /*dgvAll.Rows.Insert(0, result.betid, result.date, result.bet, result.high, result.chance, result.lucky / 10000.0, result.this_profit, result.nonce);
                    while (dgvAll.Rows.Count > 100)
                        dgvAll.Rows.RemoveAt(100);*/
                    string win = (((bet.high ? bet.lucky / 10000.0 < 100.0 - double.Parse(bet.chance) : bet.lucky / 10000.0 > 100.0 - double.Parse(bet.chance))) ? "lost" : "won " + bet.this_profit + " CLAM");
                    string msg = string.Format("{0:hh:MM:ss} *** ({1}) <{2}> [#{3}] bet {4} CLAM at {5}% and {6} ***", jdInstance.ToDateTime(bet.date.ToString()), bet.uid, bet.name, bet.betid, bet.bet, bet.chance, win);
                }
            }
        }
예제 #2
0
파일: JDCAPI.cs 프로젝트: chilly2k/jdcapi
        private void ProcessResult(string JsonString)
        {
            int start = JsonString.IndexOf("[") + 1;
            int length = JsonString.IndexOf("]") - start;
            start = JsonString.IndexOf('[') + 1;
            length = JsonString.LastIndexOf(']') - start + 1;
            JsonString = JsonString.Substring(start, length);
            Result tmp = json.JsonDeserialize<Result>(JsonString);
            if (tmp.bankroll != null)
            {
                Bankroll = double.Parse(tmp.bankroll, System.Globalization.CultureInfo.InvariantCulture);
                MaxProfit = double.Parse(tmp.max_profit, System.Globalization.CultureInfo.InvariantCulture);
                Investment = tmp.investment;
                Invest_pft = (decimal)tmp.invest_pft;
                Percent = tmp.percent;
                Stats = tmp.stats;
                if (tmp.uid == uid)
                {
                    this.Nonce = tmp.nonce;
                }
                if (tmp.balance == null)
                {
                    tmp.balance = Balance.ToString();
                }
                else
                {
                    Balance = double.Parse(tmp.balance, System.Globalization.CultureInfo.InvariantCulture);
                }
                if (tmp.profit == null)
                {
                    tmp.profit = Profit.ToString();
                }
                else
                {
                    _Profit = decimal.Parse(tmp.profit, System.Globalization.CultureInfo.InvariantCulture);
                }

                Bet tmp2 = new Bet();
                tmp2.bet = tmp.bet;
                tmp2.betid = tmp.betid;
                tmp2.chance = tmp.chance;
                tmp2.date = tmp.date;
                tmp2.high = tmp.high;
                tmp2.lucky = tmp.lucky;
                tmp2.name = tmp.name;
                tmp2.nonce = tmp.nonce;
                tmp2.payout = tmp.payout;
                tmp2.returned = tmp.ret;
                tmp2.this_profit = tmp.this_profit;
                tmp2.uid = tmp.uid;
                if (OnResult != null)
                    OnResult(tmp, (tmp.uid == uid));
                if (OnBet != null && !logginging)
                    OnBet(tmp2, (tmp2.uid == uid) );

            }
        }
예제 #3
0
 void JD_OnBet(Bet bet, bool IsMine)
 {
 }