コード例 #1
0
        public static OddDTO SearchOdd(eOddType oddType, string oddtoSearch, System.Collections.Generic.List <OddDTO> dataSource)
        {
            OddDTO result = null;
            string __odd  = oddtoSearch.ToLower().Replace("0", "").Replace(" ", "");

            if (dataSource != null)
            {
                try
                {
                    System.Collections.Generic.List <OddDTO> list = (
                        from odd in dataSource
                        where odd.Type == oddType && odd.Odd.ToLower().Replace("0", "").Replace(" ", "").Equals(__odd)
                        select odd).ToList <OddDTO>();
                    if (list.Count == 1)
                    {
                        result = list[0];
                    }
                    else
                    {
                        result = null;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    iBet.Utilities.WriteLog.Write("Error 006 Can not search: " + oddtoSearch + ",ex: " + ex);
#endif
                    result = null;
                }
            }
            return(result);
        }
コード例 #2
0
        public static OddDTO SearchOdd(eOddType oddType, string oddtoSearch, bool a, System.Collections.Generic.List <OddDTO> dataSource)
        {
            OddDTO  result = null;
            string  __odd  = oddtoSearch.ToLower().Trim();
            decimal od     = Math.Abs(decimal.Parse(__odd));

            if (dataSource != null)
            {
                try
                {
                    System.Collections.Generic.List <OddDTO> list = (
                        from odd in dataSource
                        where odd.Type == oddType && (float.Parse(ConvertOdd(odd.Odd.ToLower().Trim())) == (float.Parse((od.ToString()))))
                        select odd).ToList <OddDTO>();
                    if (list.Count == 1)
                    {
                        result = list[0];
                    }
                    else
                    {
                        result = null;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    iBet.Utilities.WriteLog.Write("Error 006 Can not search: " + oddtoSearch + ",ex: " + ex);
#endif
                    result = null;
                }
            }
            return(result);
        }
コード例 #3
0
        public static OddDTO SearchOdd(OddDTO oddToSearch, System.Collections.Generic.List <OddDTO> dataSource)
        {
            OddDTO result;

            if (oddToSearch.Type == eOddType.FulltimeHandicap || oddToSearch.Type == eOddType.FirstHalfHandicap)
            {
                string __odd = oddToSearch.Odd.ToLower().Replace("0", "").Replace(" ", "");
                System.Collections.Generic.List <OddDTO> list = (
                    from odd in dataSource
                    where odd.Type == oddToSearch.Type && odd.Odd.ToLower().Replace("0", "").Replace(" ", "") == __odd && odd.HomeFavor == oddToSearch.HomeFavor && odd.AwayFavor == oddToSearch.AwayFavor
                    select odd).ToList <OddDTO>();
                if (list.Count == 1)
                {
                    result = list[0];
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                if (oddToSearch.Type == eOddType.FulltimeOverUnder || oddToSearch.Type == eOddType.FirstHalfOverUnder)
                {
                    string __odd = oddToSearch.Odd.ToLower().Replace("0", "").Replace(" ", "");
                    System.Collections.Generic.List <OddDTO> list = (
                        from odd in dataSource
                        where odd.Type == oddToSearch.Type && odd.Odd.ToLower().Replace("0", "").Replace(" ", "") == __odd
                        select odd).ToList <OddDTO>();
                    if (list.Count == 1)
                    {
                        result = list[0];
                    }
                    else
                    {
                        result = null;
                    }
                }
                else
                {
#if DEBUG
                    iBet.Utilities.WriteLog.Write("Error 005 Can not search: " + oddToSearch);
#endif
                    result = null;
                }
            }
            return(result);
        }
コード例 #4
0
        public static OddDTO SearchOdd(OddDTO oddToSearch, System.Collections.Generic.List<OddDTO> dataSource)
        {
            OddDTO result;
            if (oddToSearch.Type == eOddType.FulltimeHandicap || oddToSearch.Type == eOddType.FirstHalfHandicap)
            {
                string __odd = oddToSearch.Odd.ToLower().Replace("0", "").Replace(" ", "");
                System.Collections.Generic.List<OddDTO> list = (
                    from odd in dataSource
                    where odd.Type == oddToSearch.Type && odd.Odd.ToLower().Replace("0", "").Replace(" ", "") == __odd && odd.HomeFavor == oddToSearch.HomeFavor && odd.AwayFavor == oddToSearch.AwayFavor
                    select odd).ToList<OddDTO>();
                if (list.Count == 1)
                {
                    result = list[0];
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                if (oddToSearch.Type == eOddType.FulltimeOverUnder || oddToSearch.Type == eOddType.FirstHalfOverUnder)
                {
                    string __odd = oddToSearch.Odd.ToLower().Replace("0", "").Replace(" ", "");
                    System.Collections.Generic.List<OddDTO> list = (
                        from odd in dataSource
                        where odd.Type == oddToSearch.Type && odd.Odd.ToLower().Replace("0", "").Replace(" ", "") == __odd
                        select odd).ToList<OddDTO>();
                    if (list.Count == 1)
                    {
                        result = list[0];
                    }
                    else
                    {
                        result = null;
                    }
                }
                else
                {
#if DEBUG
                    iBet.Utilities.WriteLog.Write("Error 005 Can not search: " + oddToSearch);
#endif
                    result = null;
                }
            }
            return result;
        }
コード例 #5
0
        private void TestStrategy()
        {
            System.Collections.Generic.List<Strategy> listStrategy = new List<Strategy>();
            try
            {
                using (var webClient = new System.Net.WebClient())
                {
                    var json = webClient.DownloadString("https://spreadsheets.google.com/feeds/list/0ArjfL6TJnxG3dHZNNlNZbGU0a0JMT21oWno2WXR4bEE/od9/public/values?alt=json-in-script");
                    string s = json.ToString().Replace("gdata.io.handleScriptLoaded(", "").Replace(");", "");
                    Newtonsoft.Json.JavaScriptObject jSObj = (Newtonsoft.Json.JavaScriptObject)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(s);
                    if (jSObj != null)
                    {
                        Newtonsoft.Json.JavaScriptObject jSObjFeed = (Newtonsoft.Json.JavaScriptObject)jSObj["feed"];
                        if (jSObjFeed != null)
                        {
                            Newtonsoft.Json.JavaScriptArray jSArrEntry = (Newtonsoft.Json.JavaScriptArray)jSObjFeed["entry"];
                            if (jSArrEntry != null)
                            {
                                using (System.Collections.Generic.List<object>.Enumerator enumerator = jSArrEntry.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        Newtonsoft.Json.JavaScriptObject objCurrent = (Newtonsoft.Json.JavaScriptObject)enumerator.Current;
                                        Strategy strategy = new Strategy();

                                        Newtonsoft.Json.JavaScriptObject jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$name"];
                                        strategy.Name = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$stepid"];
                                        strategy.StepID = int.Parse(jsObj2["$t"].ToString());

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$field"];
                                        strategy.Field = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$operator"];
                                        strategy.Operator = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$valuetocompare"];
                                        strategy.ValueToCompare = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$object"];
                                        strategy.Obj = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$expected"];
                                        strategy.Expected = bool.Parse(jsObj2["$t"].ToString());

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$adminallowed"];
                                        strategy.AdminAllowed = bool.Parse(jsObj2["$t"].ToString());

                                        listStrategy.Add(strategy);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }

            MatchDTO match = new MatchDTO();
            match.HomeTeamName = "Man U";
            match.AwayTeamName = "Chelsea";
            match.AwayScore = "2";
            match.HomeScore = "1";
            match.Minute = 34;

            OddDTO odd = new OddDTO();            
            odd.Home = 0.95f;
            odd.Away = 0.95f;
            odd.Type = eOddType.FulltimeOverUnder;

            match.Odds = new List<OddDTO>();
            match.Odds.Add(odd);            
            
            foreach (Strategy st in listStrategy)
            {
                if (st.AdminAllowed == true && st.StepID != 100)
                {
                    if (st.Obj == "Odd")
                    {
                        foreach (OddDTO o in match.Odds)
                        {
                            if (st.ValueToCompare == "Odd.Away")
                                st.Result = Operator.Apply(o, st.Operator, st.Field, o.Away);
                            else
                                st.Result = Operator.Apply(o, st.Operator, st.Field, st.ValueToCompare);
                            if (st.Result == st.Expected)
                                break;
                        }
                    }
                    else if (st.Obj == "Match")
                    {
                        st.Result = Operator.Apply(match, st.Operator, st.Field, st.ValueToCompare);
                    }
                }
                if (st.Result == true)
                {
                    iBet.Utilities.WriteLog.Write(st.Name + " step " + st.StepID.ToString() + ": checking " + st.Obj + "." + st.Field
                        + " " + st.Operator + " " + st.ValueToCompare + " >>> RESULT: " +
                        st.Result.ToString());
                }
                else
                {
                    iBet.Utilities.WriteLog.Write(st.Name + " step " + st.StepID.ToString() + ": checking " + st.Obj + "." + st.Field
                        + " " + st.Operator + " " + st.ValueToCompare + " >>> RESULT: " +
                        st.Result.ToString());
                }
            }
        }
コード例 #6
0
        private void CompareSameMatch()
        {
            this._comparing = true;
            lock (this._listSameMatch)
            {
                System.Collections.Generic.List<MatchDTO> listIBETMatch = this._listIBETMatch;
                System.Collections.Generic.List<MatchDTO> listSbobetMatch = this._listSbobetMatch;

                if (this._listSameMatch != null)
                {
                    this._listSameMatch.Clear();
                }
                else
                {
                    this._listSameMatch = new System.Collections.Generic.List<MatchDTO>();
                }

                if (scantype == ScanningType.both)
                {
                    #region BuonComIBETSBO
                    Dictionary<string, IbetMatch> iMatchs = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                    Dictionary<string, SboMatch> sMatchs = this._sbobetEngine.sboAgent.parserLive.LdicMatches[0];
                    //var i = iMatchs.Values.
                    foreach (KeyValuePair<string, IbetMatch> iM in iMatchs)
                    {
                        foreach (KeyValuePair<string, SboMatch> sM in sMatchs)
                        {
                            if ((iM.Value.Home == sM.Value.home) || (iM.Value.Away == sM.Value.away))
                            {
                                MatchDTO matchDTO = new MatchDTO();
                                matchDTO.ID = iM.Value.MatchId;
                                matchDTO.AwayTeamName = iM.Value.Away + " / " + sM.Value.away;
                                matchDTO.HomeTeamName = iM.Value.Home + " / " + sM.Value.home;
                                matchDTO.Minute = iM.Value.Minute;
                                matchDTO.HomeScore = iM.Value.ScoreH.ToString();
                                matchDTO.AwayScore = iM.Value.ScoreA.ToString();
                                if (iM.Value.Period == 0)
                                    matchDTO.IsHalfTime = true;
                                else if (iM.Value.Period == 1)
                                    matchDTO.Half = 1;
                                else if (iM.Value.Period == 2)
                                    matchDTO.Half = 2;

                                LeagueDTO leagueDTO = new LeagueDTO();
                                leagueDTO.Name = iM.Value.LeagueName + " / " + sM.Value.leagueName;
                                leagueDTO.ID = iM.Value.LeagueId;
                                matchDTO.League = leagueDTO;

                                foreach (KeyValuePair<string, SboOdd> sO in sM.Value.dicOdds)
                                {
                                    foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                    {
                                        if (sO.Value.oddType == iO.Value.oddType)
                                        {
                                            if (sO.Value.home + iO.Value.away == -0.01m || sO.Value.home + iO.Value.away == 0)
                                            {
                                                //iBet.Utilities.WriteLog.Write("Odd Found:iH sA: " + iM.Value.Home + "/" + sM.Value.home + "-" + iM.Value.Away + "/" + sM.Value.away +
                                                //    " >> ibet Odd: " + iO.Value.home + "/" + iO.Value.away + " >> sbo Odd:" + sO.Value.home + "/" + sO.Value.away +
                                                //    " >> " + iO.Value.oddType + ":" + sO.Value.oddType);
                                                //BetObject betObject = new BetObject();
                                                //betObject.ibet = new Bet();

                                                //this._ibetEngine.ibetAgent.CheckOdds

                                                TransactionDTO transactionDTO = new TransactionDTO();
                                            }
                                            if (sO.Value.away + iO.Value.home == -0.01m || sO.Value.away + iO.Value.home == 0)
                                            {
                                                //iBet.Utilities.WriteLog.Write("Odd Found:iA sH: " + iM.Value.Home + "/" + sM.Value.home + "-" + iM.Value.Away + "/" + sM.Value.away +
                                                //    " >> ibet Odd: " + iO.Value.home + "/" + iO.Value.away + " >> sbo Odd:" + sO.Value.home + "/" + sO.Value.away +
                                                //    " >> " + iO.Value.oddType + ":" + sO.Value.oddType);
                                            }
                                        }
                                    }
                                }
                                this._listSameMatch.Add(matchDTO);
                            }
                        }
                    }
                    System.DateTime now = System.DateTime.Now;
                    System.TimeSpan timeSpan;

                    System.DateTime now2 = System.DateTime.Now;
                    timeSpan = now2 - now;
                    double totalMilliseconds = timeSpan.TotalMilliseconds;
                    BarItem arg_648_0 = this.lblSbobetTotalMatch;
                    int count = sMatchs.Count;
                    arg_648_0.Caption = count.ToString();
                    BarItem arg_663_0 = this.lblIbetTotalMatch;
                    count = iMatchs.Count;
                    arg_663_0.Caption = count.ToString();
                    this.lblSameMatch.Caption = "Total Same Match: " + this._listSameMatch.Count;
                    this.lblLastUpdate.Caption = System.DateTime.Now.ToString();
                    #endregion
                }
                else if (scantype == ScanningType.ibet || scantype == ScanningType.ibetVSibet)
                {                    
                    Dictionary<string, IbetMatch> iMatchs1 = new Dictionary<string, IbetMatch>();
                    Dictionary<string, IbetMatch> iMatchs0 = new Dictionary<string, IbetMatch>();
                    if (checkEdit5.Checked)//live
                        iMatchs0 = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                    if (checkEdit6.Checked)//non live
                        iMatchs1 = this._ibetEngine.ibetAgent.parser.LdicMatches[1];

                    this._ibetMatchs = iMatchs1.Concat(iMatchs0).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value);
                    lock (this._ibetMatchs)
                    {
                        foreach (KeyValuePair<string, IbetMatch> iM in _ibetMatchs)
                        {
                            #region SAMEWORD_PREPARE_MATCHLIST
                            MatchDTO matchDTO = new MatchDTO();
                            matchDTO.ID = iM.Value.MatchId;
                            matchDTO.AwayTeamName = iM.Value.Away;
                            matchDTO.HomeTeamName = iM.Value.Home;
                            //matchDTO.KickOffTime = iM.Value.KickOffTime;
                            string formatString = "yyyyMMddHHmm";
                            //string sample = "201006112219";
                            DateTime dt = DateTime.ParseExact(iM.Value.KickOffTime, formatString, null);
                            matchDTO.KickOffTime = dt.ToString("dd/MM HH:mm");
                            DateTime ct = DateTime.Parse(this._ibetEngine.ibetAgent.CT);
                            TimeSpan ts = dt.Subtract(ct);//kick off time - current time
                            double tic = ts.TotalSeconds;
                            if (tic <= 300 && tic > 0)
                            {
                                matchDTO.KickOffTime += " - " + ts.Minutes.ToString() + " mins to start";
                            }
                            else if (tic < 0)
                            {
                                matchDTO.KickOffTime += " !Live";
                            }

                            matchDTO.Minute = iM.Value.Minute;
                            matchDTO.HomeScore = iM.Value.ScoreH.ToString();
                            matchDTO.AwayScore = iM.Value.ScoreA.ToString();

                            if (iM.Value.Period == 0)
                                matchDTO.IsHalfTime = true;
                            else if (iM.Value.Period == 1)
                                matchDTO.Half = 1;
                            else if (iM.Value.Period == 2)
                                matchDTO.Half = 2;

                            LeagueDTO leagueDTO = new LeagueDTO();
                            leagueDTO.Name = iM.Value.LeagueName;
                            leagueDTO.ID = iM.Value.LeagueId;
                            matchDTO.League = leagueDTO;

                            this._listSameMatch.Add(matchDTO);
                            int num = 0;
                            if (this.chbRandomStake.Checked)
                            {
                                while (num == 0)
                                {
                                    string strNum = this.txtStake.Lines[new System.Random().Next(this.txtStake.Lines.Length)];
                                    int.TryParse(strNum, out num);
                                }
                            }

                            #endregion

                            if (scantype == ScanningType.ibetVSibet)
                            {
                                #region IBET_vs_IBET
                                if (leagueDTO.Name.Contains("SPECIFIC 15 MINS OVER/UNDER"))
                                {
                                    if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                    {
                                        if (matchDTO.HomeTeamName.Contains("30:01-45:00") || matchDTO.HomeTeamName.Contains("75:01-90:00"))
                                        {
                                            if (!matchDTO.KickOffTime.Contains("Live"))
                                            {
                                                foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                                {
                                                    if (iO.Value.oddType == 3)//keo OU
                                                    {
                                                        TransactionDTO transactionDTO;
                                                        string strOU = "a";
                                                        if (checkEdit2.Checked)
                                                        {
                                                            strOU = "h";
                                                        }
                                                        if (matchDTO.HomeTeamName.Contains("30:01-45:00"))
                                                        {
                                                            if (checkEdit17.Checked)//allow Half 1
                                                            {
                                                               
                                                                transactionDTO = PlaceSingleIBET("Over15_Fang", iO.Value.home.ToString(),
                                                                    matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, strOU,
                                                                    num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                this.AddTransaction(transactionDTO);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (checkEdit18.Checked) //allow half 2
                                                            {
                                                                transactionDTO = PlaceSingleIBET("Over15_Fang", iO.Value.home.ToString(),
                                                                matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, strOU,
                                                                num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                this.AddTransaction(transactionDTO);
                                                            }
                                                        }
                                                        
                                                    }
                                                }
                                            }
 
                                        }
                                    } 
                                }
                                #endregion
                            }
                            else if (scantype == ScanningType.ibet)
                            {
                                #region IBET_Strategies
                                foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                {
                                    if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                    {
                                        if (checkEdit12.Checked) // under strategy
                                        {
                                            if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                            {
                                                if (checkEdit9.Checked)
                                                {
                                                    if (!matchDTO.KickOffTime.Contains("Live"))
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("Under", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "a",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                    }
                                                }
                                                else
                                                {
                                                    TransactionDTO transactionDTO = PlaceSingleIBET("Under", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "a",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                    this.AddTransaction(transactionDTO);
                                                }
                                            }
                                        }
                                        if (checkEdit8.Checked) //over strategy
                                        {
                                            if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                            {
                                                TransactionDTO transactionDTO = PlaceSingleIBET("Over", iO.Value.home.ToString(),
                                                    matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                    num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                this.AddTransaction(transactionDTO);
                                            }
                                        }
                                        if (checkEdit7.Checked) // Over 92/90
                                        {
                                            if (matchDTO.KickOffTime.Contains("Live"))
                                            {
                                                if (iO.Value.oddType == 3 || iO.Value.oddType == 8)
                                                {
                                                    if (iO.Value.hdp - ((decimal)iM.Value.ScoreH + (decimal)iM.Value.ScoreA) == (decimal)0.5)
                                                    {
                                                        if (iM.Value.Home.Contains("No. of Corners") && iO.Value.home == (decimal)0.90 && iO.Value.away == (decimal)0.92)
                                                        {
                                                            TransactionDTO transactionDTO = PlaceSingleIBET("Over9290", iO.Value.home.ToString(),
                                                            matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                            this.AddTransaction(transactionDTO);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if (checkEdit9.Checked) // Odd down: Sap keo
                                        {
                                            if (matchDTO.KickOffTime.Contains("mins to start"))
                                            {
                                                if (iO.Value.oddType == 3)
                                                {
                                                    List<Bet> bl = this._ibetEngine.ibetAgent.betList;
                                                    lock (bl)
                                                    {
                                                        foreach (Bet bet in bl)
                                                        {
                                                            if (bet.Home == matchDTO.HomeTeamName && bet.Away == matchDTO.AwayTeamName)
                                                            {
                                                                iBet.Utilities.WriteLog.Write("Sap Keo:: Tim thay keo trong bet list trong tran : " + bet.Home + " - " + bet.Away);
                                                                if (bet.Handicap == iO.Value.hdp)
                                                                {
                                                                    if (iO.Value.away < 0 || iO.Value.away - bet.OddsValue >= (decimal)0.05)
                                                                    {
                                                                        iBet.Utilities.WriteLog.Write("Sap Keo:: Keo bi sap " + (iO.Value.away - bet.OddsValue).ToString() + " gia. Go to bet over");
                                                                        //keo under sap xuo^'ng an cao hon
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET("SapKeo", iO.Value.home.ToString(),
                                                                            matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if (chbHighRevenueBoost.Checked) // Best analysed strategy
                                        {
                                            if (!leagueDTO.Name.Contains("Cup") && !leagueDTO.Name.Contains("CUP"))
                                            {
                                                if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                                {
                                                    OddDTO oddDTO = new OddDTO();
                                                    oddDTO.Odd = iO.Value.hdp.ToString();
                                                    string s = CheckBestStrategyValidation(matchDTO, oddDTO);
                                                    if (s == "nguoc")
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("nguoc", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                        //Console.Write("nguoc");
                                                    }
                                                    else if (s == "xuoi")
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("xuoi", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                        //Console.Write("xuoi");
                                                    }
                                                }
                                            }
                                        }
                                        if (checkEdit11.Checked)//fair odd
                                        {
                                            if (!leagueDTO.Name.Contains("Cup") && !leagueDTO.Name.Contains("CUP"))
                                            {
                                                if (iM.Value.Minute >= 35 && iM.Value.Period == 1 && iM.Value.ScoreA == iM.Value.ScoreH)
                                                {
                                                    iBet.Utilities.WriteLog.Write("01:Found fair odd: " + iM.Value.Home + "-" + iM.Value.Away + ":" + iM.Value.Minute + "m");
                                                    if ((iO.Value.home > (decimal)0.9)
                                                        && iO.Value.oddType == 3
                                                        && (iO.Value.hdp - (decimal)(iM.Value.ScoreH + iM.Value.ScoreA) == (decimal)1.75))
                                                    {
                                                        iBet.Utilities.WriteLog.Write("02:Found fair odd correct");
                                                        foreach (KeyValuePair<string, IbetMatch> snapshotMacht in _ibetMatchsSnapShot)
                                                        {
                                                            if (snapshotMacht.Value.Home == iM.Value.Home && snapshotMacht.Value.Away == iM.Value.Away)
                                                            {
                                                                iBet.Utilities.WriteLog.Write("03:Found match in Snapshot");
                                                                foreach (KeyValuePair<string, IbetOdd> snapshotOdd in snapshotMacht.Value.dicOdds)
                                                                {
                                                                    if (snapshotOdd.Value.oddType == 3
                                                                        && snapshotOdd.Value.hdp >= (decimal)2.5
                                                                        && (snapshotOdd.Value.home >= (decimal)0.92 || snapshotOdd.Value.home < (decimal)0))
                                                                    {
                                                                        iBet.Utilities.WriteLog.Write("04:Found odd over 2.5 correct in Snapshot");
                                                                        if (snapshotOdd.Value.oddType == 1 && snapshotOdd.Value.hdp <= (decimal)0.75)
                                                                        {
                                                                            iBet.Utilities.WriteLog.Write("05:Found handicap correct in Snapshot, go to Bet");
                                                                            TransactionDTO transactionDTO = PlaceSingleIBET("Over1.75", iO.Value.home.ToString(),
                                                                            matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                            this.AddTransaction(transactionDTO);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion
                            }                            
                        }
                    }
                    if (scantype == ScanningType.ibetVSibet)
                    {
                        #region IBET_vs_IBET_continue
                        
                        Dictionary<string, IbetMatch> iMatchs2 = new Dictionary<string, IbetMatch>();         
                        iMatchs2 = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                        //this._ibetEngine.ibetAgent.RefreshBetList();
                        lock (iMatchs2)
                        {
                            foreach (KeyValuePair<string, IbetMatch> iM2 in _ibetMatchs)
                            {                                
                                if ((iM2.Value.Period == 1 && iM2.Value.Minute >= (int)spinEdit1.Value) || (iM2.Value.Period == 2 && iM2.Value.Minute >= (int)spinEdit2.Value)) // chi chon nhung tran p31 cua hiep 1
                                {
                                    foreach (KeyValuePair<string, IbetOdd> iO2 in iM2.Value.dicOdds)
                                    {
                                        if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                        {
                                            if (iO2.Value.oddType == 8 || iO2.Value.oddType == 3)
                                            {
                                                if (iO2.Value.hdp - ((decimal)iM2.Value.ScoreH + (decimal)iM2.Value.ScoreA) == (decimal)0.5)
                                                {
                                                    bl = this._ibetEngine.ibetAgent.betList;
                                                    foreach (Bet bet in bl)
                                                    {
                                                        if (bet.Home.Contains("30:01-45:00") || bet.Home.Contains("75:01-90:00"))
                                                        {
                                                            string HomeTeam = "";
                                                            if (iO2.Value.oddType == 8)
                                                            {
                                                                HomeTeam = bet.Home.Replace(" 30:01-45:00", "");

                                                            }
                                                            else
                                                            {
                                                                HomeTeam = bet.Home.Replace(" 75:01-90:00", "");
                                                            }
                                                            

                                                            if (HomeTeam == iM2.Value.Home.Replace("(N)", "").TrimEnd())
                                                            {                                                                    
                                                                MatchDTO matchDTO = new MatchDTO();
                                                                matchDTO.HomeTeamName = iM2.Value.Home.Replace("(N)", "").TrimEnd();
                                                                matchDTO.AwayTeamName = iM2.Value.Away.Replace("(N)","").TrimEnd();
                                                                matchDTO.Minute = iM2.Value.Minute;
                                                                matchDTO.HomeScore = iM2.Value.ScoreH.ToString();
                                                                matchDTO.AwayScore = iM2.Value.ScoreA.ToString();
                                                                matchDTO.Half = iM2.Value.Period;

                                                                int num = (int)bet.Stake;
                                                                int ExRate1 = (int)config.Ibet.ExchangeRate;
                                                                int ExRate2 = (int)config.Ibet2.ExchangeRate;
                                                                float stake2 = num * ExRate1 / ExRate2;

                                                                decimal giatri1;
                                                                string OU = "h";

                                                                if (bet.Choice == Choice.H)
                                                                {
                                                                    giatri1 = iO2.Value.away;
                                                                    OU = "a";
                                                                }
                                                                else
                                                                {
                                                                    giatri1 = iO2.Value.home;
                                                                }

                                                                //iBet.Utilities.WriteLog.Write("Tim thay tran :" + bet.Home + " -vs- " + bet.Away +
                                                                //    ", o phut thu:" + matchDTO.Minute.ToString() + ", hiep " + matchDTO.Half.ToString() +
                                                                //    "chuan bi xa..");                                                                
                                                                eOddType oddtype;

                                                                if ((giatri1 > 0 && bet.OddsValue + giatri1 >= spinEdit4.Value) || giatri1 < 0)
                                                                {
                                                                    if (checkEdit1.Checked)
                                                                    {
                                                                        
                                                                        string textx = "";
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa loi gia > Min:" + matchDTO.Minute + "half " + matchDTO.Half.ToString() + " > " + bet.OddsValue.ToString() + "/" + giatri1.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa loi gia > Min:" + matchDTO.Minute + "half " + matchDTO.Half.ToString() + " > " + bet.OddsValue.ToString() + "/" + giatri1.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, giatri1.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                        iBet.Utilities.WriteLog.Write(textx);
                                                                    }
                                                                }
                                                                else 
                                                                {
                                                                    string textx = "";
                                                                    if (bet.Choice == Choice.H && matchDTO.Minute >= 30)
                                                                    {
                                                                        
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, iO2.Value.away.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                        //iBet.Utilities.WriteLog.Write(textx);
                                                                    }
                                                                    else if (bet.Choice == Choice.A && matchDTO.Minute >= 34)
                                                                    {
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, iO2.Value.away.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO); 
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }                                                    
                                                }
                                            }
                                        }
                                    }                                     
                                }
                            }
                        }
                        #endregion
                    }
                    BarItem arg_663_0 = this.lblIbetTotalMatch;
                    int count = _ibetMatchs.Count;
                    arg_663_0.Caption = count.ToString() + " (" + iMatchs0.Count.ToString() + " live)";
                    this.lblLastUpdate.Caption = System.DateTime.Now.ToString();
                    this.rpgIbet.Text = "IBET - " + this._ibetEngine.ibetAgent.Config.Account + " " + this._ibetEngine.ibetAgent.CT;
                    
                }
                else if (scantype == ScanningType.sbo)
                {
                    #region SBO_Strategies
                    Dictionary<string, SboMatch> sMatchs0 = this._sbobetEngine.sboAgent.parserLive.dicMatches;
                    Dictionary<string, SboMatch> sMatchs1 = this._sbobetEngine.sboAgent.parserNonlive.dicMatches;
                    Dictionary<string, SboMatch> sMatchs = sMatchs1.Concat(sMatchs0).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value);
                    foreach (KeyValuePair<string, SboMatch> sM in sMatchs)
                    {
                        MatchDTO matchDTO = new MatchDTO();
                        matchDTO.ID = sM.Value.matchId;
                        matchDTO.AwayTeamName = sM.Value.away;
                        matchDTO.HomeTeamName = sM.Value.home;

                        matchDTO.AwayScore = sM.Value.awayscore.ToString();
                        matchDTO.HomeScore = sM.Value.homescore.ToString();
                        matchDTO.Minute = sM.Value.minute;
                        matchDTO.Half = sM.Value.half;
                        if (matchDTO.Half == 0)
                            matchDTO.IsHalfTime = true;

                        LeagueDTO leagueDTO = new LeagueDTO();
                        leagueDTO.Name = sM.Value.leagueName;
                        leagueDTO.ID = sM.Value.leagueId;
                        matchDTO.League = leagueDTO;

                        this._listSameMatch.Add(matchDTO);
                    }
                    BarItem arg_648_0 = this.lblSbobetTotalMatch;
                    int count = sMatchs.Count;
                    arg_648_0.Caption = count.ToString() + " (" + sMatchs0.Count.ToString() + " live)";
                    #endregion
                }
                else if (scantype == ScanningType.ibetVSibet)
                {
                    
                }
                lock (this.grdSameMatch)
                {
                    this.grdSameMatch.RefreshDataSource();
                }
                lock (girdBetList1)
                {
                    this.girdBetList1.RefreshDataSource();
                }
            }
            
            this._comparing = false;
            if (this._compareAgain && !this._comparing)
            {
                this._compareAgain = false;
                this.CompareSameMatch();
            }
        }
コード例 #7
0
        private string CheckBestStrategyValidation(MatchDTO match, OddDTO odd)
        {
            string result = "";

            var listOddGoodToBet = from p in listBA
                        where p.isGoodOddToBet == true
                        select p;
            foreach (BetAnalyse ba in listOddGoodToBet)
            {
                string intHomeScore = "0";
                string intAwayScore = "0";
                string[] array4 = ba.OddType.Split(new string[] { " " }, System.StringSplitOptions.None);
                string OddValue = array4[1];

                if (ba.OddType.Contains("["))
                {
                    string[] array1 = ba.OddType.Split(new string[] { " [" }, System.StringSplitOptions.None);
                    string[] array2 = array1[1].Split(new string[] { "]" }, System.StringSplitOptions.None);
                    string[] array3 = array2[0].Split(new string[] { "-" }, System.StringSplitOptions.None);
                    intHomeScore = array3[0];
                    intAwayScore = array3[1];
                    if (!match.IsHalfTime && match.HomeScore == intHomeScore && match.AwayScore == intAwayScore)
                    {
                        if (odd.Odd == OddValue)
                        {
                            if (ba.Diff < 0)
                            {
                                iBet.Utilities.WriteLog.Write("Live:: Checking valid strategy: nguoc :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                                return "nguoc";
                            }
                            else
                            {
                                iBet.Utilities.WriteLog.Write(" Checking valid strategy: xuoi :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                                return "xuoi";
                            }
                        }
                    }
                }
                else
                {
                    if (match.IsHalfTime && match.HomeScore == "0" && match.AwayScore == "0" && odd.Odd == OddValue)
                    {
                        if (ba.Diff < 0)
                        {
                            iBet.Utilities.WriteLog.Write("NonLive:: Checking valid strategy: nguoc :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                            return "nguoc";
                        }
                        else
                        {
                            iBet.Utilities.WriteLog.Write("NonLive:: Checking valid strategy: xuoi :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                            return "xuoi";
                        }
                    }
                }
            }

            return result;
        }
コード例 #8
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string data, out string updateTime, out Dictionary<string, string> mappingList3in1)
        { 
            System.Collections.Generic.List<MatchDTO> list = null;
            System.Collections.Generic.Dictionary<string, string> map = new Dictionary<string,string>();
            updateTime = string.Empty;
            if (data != string.Empty)
            {
                list = new System.Collections.Generic.List<MatchDTO>();

                JavaScriptObject javaScriptObj = (JavaScriptObject)JavaScriptConvert.DeserializeObject(data);
                if (javaScriptObj != null)
                {
                    string timeUpdate = javaScriptObj["t"].ToString();
                    updateTime = timeUpdate;
#if DEBUG
                    Utilities.WriteLog.Write("3in1: time after get full data:" + timeUpdate);
#endif
                    if (javaScriptObj["data"] != null)
                    {
                        string matchID = string.Empty;

                        JavaScriptArray objLiveMatch = (JavaScriptArray)javaScriptObj["data"];
                        objLiveMatch.RemoveAt(objLiveMatch.Count - 1);
#if DEBUG
                        Utilities.WriteLog.Write("3in1: Number of objects in first get data:" + objLiveMatch.Count.ToString()
                            + ". After remove the last item from [\"data\"]:" + (objLiveMatch.Count - 1).ToString());
#endif
                        using (System.Collections.Generic.List<object>.Enumerator enumerator = objLiveMatch.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {

                                JavaScriptArray objCurrentMatchProcess = (JavaScriptArray)enumerator.Current;
                                string string38 = objCurrentMatchProcess[38].ToString(); // HomeTeamName
                                string string53 = objCurrentMatchProcess[53].ToString(); //Time
                                if (!string38.ToLower().Contains("corner") && !string38.ToLower().Contains(":") && !string38.ToLower().Contains("(et)") && !string38.ToLower().Contains("(pen)"))
                                {
                                    if (objCurrentMatchProcess[34].ToString() != matchID)
                                    {
                                        MatchDTO matchDTO = new MatchDTO();
                                        matchDTO.ID = objCurrentMatchProcess[34].ToString();
                                        matchDTO.HomeTeamName = string38;
                                        matchDTO.AwayTeamName = objCurrentMatchProcess[39].ToString();
                                        matchDTO.League = new LeagueDTO();
                                        matchDTO.League.ID = objCurrentMatchProcess[3].ToString();
                                        matchDTO.League.Name = objCurrentMatchProcess[37].ToString();
                                        matchDTO.HomeScore = objCurrentMatchProcess[7].ToString();
                                        matchDTO.AwayScore = objCurrentMatchProcess[8].ToString();

                                        if (string53 == "HT")
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else if (string53.ToLower().Contains("live"))
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else if (string53.StartsWith("1H"))
                                        {
                                            matchDTO.Minute = ConvertSoccerTime(string53);
                                            matchDTO.Half = 1;
                                            matchDTO.IsHalfTime = true;
                                        }
                                        else if (string53.StartsWith("2H"))
                                        {
                                            matchDTO.Minute = ConvertSoccerTime(string53);
                                            matchDTO.Half = 2;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                            

                                        #region add odds
                                        matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();//add Odds
                                        string string24 = objCurrentMatchProcess[24].ToString();
                                        string string9 = objCurrentMatchProcess[9].ToString();
                                        string string13 = objCurrentMatchProcess[13].ToString();
                                        string string0 = objCurrentMatchProcess[0].ToString();

                                        float num = 0f;
                                        if (string9 != null && string9 != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME !!!!!!!!!
                                            oddDTO.ID = string0 + "^";
                                            oddDTO.Odd = string9.Replace("/", "-");
                                            if (objCurrentMatchProcess[40].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[40].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[41].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[41].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }                                            

                                            if (string24 == "1" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~3in1bet:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ": "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[11] != null
                                            && objCurrentMatchProcess[11].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeOverUnder;// FULL TIME OVER/UNDER
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[11].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[42].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[42].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[43].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[43].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[13] != null
                                            && objCurrentMatchProcess[13].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST HALF HANDICAP
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[13].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[44].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[44].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[45].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[45].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[15] != null
                                            && objCurrentMatchProcess[15].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfOverUnder; // FIRST HAFL OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[15].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[46].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[46].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[47].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[47].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        #endregion

                                        matchID = matchDTO.ID;
                                        list.Add(matchDTO);
#if DDEBUG
                                        Utilities.WriteLog.Write("~M~:3in1: Added match: "
                                            + matchDTO.HomeTeamName
                                            + " - " + matchDTO.AwayTeamName
                                            + "with number of odds: "
                                            + matchDTO.OddCount
                                            + ", ID: "
                                            + matchDTO.ID);                                        
#endif
                                    }
                                    else
                                    {
                                        //neu da co matchID thi lay tran dau vua add o tren
                                        MatchDTO matchDTO = list[list.Count - 1];
                                        string string24 = objCurrentMatchProcess[24].ToString();
                                        string string9 = objCurrentMatchProcess[9].ToString();
                                        string string0 = objCurrentMatchProcess[0].ToString();
                                        string string13 = objCurrentMatchProcess[13].ToString();

                                        #region add odds
                                        //matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();//add Odds
                                        float num = 0f;
                                        if (string9 != null && string9 != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME !!!!!!!!!
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[9].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[40].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[40].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[41].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[41].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[11] != null
                                            && objCurrentMatchProcess[11].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeOverUnder; // FULL TIME OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[11].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[42].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[42].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[43].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[43].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[13] != null
                                            && objCurrentMatchProcess[13].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST HALF HANDICAP
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[13].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[44].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[44].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[44].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[45].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[15] != null
                                            && objCurrentMatchProcess[15].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfOverUnder; // FIRST HALF OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[15].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[46].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[46].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[47].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[47].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        #endregion
#if DDEBUG
                                        Utilities.WriteLog.Write("3in1: " + matchDTO.ID + " was added one more odd");
#endif
                                    }
                                }
                            }
                        }
#if DDEBUG
                        Dictionary<string, string>.KeyCollection keyColl = map.Keys;
                        foreach (string s in keyColl)
                        {
                            Utilities.WriteLog.Write("Add odd ID: " + s + " match ID: " + map[s]);
                        }
                        //foreach (MatchDTO matchVaiLon in matchDTO
#endif
                    }
                    else // [data] is null
                    {
 
                    }
                }             
            }
            mappingList3in1 = map;
            if (list != null)
              return list;
            else 
            {
                MatchDTO mNull = new MatchDTO();
                list.Add(mNull);
                return list;
            }
        }
コード例 #9
0
        public static System.Collections.Generic.List<MatchDTO> ConvertUpdateData(
            string data,
            System.Collections.Generic.List<MatchDTO> originalDataSource,
            out string updateTime,
            Dictionary<string, string> originalMappingOddwithMatch,
            out Dictionary<string, string> mappingOddwithMatch)
        {
            System.Collections.Generic.List<MatchDTO> list = BaseDTO.DeepClone<System.Collections.Generic.List<MatchDTO>>(originalDataSource);
            //Dictionary<string, string> map = null;
            updateTime = string.Empty;
            if (data != string.Empty)
            {
                JavaScriptObject javaScriptObj = (JavaScriptObject)JavaScriptConvert.DeserializeObject(data);
                if (javaScriptObj != null)
                {
                    string timeUpdate = javaScriptObj["t"].ToString();
#if DEBUG
                    Utilities.WriteLog.Write("3in1: Time after lastest updated data:" + timeUpdate);
#endif
                    updateTime = timeUpdate;

                    if (javaScriptObj["data"] != null)
                    {
                        JavaScriptArray objLiveMatch = (JavaScriptArray)javaScriptObj["data"];
                        using (System.Collections.Generic.List<object>.Enumerator enumerator = objLiveMatch.GetEnumerator())
                        {
#if DDEBUG
                            int countNumberOfOddCanBeUpdated = 0;
#endif
                            while (enumerator.MoveNext())
                            {
                                JavaScriptArray objCurrentMatchProcess = (JavaScriptArray)enumerator.Current;

                                if (objCurrentMatchProcess.Count == 8) // update changed odd only!!
                                {
                                    int num = 0;
                                    if (int.TryParse(objCurrentMatchProcess[2].ToString(), out num))
                                    {
                                        string matchID = string.Empty;
                                        string oddID = string.Empty;

                                        if (num == 30 || num == 28)// handicap full time ^
                                        {
#if DDEBUG
                                            Utilities.WriteLog.Write("Proccessing odd ID: " + objCurrentMatchProcess[0].ToString() + "^ , type: " + objCurrentMatchProcess[2].ToString());
#endif
                                            oddID = objCurrentMatchProcess[0].ToString() + "^";
                                        }
                                        else if (num == 40 || num == 38)//handicap first half
                                        {
                                            int i;
                                            if (int.TryParse(objCurrentMatchProcess[0].ToString(), out i))
                                            {
                                                i++;
                                            }
                                            oddID = i.ToString() + "^";
#if DDEBUG
                                            Utilities.WriteLog.Write("Proccessing odd ID: " + oddID + " , type: " + objCurrentMatchProcess[2].ToString());
#endif
                                        }
                                        else if (num == 35 || num == 33 || num == 58 || num == 16 || num == 17) // over under full time, 16, 17: update score
                                        {
                                            oddID = objCurrentMatchProcess[0].ToString();
#if DDEBUG
                                            Utilities.WriteLog.Write("Proccessing odd ID: " + oddID + " , type: " + objCurrentMatchProcess[2].ToString());
#endif
                                        }
                                        else if (num == 43 || num == 45) // over / under first haft
                                        {
                                            int i;
                                            if (int.TryParse(objCurrentMatchProcess[0].ToString(), out i))
                                            {
                                                i++;
                                            }
                                            oddID = i.ToString();
#if DDEBUG
                                            Utilities.WriteLog.Write("Proccessing odd ID: " + oddID + " ,type: " + objCurrentMatchProcess[2].ToString());
#endif
                                        }

                                        if (oddID != string.Empty && originalMappingOddwithMatch.TryGetValue(oddID, out matchID))
                                        {
                                            MatchDTO matchDTO2 = MatchDTO.SearchMatch(matchID, list);
                                            if (matchDTO2 != null)
                                            {
                                                OddDTO oddDTO2 = null;
                                                oddDTO2 = OddDTO.SearchOdd(oddID, matchDTO2.Odds);// khong search dc o cho nay
                                                if (oddDTO2 != null)
                                                {
                                                    #region Update_Odd
                                                    matchDTO2.Odds.Remove(oddDTO2);//xoa odd cu
                                                    OddDTO oddDTO = new OddDTO();// tao odd moi      
                                                    oddDTO.ID = oddID;
                                                    oddDTO.IsHomeGive = oddDTO2.IsHomeGive;
                                                    float oddaway = 0f;
                                                    float oddhome = 0f;
                                                    bool validOddUpdate = Not999(objCurrentMatchProcess[3].ToString());

                                                    if (validOddUpdate)
                                                    {
                                                        if (float.TryParse(objCurrentMatchProcess[3].ToString(), out oddhome))
                                                        {
                                                            oddDTO.Home = oddhome;
                                                        }
                                                        if (float.TryParse(objCurrentMatchProcess[4].ToString(), out oddaway))
                                                        {
                                                            oddDTO.Away = oddaway;
                                                        }
                                                    }

                                                    switch (num)
                                                    {
                                                        case 16:
                                                            {
                                                                oddDTO = oddDTO2;
                                                                matchDTO2.HomeScore = objCurrentMatchProcess[3].ToString();
                                                                break;
                                                            }
                                                        case 17:
                                                            {
                                                                oddDTO = oddDTO2;
                                                                matchDTO2.AwayScore = objCurrentMatchProcess[3].ToString();
                                                                break;
                                                            }
                                                        case 30://full time handicap
                                                            {
                                                                oddDTO.Odd = oddDTO2.Odd;
                                                                oddDTO.Type = eOddType.FulltimeHandicap;
                                                                oddDTO.HomeFavor = oddDTO2.HomeFavor;
                                                                oddDTO.AwayFavor = oddDTO2.AwayFavor;
                                                                break;
                                                            }
                                                        case 35://full time over/under
                                                            {
                                                                oddDTO.Odd = oddDTO2.Odd;
                                                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                break;
                                                            }
                                                        case 40://Half time handicap
                                                            {
                                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                oddDTO.Odd = oddDTO2.Odd;
                                                                oddDTO.HomeFavor = oddDTO2.HomeFavor;
                                                                oddDTO.AwayFavor = oddDTO2.AwayFavor;
                                                                break;
                                                            }
                                                        case 45://Half time over / under
                                                            {
                                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                oddDTO.Odd = oddDTO2.Odd;
                                                                oddDTO.ID = oddID;
                                                                break;
                                                            }
                                                        case 28://full time handicap update ball
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeHandicap;
                                                                if (validOddUpdate)
                                                                {
                                                                    oddDTO.Odd = objCurrentMatchProcess[3].ToString().Replace("/", "-");
                                                                    oddDTO.Home = 0f;
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                else oddDTO.Odd = "clear";
                                                                break;
                                                            }
                                                        case 33://full time over / under update ball
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                if (validOddUpdate)
                                                                {
                                                                    oddDTO.Odd = objCurrentMatchProcess[3].ToString().Replace("/", "-");
                                                                    oddDTO.Home = 0f;
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                else oddDTO.Odd = "clear";
                                                                break;
                                                            }
                                                        case 38: // half time handicap update ball
                                                            {
                                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                if (validOddUpdate)
                                                                {
                                                                    oddDTO.Odd = objCurrentMatchProcess[3].ToString().Replace("/", "-");
                                                                    oddDTO.Home = 0f;
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                else oddDTO.Odd = "clear";
                                                                oddDTO.ID = oddID;
                                                                break;
                                                            }
                                                        case 43: // first half over under update ball
                                                            {
                                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                if (validOddUpdate)
                                                                {
                                                                    oddDTO.Odd = objCurrentMatchProcess[3].ToString().Replace("/", "-");
                                                                    oddDTO.Home = 0f;
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                else oddDTO.Odd = "clear";
                                                                oddDTO.ID = oddID;
                                                                break;
                                                            }
                                                        case 58: // update HOME GIVE full time
                                                            {
                                                                if (objCurrentMatchProcess[0].ToString() == objCurrentMatchProcess[3].ToString())
                                                                {
                                                                    oddDTO = oddDTO2;
                                                                    if (objCurrentMatchProcess[4].ToString() == "1")
                                                                    {
                                                                        oddDTO.HomeFavor = true;
                                                                        oddDTO.AwayFavor = false;
                                                                        oddDTO.IsHomeGive = true;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.HomeFavor = false;
                                                                        oddDTO.IsHomeGive = false;
                                                                    }
                                                                }
                                                                else if (objCurrentMatchProcess[0].ToString() != objCurrentMatchProcess[3].ToString())
                                                                {
                                                                    oddDTO = oddDTO2;
                                                                    if (objCurrentMatchProcess[4].ToString() == "1")
                                                                    {
                                                                        oddDTO.HomeFavor = true;
                                                                        oddDTO.AwayFavor = false;
                                                                        oddDTO.IsHomeGive = true;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.HomeFavor = false;
                                                                        oddDTO.IsHomeGive = false;
                                                                    }
                                                                }
                                                                break;
                                                            }
                                                        case 111:
                                                            {

                                                                break;
                                                            }
                                                        default:
                                                            {
                                                                //oddDTO.Away = 0f;
                                                                //oddDTO.Home = 0f;
                                                                //oddDTO.
                                                                break;
                                                            }
                                                    }
                                                    matchDTO2.Odds.Add(oddDTO);//add odd moi cho match
#if DDEBUG
                                                    Utilities.WriteLog.Write("3in1: Update type "
                                                        + objCurrentMatchProcess[2].ToString() + "; "
                                                        + oddDTO.Type.ToString() + " for match:"
                                                        + matchDTO2.HomeTeamName + " - " + matchDTO2.AwayTeamName
                                                        + " - " + oddDTO.Type.ToString()
                                                        + "; new odd: "
                                                        + oddDTO.Odd
                                                        + "; new price is Home:"
                                                        + oddDTO.Home.ToString()
                                                        + ", Away: " + oddDTO.Away.ToString()
                                                        + ", ID:"
                                                        + oddDTO.ID
                                                        );
#endif

                                                    #endregion
                                                }
#if DDEBUG
                                                else
                                                {
                                                    Utilities.WriteLog.Write("01. Can not find " + oddID + " of match: " + matchDTO2.HomeTeamName + " - " + matchDTO2.AwayTeamName);
                                                }
#endif

                                            }
#if DDEBUG
                                            else
                                            {
                                                Utilities.WriteLog.Write("02. Can not find " + matchID + " of odd ID: " + oddID);
                                            }

#endif
                                        }
                                        else
                                        {
#if DDEBUG
                                            Utilities.WriteLog.Write("03. Can not find odd ID:"
                                                + oddID
                                                + " in the Dictionary of Odd, update was type: "
                                                + objCurrentMatchProcess[2].ToString()
                                                + " , for ID: "
                                                + objCurrentMatchProcess[0].ToString()
                                                );
#endif
                                        }
                                    }
#if DDEBUG
                                    countNumberOfOddCanBeUpdated++;
#endif
                                }
                                else if (objCurrentMatchProcess.Count == 65)//system insert new odd
                                {

                                }
                                else if (objCurrentMatchProcess.Count == 7)//something happended
                                {

                                }
                            }
#if DDEBUG
                            Utilities.WriteLog.Write("Update data has " + countNumberOfOddCanBeUpdated + " odds valid update");
#endif
                        }
                    }

                    else
                    { 
                        
                    }

                }
            }
            mappingOddwithMatch = originalMappingOddwithMatch;
            return list;
        }
コード例 #10
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string data, out string updateTime)
        {
            System.Collections.Generic.List<MatchDTO> list = null;
            updateTime = string.Empty;
            if (data != string.Empty)
            {
                list = new System.Collections.Generic.List<MatchDTO>();
                data = data.Replace("\n", "");
                string[] array = data.Split(new string[]
				{
					";"
				}, System.StringSplitOptions.None);
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string text = array2[i];
                    if (text.StartsWith("window"))
                    {
                        updateTime = text.Substring(43, 19);
                    }
                    else
                    {
                        if (text.StartsWith("Nl"))
                        {
                            string value = text.Split(new string[]
							{
								"="
							}, System.StringSplitOptions.None)[1];
                            JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(value);
                            if (javaScriptArray[3].ToString() == "1")
                            {
                                MatchDTO matchDTO = new MatchDTO();
                                matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();
                                matchDTO.ID = javaScriptArray[0].ToString();
                                if (javaScriptArray[4].ToString() == string.Empty)
                                {
                                    MatchDTO matchDTO2 = list[list.Count - 1];
                                    matchDTO.League = matchDTO2.League;
                                }
                                else
                                {
                                    matchDTO.League = new LeagueDTO();
                                    matchDTO.League.ID = javaScriptArray[4].ToString();
                                    matchDTO.League.Name = javaScriptArray[5].ToString();
                                }
                                matchDTO.HomeTeamName = javaScriptArray[6].ToString();
                                matchDTO.AwayTeamName = javaScriptArray[7].ToString();
                                if (javaScriptArray.Count >= 12)
                                {
                                    if (javaScriptArray[12] != null
                                        && javaScriptArray[12].ToString() != string.Empty
                                        && !javaScriptArray[12].ToString().ToLower().Contains("t")
                                        && !javaScriptArray[12].ToString().ToLower().Contains("live"))
                                    {
                                        string[] array3 = javaScriptArray[12].ToString().ToLower().Split(new string[]
										{
											"h"
										}, System.StringSplitOptions.None);
                                        matchDTO.Half = int.Parse(array3[0]);
                                        matchDTO.Minute = int.Parse(array3[1].Trim().Replace("'", ""));
                                        matchDTO.IsHalfTime = false;
                                        //Utilities.WriteLog.Write(javaScriptArray[12].ToString());
                                    }
                                    else
                                    {
                                        matchDTO.Minute = 0;
                                        matchDTO.Half = 0;
                                        matchDTO.IsHalfTime = true;
                                    }
                                }
                                else
                                {
                                    matchDTO.Minute = 0;
                                    matchDTO.Half = 0;
                                    matchDTO.IsHalfTime = true;
                                }
                                float num = 0f;
                                if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME
                                    oddDTO.ID = javaScriptArray[24].ToString();
                                    oddDTO.Odd = javaScriptArray[25].ToString();
                                    //Utilities.WriteLog.Write(oddDTO.Odd);
                                    if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[28].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:" 
                                        + oddDTO.ID
                                        );
#endif

                                }
                                if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeOverUnder; //FULL TIME OVER UNDER
                                    oddDTO.ID = javaScriptArray[29].ToString();
                                    oddDTO.Odd = javaScriptArray[30].ToString();
                                    if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif
                                }
                                if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST
                                    oddDTO.ID = javaScriptArray[37].ToString();
                                    oddDTO.Odd = javaScriptArray[38].ToString();
                                    if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[41].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif

                                }
                                if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfOverUnder;
                                    oddDTO.ID = javaScriptArray[42].ToString();
                                    oddDTO.Odd = javaScriptArray[43].ToString();
                                    if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif
                                }
                                list.Add(matchDTO);
#if DDEBUG
                                Utilities.WriteLog.Write("~ M ~:ibet: Added match: "
                                    + matchDTO.HomeTeamName
                                    + " - " + matchDTO.AwayTeamName
                                    + ", with number of odds: " + matchDTO.OddCount);
#endif
                            }
                            else
                            {
                                MatchDTO matchDTO2 = list[list.Count - 1];
                                float num = 0f;
                                if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeHandicap;
                                    oddDTO.ID = javaScriptArray[24].ToString();
                                    oddDTO.Odd = javaScriptArray[25].ToString();
                                    if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[28].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeOverUnder;
                                    oddDTO.ID = javaScriptArray[29].ToString();
                                    oddDTO.Odd = javaScriptArray[30].ToString();
                                    if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfHandicap;
                                    oddDTO.ID = javaScriptArray[37].ToString();
                                    oddDTO.Odd = javaScriptArray[38].ToString();
                                    if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[41].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfOverUnder;
                                    oddDTO.ID = javaScriptArray[42].ToString();
                                    oddDTO.Odd = javaScriptArray[43].ToString();
                                    if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO2.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                }
                            }
                        }
                    }
                }
            }
            return list;
        }
コード例 #11
0
		private TransactionDTO PlaceBet(
            MatchDTO ibetMatch,
            MatchDTO threein1betMatch,
            eOddType oddType,
            string ibetOddID,
            string ibetOddType,
            string ibetOddValue,
            OddDTO threein1Odd,
            string threein1OddType,
            int ibetStake,
            int threein1betStake,
            IBetEngine ibetEngine,
            ThreeIn1BetEngine threein1betEngine)
		{
			TransactionDTO transactionDTO = new TransactionDTO();
            string text = string.Empty;
            string text2 = string.Empty;
            string text3 = string.Empty;
			bool flag = false;
			bool flag2 = false;
			int num = 0;
			int num2 = 0;
            string text4 = string.Empty;
            string text5 = string.Empty;
            string text6 = string.Empty;
			bool flag3 = false;
			bool flag4 = false;
			bool sBOBETReTrade = false;
			int num3 = 0;
            
            string text7 = string.Empty;
            string betCount = string.Empty;
            
            string text8 = string.Empty;
			

            bool threein1betAllowance = false;
            int threein1betminStake = 0;
            int threein1betmaxStake = 0;
            string threein1betKindValue = string.Empty;
            string threein1betHomeTeamName = string.Empty;
            string threein1betAwayTeamName = string.Empty;
            string postBODY = string.Empty;  

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), threein1betMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), threein1betMatch.AwayTeamName.ToLower()))
			{
				try
				{
					ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), out flag, out num, out num2, out text4, out text2, out text3);
                    threein1betEngine.PrepareBet(threein1Odd.ID, threein1Odd.Away.ToString(), threein1Odd.Type.ToString().Replace("FulltimeHandicap", "Hdp").Replace("", ""), "Away", threein1Odd.IsHomeGive.ToString().Replace("True", "1").Replace("False", "0"), threein1Odd.Odd, threein1betMatch.HomeScore, threein1betMatch.AwayScore, threein1betMatch.ID, threein1betMatch.IsHalfTime.ToString().Replace("True", "1").Replace("False", "0"), threein1betStake.ToString(),
                        out threein1betAllowance, out threein1betminStake, out threein1betmaxStake, out threein1betKindValue, out threein1betHomeTeamName, out threein1betAwayTeamName, out postBODY);
                    
                    if (MatchDTO.IsSameMatch(text2, text5, text3, text6))
					{
						if (flag && flag3)
						{
							float num4 = float.Parse(text4);
							float num5 = float.Parse(text7);
							if (num4 + num5 == 0f || num4 == num5)
							{
								if (ibetStake <= num2 && threein1betStake <= num3)
								{
									try
									{
										float currentCredit = ibetEngine.GetCurrentCredit();
                                        float currentCredit2 = threein1betEngine.GetCurrentCredit();
										if ((float)ibetStake <= currentCredit && (float)threein1betStake <= currentCredit2)
										{
											try
											{
												ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), num.ToString(), num2.ToString(), out flag2);
												if (flag2)
												{
                                                    //threeIn1BetEngine.ConfirmBet(oddType,
                                                    //    threein1betOddValue,
                                                    //    threein1betStake.ToString(), 
                                                    //    betCount, 
                                                    //    text8, 
                                                    //    out flag4);
													if (!flag4)
													{
														try
														{
                                                            //
														}
														catch (System.Exception ex)
														{
															text = "Error while Retrade. Details: " + ex.Message;
														}
													}
													this._lastTransactionTime = System.DateTime.Now;
													object obj = text;
													text = string.Concat(new object[]
													{
														obj, 
														" - Success Transaction. Half: ", 
														ibetMatch.Half, 
														" - Minute: ", 
														ibetMatch.Minute, 
														" - Halftime: ", 
														ibetMatch.IsHalfTime
													});
												}
											}
											catch (System.Exception ex)
											{
												text = "Error while Trading. Details: " + ex.Message;
											}
										}
										else
										{
											text = string.Concat(new object[]
											{
												"Out of Cash. IBET Credit: ", 
												currentCredit, 
												" -  3in1BET Credit: ", 
												currentCredit2
											});
										}
									}
									catch (System.Exception ex)
									{
										text = "Error while getting Credit. Details: " + ex.Message;
									}
								}
								else
								{
									text = string.Concat(new object[]
									{
										"Max Bet. IBET: ", 
										num2, 
										" - 3in1BET: ", 
										num3
									});
								}
							}
							else
							{
								text = "Invalid Odd while Preparing Ticket. IBET Odd: " + text4 + " - 3in1BET Odd:" + text7;
							}
						}
					}
					else
					{
						text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							text2, 
							" / ", 
							text3, 
							" - 3in1BET: ", 
							text5, 
							" / ", 
							text6
						});
					}
				}
				catch (System.Exception ex)
				{
					text = "Error while Preparing Trade. Details: " + ex.Message;
				}
			}
			else
			{
				text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - 3in1BET: ", 
					threein1betMatch.HomeTeamName, 
					" / ", 
					threein1betMatch.AwayTeamName
				});
			}
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + " / " + threein1betMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + " / " + threein1betMatch.AwayTeamName;
			transactionDTO.Odd = text4 + " / " + text7;
			transactionDTO.OddKindValue = text4 + " / " + text7;
			transactionDTO.OddValue = ibetOddValue + " / " + threein1Odd.Away;
			transactionDTO.Stake = ibetStake + " / " + threein1betStake;
			transactionDTO.IBETAllow = flag;
			transactionDTO.IBETTrade = flag2;
			transactionDTO.IBETReTrade = false;
			transactionDTO.THREEIN1Allow = flag3;
			transactionDTO.THREEIN1Trade = flag4;
			transactionDTO.THREEIN1ReTrade = sBOBETReTrade;
			transactionDTO.OddType = oddType.ToString();
			transactionDTO.Note = text;
			transactionDTO.DateTime = System.DateTime.Now;
			return transactionDTO;
		}
コード例 #12
0
		private TransactionDTO PlaceBetAllowMaxBet(
            MatchDTO ibetMatch, 
            MatchDTO threein1betMatch, 
            eOddType oddType, 
            string ibetOddID,
            string ibetOddType,             
            string ibetOddValue, 
            OddDTO threein1Odd,
            string threein1OddType,
            int ibetStake, 
            int threein1betStake, 
            IBetEngine ibetEngine, 
            ThreeIn1BetEngine threein1betEngine)
		{
            
			TransactionDTO transactionDTO = new TransactionDTO(); //khoi tao transaction
            string text = string.Empty;			
            bool flagIBETOK = false;
            bool flag3IN1OK = false;
			
			bool threein1ReTrade = false;            
            string betCount = string.Empty;
            
            bool flagibetAllowance = false;
            int ibetminStake = 0;
            int ibetmaxStake = 0;
            string ibetBetKindValue = string.Empty;
            string ibetHomeTeamName = string.Empty;
            string ibetAwayTeamNam = string.Empty;

            bool ibetGoFirst = true;// who is Away or Under
            string threein1OddValue = string.Empty;
            if (threein1OddType == "Away") //neu 3in1 o vi tri away
            {
                threein1OddValue = threein1Odd.Away.ToString();
                if (threein1Odd.Type == eOddType.FirstHalfOverUnder || threein1Odd.Type == eOddType.FulltimeOverUnder) //neu 3in1 la Under
                {
                    ibetGoFirst = false; // cho 3in1 Confirm truoc
                }
                else // bong handicap
                {
                    if (threein1Odd.IsHomeGive) // neu away la doi cua duoi
                    {
                        ibetGoFirst = false;
                    }
                }
            }
            else if (threein1OddType == "Home") // neu 3in1 o vi tri home - ibet away
            {
                threein1OddValue = threein1Odd.Home.ToString();
                if (threein1Odd.Type == eOddType.FirstHalfOverUnder || threein1Odd.Type == eOddType.FulltimeOverUnder) //neu 3in1 la Over
                {
                    ibetGoFirst = true; // cho ibet Confirm truoc (under)
                }
                else // bong handicap
                {
                    if (!threein1Odd.IsHomeGive) // neu 3in1 la doi cua duoi
                    {
                        ibetGoFirst = false;
                    }
                }
            }

            bool flagthreein1betAllowance = false;
            int threein1betminStake = 0;
            int threein1betmaxStake = 0;
            string threein1betKindValue = string.Empty;
            string threein1betHomeTeamName = string.Empty;
            string threein1betAwayTeamName = string.Empty;
            
            string postBODY = string.Empty;            

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), threein1betMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), threein1betMatch.AwayTeamName.ToLower()))
			{
				try
				{
                    ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), 
                        out flagibetAllowance, out ibetminStake, out ibetmaxStake, out ibetBetKindValue, out ibetHomeTeamName, out ibetAwayTeamNam);
                    
                    threein1betEngine.PrepareBet(
                        threein1Odd.ID,
                        threein1OddValue,//odd price
                        threein1Odd.Type.ToString(), 
                        threein1OddType, // "Away"
                        threein1Odd.IsHomeGive.ToString().Replace("True", "1").Replace("False", "0"),
                        threein1Odd.Odd, 
                        threein1betMatch.HomeScore, 
                        threein1betMatch.AwayScore, 
                        threein1betMatch.ID, 
                        threein1betMatch.IsHalfTime.ToString().Replace("True", "1").Replace("False", "0"), 
                        threein1betStake.ToString(),
                        out flagthreein1betAllowance, 
                        out threein1betminStake, 
                        out threein1betmaxStake, 
                        out threein1betKindValue, 
                        out threein1betHomeTeamName, 
                        out threein1betAwayTeamName,
                        out postBODY);
#if DEBUG
                    Utilities.WriteLog.Write("Calling threein1betEngine.PrepareBet");
#endif

                    if (MatchDTO.IsSameMatch(ibetHomeTeamName, threein1betHomeTeamName, ibetAwayTeamNam, threein1betAwayTeamName))
                    {
                        if (flagibetAllowance && flagthreein1betAllowance)
                        {
                            float numIbet = float.Parse(ibetBetKindValue);
                            float num3in1bet = float.Parse(threein1betKindValue);

                            if (numIbet + num3in1bet == 0f || numIbet == num3in1bet)
                            {
#if DEBUG
                                Utilities.WriteLog.Write("+ Valid bet, system is now going to confirm:" + ibetHomeTeamName + " - " + threein1betAwayTeamName);
#endif
                                int numMax = 0; // get minimum of Maximum bet allowed of two system
                                if (ibetmaxStake >= threein1betmaxStake)
                                {
                                    numMax = threein1betmaxStake;                                    
                                }
                                else
                                {
                                    numMax = ibetmaxStake;
                                }

                                if (ibetStake >= numMax) //compare stake with numMax
                                {
                                    ibetStake = numMax;
                                }
                                if (threein1betStake >= numMax)
                                {
                                    threein1betStake = numMax;
                                }

                                try
                                {
                                    float currentCredit = 0;
                                    float currentCredit2 = 0;
                                    if (checkEdit8.Checked)
                                    {
                                        currentCredit = ibetEngine.GetCurrentCredit();
                                        currentCredit2 = threein1betEngine.GetCurrentCredit();
                                    }
                                    else
                                    {
                                        currentCredit = ibetEngine._currentCredit;
                                        currentCredit2 = threein1betEngine._currentCredit;
                                    }
                                    
                                    
                                    if ((float)ibetStake <= currentCredit && (float)threein1betStake <= currentCredit2)
                                    {
                                        if (ibetGoFirst)
                                        {
                                            #region Confirm_IBET_first_then_3in1
#if DEBUG
                                            Utilities.WriteLog.Write("IBET GO FIRST!");
#endif
                                            try
                                            {
                                                ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), ibetminStake.ToString(), ibetmaxStake.ToString(), out flagIBETOK);
                                                if (flagIBETOK)// iBet Confirm thanh cong
                                                {
                                                    string odd3in1NEW = string.Empty;
                                                    threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                    if (!flag3IN1OK)
                                                    {
                                                        try
                                                        {
                                                            if (odd3in1NEW != "changed")
                                                            {
                                                                //threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                                this._lastTransactionTime = System.DateTime.Now;
                                                                playSound(false);
                                                                text = "Odd 3in1 changed";
                                                                this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                                
                                                            }
                                                            else
                                                            {
                                                                text = "Invalid Odd while Retrade.";// IBET Odd: " +text4 + " - SBOBET Odd:" + text7;
                                                                this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                                playSound(false);
                                                            }
                                                        }
                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                            playSound(false);

#if DEBUG
                                                            Utilities.WriteLog.Write(text);
#endif
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.lbl3in1betCurrentCredit.Caption = this._3in1Engine.GetCurrentCredit().ToString();
                                                        this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                        playSound(true);
                                                    }
                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
												    {
													    obj, 
													    " - Success Transaction. Half: ", 
													    ibetMatch.Half, 
													    " - Minute: ", 
													    ibetMatch.Minute, 
													    " - Halftime: ", 
													    ibetMatch.IsHalfTime
												    });                                                    
                                                }
                                            }
                                            catch (System.Exception ex)
                                            {
                                                text = "Error while Trading. Details: " + ex.Message;
#if DEBUG
                                                Utilities.WriteLog.Write(text);
#endif
                                            }
                                            #endregion
                                        }
                                        else
                                        {
                                            #region Confirm_3in1_first_then_IBET
#if DEBUG
                                            Utilities.WriteLog.Write("3IN1BET GO FIRST!");
#endif
                                            try
                                            {
                                                string odd3in1NEW = string.Empty;
                                                threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                if (flag3IN1OK)
                                                {
                                                    ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), ibetminStake.ToString(), ibetmaxStake.ToString(), out flagIBETOK);
                                                    if (!flagIBETOK)// iBet Confirm thanh cong
                                                    {
                                                        try
                                                        {
                                                            playSound(false);
#if DEBUG
                                                            Utilities.WriteLog.Write("iBet confirm failed.");
#endif
                                                        }

                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                            playSound(false);
#if DEBUG
                                                            Utilities.WriteLog.Write(text);
#endif
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.lbl3in1betCurrentCredit.Caption = this._3in1Engine.GetCurrentCredit().ToString();
                                                        this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                        playSound(true);
                                                    }
                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
												    {
													    obj, 
													    " - Success Transaction. Half: ", 
													    ibetMatch.Half, 
													    " - Minute: ", 
													    ibetMatch.Minute, 
													    " - Halftime: ", 
													    ibetMatch.IsHalfTime
												    });
                                                }
                                            }
                                            catch (System.Exception ex)
                                            {
                                                text = "Error while Trading. Details: " + ex.Message;
#if DEBUG
                                                Utilities.WriteLog.Write(text);
#endif
                                            }
                                            #endregion
                                        }
                                    }
                                    else
                                    {
                                        text = string.Concat(new object[]
										{
											"Out of Cash. IBET Credit: ", 
											currentCredit, 
											" -  SBOBET Credit: ", 
											currentCredit2
										});
#if DEBUG
                                        Utilities.WriteLog.Write(text);
#endif
                                    }
                                }
                                catch (System.Exception ex)
                                {
                                    text = "Error while getting Credit. Details: " + ex.Message;
#if DEBUG
                                    Utilities.WriteLog.Write(text);
#endif
                                }



                            }
                            else
                            {
                                text = "Invalid Odd while Preparing Ticket. IBET Odd: " + ibetBetKindValue + " - SBOBET Odd:" + threein1betKindValue;
#if DEBUG
                                Utilities.WriteLog.Write(text);
#endif
                            }
                        }
                        else
                        { 
#if DEBUG
                            if (!flagibetAllowance)
                                Utilities.WriteLog.Write("IBET DIDN'T ALLOW");
                            if (!flagthreein1betAllowance)
                                Utilities.WriteLog.Write("3IN1 DIDN'T ALLOW");
#endif

                        }
                    }

                    else
                    {
                        text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							ibetHomeTeamName, 
							" / ", 
							ibetAwayTeamNam, 
							" - 3in1BET: ", 
							threein1betHomeTeamName, 
							" / ", 
							threein1betAwayTeamName
						});
#if DEBUG
                        Utilities.WriteLog.Write(text);
#endif
                    }

                        
				}
				catch (System.Exception ex)
				{
					text = "Error while Preparing Trade. Details: " + ex.Message;
#if DEBUG
                    WriteLog.Write(" *** " + text);
#endif 
				}
			}
			else
			{
				text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - 3in1BET: ", 
					threein1betMatch.HomeTeamName, 
					" / ", 
					threein1betMatch.AwayTeamName
				});
			}
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + " / " + threein1betMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + " / " + threein1betMatch.AwayTeamName;
            transactionDTO.Odd = ibetBetKindValue + " / " + threein1betKindValue;
			transactionDTO.OddKindValue = ibetBetKindValue + " / " + threein1betKindValue;
            transactionDTO.OddValue = ibetOddValue + " / " + threein1OddValue;
			transactionDTO.Stake = ibetStake + " / " + threein1betStake;
			transactionDTO.IBETAllow = flagibetAllowance;
            transactionDTO.IBETTrade = flagIBETOK;
			transactionDTO.IBETReTrade = false;
            transactionDTO.THREEIN1Allow = flagthreein1betAllowance;
            transactionDTO.THREEIN1Trade = flag3IN1OK;
			transactionDTO.THREEIN1ReTrade = threein1ReTrade;
			transactionDTO.OddType = oddType.ToString();
			transactionDTO.Note = text;
			transactionDTO.DateTime = System.DateTime.Now;
			return transactionDTO;
		}
コード例 #13
0
 private static object GetPropValue(OddDTO odd, string prop)
 {
     PropertyInfo propInfo = o_properties[prop];
     return propInfo.GetGetMethod(false).Invoke(odd, null);
 }
コード例 #14
0
 public static bool Apply(OddDTO odd, string op, string prop, object target)
 {
     return s_operators[op](GetPropValue(odd, prop), target);
 }
コード例 #15
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string rawData)
        {
            System.Collections.Generic.List<MatchDTO> result;
            if (rawData.ToLower() == "od_OnEmpty(0);".ToLower())
            {
                result = new System.Collections.Generic.List<MatchDTO>();
            }
            else
            {
                System.Collections.Generic.List<MatchDTO> list = null;
                try
                {
                    if (rawData == string.Empty)
                    {
                        result = list;
                        return result;
                    }
                    //rawData = rawData.Replace("<script>", "");
                    if (rawData.Contains("$M('odds-display').onUpdate"))
                    {
                        int _num = rawData.IndexOf("$M('odds-display').onUpdate") + 30;
                        int _num2 = rawData.IndexOf(";");
                        rawData = rawData.Substring(_num, _num2 - _num);
                    }
                    //rawData = "";


                    list = new System.Collections.Generic.List<MatchDTO>();

                    JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(rawData);
                    using (System.Collections.Generic.List<object>.Enumerator enumerator = javaScriptArray.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            JavaScriptArray javaScriptArray2 = (JavaScriptArray)enumerator.Current;
                            JavaScriptArray javaScriptArray3 = (JavaScriptArray)javaScriptArray2[1];
                            if (javaScriptArray3 != null)
                            {
                                JavaScriptArray javaScriptArray4 = (JavaScriptArray)javaScriptArray3[0];
                                if (javaScriptArray4 != null)
                                {
                                    MatchDTO matchDTO = new MatchDTO();
                                    matchDTO.ID = javaScriptArray4[0].ToString();
                                    matchDTO.HomeTeamName = javaScriptArray4[1].ToString();
                                    matchDTO.AwayTeamName = javaScriptArray4[2].ToString();
                                    matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();
                                    JavaScriptArray javaScriptArray5 = (JavaScriptArray)javaScriptArray2[0];
                                    if (javaScriptArray5 != null)
                                    {
                                        matchDTO.League = new LeagueDTO();
                                        matchDTO.League.ID = javaScriptArray5[0].ToString();
                                        matchDTO.League.Name = javaScriptArray5[1].ToString();
                                    }
                                    else
                                    {
                                        MatchDTO matchDTO2 = list[list.Count - 1];
                                        matchDTO.League = matchDTO2.League;
                                    }
                                    if (javaScriptArray3.Count >= 2)
                                    {
                                        JavaScriptArray javaScriptArray6 = (JavaScriptArray)javaScriptArray3[2];
                                        if (javaScriptArray6 == null || javaScriptArray6.Count <= 0)
                                        {
                                            matchDTO.IsHalfTime = true;
                                        }
                                        else
                                        {
                                            if (javaScriptArray6.Count >= 5)
                                            {
                                                if (int.Parse(javaScriptArray6[4].ToString()) == 15)
                                                {
                                                    matchDTO.IsHalfTime = true;
                                                }
                                                else
                                                {
                                                    matchDTO.IsHalfTime = false;
                                                    matchDTO.Half = int.Parse(javaScriptArray6[2].ToString());
                                                    matchDTO.Minute = int.Parse(javaScriptArray6[3].ToString());
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        matchDTO.IsHalfTime = true;
                                    }
                                    JavaScriptArray javaScriptArray7 = (JavaScriptArray)javaScriptArray2[2];
                                    if (javaScriptArray7 != null)
                                    {
                                        javaScriptArray7 = (JavaScriptArray)javaScriptArray7[1];
                                        if (javaScriptArray7 != null)
                                        {
                                            using (System.Collections.Generic.List<object>.Enumerator enumerator2 = javaScriptArray7.GetEnumerator())
                                            {
                                                while (enumerator2.MoveNext())
                                                {
                                                    JavaScriptArray javaScriptArray8 = (JavaScriptArray)enumerator2.Current;
                                                    OddDTO oddDTO = new OddDTO();
                                                    if (javaScriptArray8.Count > 3)
                                                    {
                                                        int num = int.Parse(javaScriptArray8[0].ToString());
                                                        switch (num)
                                                        {
                                                            case 1:
                                                                {
                                                                    oddDTO.Type = eOddType.FulltimeHandicap;
                                                                    oddDTO.ID = javaScriptArray8[1].ToString();
                                                                    float num2;
                                                                    if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Home = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Home = 0f;
                                                                    }
                                                                    if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Away = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Away = 0f;
                                                                    }
                                                                    oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                    if (javaScriptArray8[5] != null)
                                                                    {
                                                                        if (javaScriptArray8[5].ToString() == "1")
                                                                        {
                                                                            oddDTO.HomeFavor = true;
                                                                            oddDTO.AwayFavor = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            if (javaScriptArray8[5].ToString() == "2")
                                                                            {
                                                                                oddDTO.HomeFavor = false;
                                                                                oddDTO.AwayFavor = true;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.HomeFavor = false;
                                                                                oddDTO.AwayFavor = false;
                                                                            }
                                                                        }
                                                                    }
                                                                    break;
                                                                }
                                                            case 2:
                                                                {
                                                                    break;
                                                                }
                                                            case 3:
                                                                {
                                                                    oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                    oddDTO.ID = javaScriptArray8[1].ToString();
                                                                    float num2;
                                                                    if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Home = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Home = 0f;
                                                                    }
                                                                    if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Away = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Away = 0f;
                                                                    }
                                                                    oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                    break;
                                                                }
                                                            default:
                                                                {
                                                                    switch (num)
                                                                    {
                                                                        case 7:
                                                                            {
                                                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                                float num2;
                                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Home = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Home = 0f;
                                                                                }
                                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Away = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Away = 0f;
                                                                                }
                                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                                if (javaScriptArray8[5] != null)
                                                                                {
                                                                                    if (javaScriptArray8[5].ToString() == "1")
                                                                                    {
                                                                                        oddDTO.HomeFavor = true;
                                                                                        oddDTO.AwayFavor = false;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        if (javaScriptArray8[5].ToString() == "2")
                                                                                        {
                                                                                            oddDTO.HomeFavor = false;
                                                                                            oddDTO.AwayFavor = true;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            oddDTO.HomeFavor = false;
                                                                                            oddDTO.AwayFavor = false;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                break;
                                                                            }
                                                                        case 9:
                                                                            {
                                                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                                float num2;
                                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Home = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Home = 0f;
                                                                                }
                                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Away = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Away = 0f;
                                                                                }
                                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                                break;
                                                                            }
                                                                    }
                                                                    break;
                                                                }
                                                        }
                                                        if (oddDTO.Home != 0f)
                                                            matchDTO.Odds.Add(oddDTO);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    list.Add(matchDTO);
                                }
                            }
                            else
                            {
                                MatchDTO matchDTO = list[list.Count - 1];
                                JavaScriptArray javaScriptArray7 = (JavaScriptArray)javaScriptArray2[2];
                                if (javaScriptArray7 != null)
                                {
                                    javaScriptArray7 = (JavaScriptArray)javaScriptArray7[1];
                                    if (javaScriptArray7 != null)
                                    {
                                        using (System.Collections.Generic.List<object>.Enumerator enumerator2 = javaScriptArray7.GetEnumerator())
                                        {
                                            while (enumerator2.MoveNext())
                                            {
                                                JavaScriptArray javaScriptArray8 = (JavaScriptArray)enumerator2.Current;
                                                OddDTO oddDTO = new OddDTO();
                                                if (javaScriptArray8.Count > 3)
                                                {
                                                    int num = int.Parse(javaScriptArray8[0].ToString());
                                                    switch (num)
                                                    {
                                                        case 1:
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeHandicap;
                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                float num2;
                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                {
                                                                    oddDTO.Home = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Home = 0f;
                                                                }
                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                {
                                                                    oddDTO.Away = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                if (javaScriptArray8[5] != null)
                                                                {
                                                                    if (javaScriptArray8[5].ToString() == "1")
                                                                    {
                                                                        oddDTO.HomeFavor = true;
                                                                        oddDTO.AwayFavor = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (javaScriptArray8[5].ToString() == "2")
                                                                        {
                                                                            oddDTO.HomeFavor = false;
                                                                            oddDTO.AwayFavor = true;
                                                                        }
                                                                        else
                                                                        {
                                                                            oddDTO.HomeFavor = false;
                                                                            oddDTO.AwayFavor = false;
                                                                        }
                                                                    }
                                                                }
                                                                break;
                                                            }
                                                        case 2:
                                                            {
                                                                break;
                                                            }
                                                        case 3:
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                float num2;
                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                {
                                                                    oddDTO.Home = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Home = 0f;
                                                                }
                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                {
                                                                    oddDTO.Away = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                break;
                                                            }
                                                        default:
                                                            {
                                                                switch (num)
                                                                {
                                                                    case 7:
                                                                        {
                                                                            oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                            oddDTO.ID = javaScriptArray8[1].ToString();
                                                                            float num2;
                                                                            if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Home = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Home = 0f;
                                                                            }
                                                                            if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Away = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Away = 0f;
                                                                            }
                                                                            oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                            if (javaScriptArray8[5] != null)
                                                                            {
                                                                                if (javaScriptArray8[5].ToString() == "1")
                                                                                {
                                                                                    oddDTO.HomeFavor = true;
                                                                                    oddDTO.AwayFavor = false;
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (javaScriptArray8[5].ToString() == "2")
                                                                                    {
                                                                                        oddDTO.HomeFavor = false;
                                                                                        oddDTO.AwayFavor = true;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        oddDTO.HomeFavor = false;
                                                                                        oddDTO.AwayFavor = false;
                                                                                    }
                                                                                }
                                                                            }
                                                                            break;
                                                                        }
                                                                    case 9:
                                                                        {
                                                                            oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                            oddDTO.ID = javaScriptArray8[1].ToString();
                                                                            float num2;
                                                                            if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Home = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Home = 0f;
                                                                            }
                                                                            if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Away = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Away = 0f;
                                                                            }
                                                                            oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                            break;
                                                                        }
                                                                }
                                                                break;
                                                            }
                                                    }
                                                    if (oddDTO.Home != 0f)
                                                        matchDTO.Odds.Add(oddDTO);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    throw ex;
                }
                result = list;
            }
            return result;
        }
コード例 #16
0
        private System.Collections.Generic.List<MatchDTO> updateToDicNew()
        {
            //this.dicMatches.Clear();
            System.Collections.Generic.List<MatchDTO> result = new List<MatchDTO>();

            foreach (ArrayList current in this._eventResultDictionary.Values)
            {
                ArrayList arrayList = this._eventDictionary[current[1].ToString()];
                MatchDTO sboMatch = new MatchDTO();
                sboMatch.ID = arrayList[0].ToString();
                LeagueDTO league = new LeagueDTO();
                league.ID = arrayList[2].ToString();
                league.Name = this._tournamentDictionary[league.ID][1].ToString();
                sboMatch.League = league;
                sboMatch.HomeTeamName = arrayList[3].ToString();
                sboMatch.AwayTeamName = arrayList[4].ToString();
                result.Add(sboMatch);                
            }
            foreach (ArrayList current2 in this._oddsDictionary.Values)
            {
                string id = current2[0].ToString();
                if (current2[1].GetType().Equals(typeof(ArrayList)))
                {
                    ArrayList arrayList2 = (ArrayList)current2[1];
                    if (current2[2].GetType().Equals(typeof(ArrayList)))
                    {
                        ArrayList arrayList3 = (ArrayList)current2[2];
                        if (this._eventResultDictionary.ContainsKey(arrayList2[0].ToString()))
                        {
                            string text = this._eventResultDictionary[arrayList2[0].ToString()][1].ToString();
                            OddDTO sboOdd = new OddDTO();
                            sboOdd.ID = arrayList2[0].ToString();

                            eOddType type = this.reCal2(arrayList2[1].ToString());

                            sboOdd.Type = type;
                            
                            string text2 = this.reCal(arrayList2[1].ToString());
                                                                                    
                            if ("8731".Contains(text2))                            
                            {
                                sboOdd.Odd = arrayList2[4].ToString();
                                //sboOdd.hdp = decimal.Parse(arrayList2[4].ToString());
                                if ("71".Contains(text2))
                                {
                                    //sboOdd.hdp = -sboOdd.hdp;
                                    sboOdd.HomeFavor = true;
                                    sboOdd.IsHomeGive = true;
                                }
                                sboOdd.Home = float.Parse(arrayList3[0].ToString());
                                sboOdd.Away = float.Parse(arrayList3[1].ToString());
                                foreach (MatchDTO m in result)
                                {
                                    if (m.ID == id)
                                    {
                                        m.Odds.Add(sboOdd);
                                    }
                                }                                
                            }
                        }
                    }
                }
            }
            return result;
        }
コード例 #17
0
        public static System.Collections.Generic.List<MatchDTO> ConvertUpdateData(
            string data,
            System.Collections.Generic.List<MatchDTO> originalDataSource,
            out string updateTime)
        {
            System.Collections.Generic.List<MatchDTO> list = BaseDTO.DeepClone<System.Collections.Generic.List<MatchDTO>>(originalDataSource);
            updateTime = string.Empty;
            data = data.Replace("\n", "");
            string[] array = data.Split(new string[]
			{
				";"
			}, System.StringSplitOptions.None);
            MatchDTO matchDTO = null;
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (text.Contains("var Dell"))
                {
                    JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
					{
						"="
					}, System.StringSplitOptions.None)[2]);
                    foreach (object current in javaScriptArray)
                    {
                        MatchDTO matchDTO2 = MatchDTO.SearchMatch(current.ToString(), list);
                        if (matchDTO2 != null)
                        {
                            list.Remove(matchDTO2);
                        }
                    }
                }
                else
                {
                    if (text.StartsWith("Insl"))
                    {
                        JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
						{
							"="
						}, System.StringSplitOptions.None)[1]);
                        if (javaScriptArray[3].ToString() == "1")
                        {
                            MatchDTO matchDTO3 = new MatchDTO();
                            matchDTO3.Odds = new System.Collections.Generic.List<OddDTO>();
                            matchDTO3.ID = javaScriptArray[0].ToString();
                            if (javaScriptArray[4].ToString() == string.Empty)
                            {
                                matchDTO3.League = matchDTO.League;
                            }
                            else
                            {
                                matchDTO3.League = new LeagueDTO();
                                matchDTO3.League.ID = javaScriptArray[4].ToString();
                                matchDTO3.League.Name = javaScriptArray[5].ToString();
                            }
                            matchDTO3.HomeTeamName = javaScriptArray[6].ToString();
                            matchDTO3.AwayTeamName = javaScriptArray[7].ToString();
                            if (javaScriptArray.Count >= 12)
                            {
                                if (javaScriptArray[12] != null && javaScriptArray[12].ToString() != string.Empty && !javaScriptArray[12].ToString().ToLower().Contains("t") && !javaScriptArray[12].ToString().ToLower().Contains("live"))
                                {
                                    string[] array3 = javaScriptArray[12].ToString().ToLower().Split(new string[]
									{
										"h"
									}, System.StringSplitOptions.None);
                                    matchDTO3.Half = int.Parse(array3[0]);
                                    matchDTO3.Minute = int.Parse(array3[1].Trim().Replace("'", ""));
                                    matchDTO3.IsHalfTime = false;
                                }
                                else
                                {
                                    matchDTO3.Minute = 0;
                                    matchDTO3.Half = 0;
                                    matchDTO3.IsHalfTime = true;
                                }
                            }
                            else
                            {
                                matchDTO3.Minute = 0;
                                matchDTO3.Half = 0;
                                matchDTO3.IsHalfTime = true;
                            }
                            float num = 0f;
                            if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeHandicap;
                                oddDTO.ID = javaScriptArray[24].ToString();
                                oddDTO.Odd = javaScriptArray[25].ToString();
                                if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[28].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                oddDTO.ID = javaScriptArray[29].ToString();
                                oddDTO.Odd = javaScriptArray[30].ToString();
                                if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                oddDTO.ID = javaScriptArray[37].ToString();
                                oddDTO.Odd = javaScriptArray[38].ToString();
                                if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[41].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                oddDTO.ID = javaScriptArray[42].ToString();
                                oddDTO.Odd = javaScriptArray[43].ToString();
                                if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            list.Add(matchDTO3);
                            matchDTO = matchDTO3;
                        }
                        else
                        {
                            float num = 0f;
                            if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeHandicap;
                                oddDTO.ID = javaScriptArray[24].ToString();
                                oddDTO.Odd = javaScriptArray[25].ToString();
                                if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[28].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                oddDTO.ID = javaScriptArray[29].ToString();
                                oddDTO.Odd = javaScriptArray[30].ToString();
                                if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                oddDTO.ID = javaScriptArray[37].ToString();
                                oddDTO.Odd = javaScriptArray[38].ToString();
                                if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[41].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                oddDTO.ID = javaScriptArray[42].ToString();
                                oddDTO.Odd = javaScriptArray[43].ToString();
                                if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                        }
                    }
                    if (text.StartsWith("uLl"))
                    {
                        JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
						{
							"="
						}, System.StringSplitOptions.None)[1]);
                        MatchDTO matchDTO4 = MatchDTO.SearchMatch(javaScriptArray[0].ToString(), list);
                        if (matchDTO4 != null)
                        {
                            string text2 = javaScriptArray[1].ToString().Replace("'", "").Replace(" ", "").ToLower();
                            if (text2.Contains("t") || text2.Contains("live"))
                            {
                                matchDTO4.Half = 0;
                                matchDTO4.Minute = 0;
                                matchDTO4.IsHalfTime = true;
                            }
                            else
                            {
                                matchDTO4.IsHalfTime = false;
                                matchDTO4.Half = int.Parse(text2.Split(new string[]
								{
									"h"
								}, System.StringSplitOptions.None)[0]);
                                matchDTO4.Minute = int.Parse(text2.Split(new string[]
								{
									"h"
								}, System.StringSplitOptions.None)[1]);
                            }
                        }
                    }
                    else
                    {
                        if (text.StartsWith("uOl"))
                        {
                            JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
							{
								"="
							}, System.StringSplitOptions.None)[1]);
                            MatchDTO matchDTO4 = MatchDTO.SearchMatch(javaScriptArray[0].ToString(), list);
                            if (matchDTO4 != null)
                            {
                                OddDTO oddDTO2 = OddDTO.SearchOdd(javaScriptArray[2].ToString(), matchDTO4.Odds);
                                if (oddDTO2 != null)
                                {
                                    matchDTO4.Odds.Remove(oddDTO2);
                                }
                                if (javaScriptArray[3].ToString() != string.Empty && javaScriptArray[4].ToString() != string.Empty && javaScriptArray[5].ToString() != string.Empty)
                                {
                                    string text3 = javaScriptArray[1].ToString();
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.ID = javaScriptArray[2].ToString();
                                    oddDTO.Odd = javaScriptArray[3].ToString();
                                    oddDTO.Home = float.Parse(javaScriptArray[4].ToString());
                                    oddDTO.Away = float.Parse(javaScriptArray[5].ToString());
                                    if (javaScriptArray.Count >= 7)
                                    {
                                        if (javaScriptArray[6].ToString().ToLower() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[6].ToString().ToLower() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                        }
                                    }
                                    string text4 = text3;
                                    if (text4 == null)
                                    {
                                        goto IL_1134;
                                    }
                                    if (!(text4 == "1"))
                                    {
                                        if (!(text4 == "3"))
                                        {
                                            if (!(text4 == "7"))
                                            {
                                                if (!(text4 == "8"))
                                                {
                                                    goto IL_1134;
                                                }
                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                            }
                                            else
                                            {
                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                            }
                                        }
                                        else
                                        {
                                            oddDTO.Type = eOddType.FulltimeOverUnder;
                                        }
                                    }
                                    else
                                    {
                                        oddDTO.Type = eOddType.FulltimeHandicap;
                                    }
                                IL_113F:
                                    if (oddDTO.Type != eOddType.Unknown)
                                    {
                                        matchDTO4.Odds.Add(oddDTO);
                                    }
                                    goto IL_115F;
                                IL_1134:
                                    oddDTO.Type = eOddType.Unknown;
                                    goto IL_113F;
                                }
                            IL_115F: ;
                            }
                        }
                        else
                        {
                            if (text.StartsWith("window"))
                            {
                                updateTime = text.Substring(43, 19);
                            }
                        }
                    }
                }
            }
            return list;
        }