示例#1
0
        public override void ParseMatchPageHtml(HtmlDocument doc, string url)
        {
            Sport sport = GetSport(doc);

            if (sport == Sport.NotSupported)
            {
                return;
            }

            MatchName matchName = GetFullMatchName(doc); // повне ім'я (only for tennis cuz all event names were  writed like (Coppejans K.)  )

            if (matchName == null)
            {
                return;
            }
            string BetUrl = url;

            HtmlNodeCollection betsNodes = doc.DocumentNode.SelectNodes("//td");

            Bet result = null;

            if (betsNodes == null)
            {
                return;
            }
            foreach (var node in betsNodes)
            {
                result = null;
                //if (node.Attributes["data-market-type"] != null) continue;
                HtmlAttribute attribute = node.Attributes["data-sel"];
                if (attribute == null)
                {
                    continue;
                }
                string value = attribute.Value.Replace("\"", string.Empty).Replace(""", string.Empty);

                JavaSelectCode =
                    "(function() { var element = document.evaluate( '" + node.XPath + "' ,document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;  element.click(); })();";


                string coeff = value.Split(new string[] { ",epr:", ",prices:{" }, StringSplitOptions.RemoveEmptyEntries)[1];

                double Probability = Convert.ToDouble(coeff.Replace(".", ","));
                string type        = value.Split(new string[] { "sn:", ",mn:" }, StringSplitOptions.RemoveEmptyEntries)[1];

                string TotalorHand = value.Split(new string[] { "mn:", ",ewc:" }, StringSplitOptions.RemoveEmptyEntries)[1];
                if (TotalorHand.Contains(" + "))
                {
                    continue;
                }
                if (TotalorHand.ToLower().Contains("min."))
                {
                    continue;
                }
                Team team = GetTeam(TotalorHand, matchName);
                Time time = GetTime(TotalorHand);
                #region main bets
                if (TotalorHand.Contains("Match Result") || TotalorHand == "Result" || TotalorHand.Contains("Match Winner Including All OT") || (TotalorHand.Contains("Result") && TotalorHand.Contains("Set")) || TotalorHand.Contains("Normal Time Result") || TotalorHand.Contains("To Win Match") && !TotalorHand.Contains("Handicap"))
                {
                    if (TotalorHand.Contains("Match Winner Including All OT"))
                    {
                        if (type == matchName.FirstTeam)
                        {
                            if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                            {
                                result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        else
                        if (type == matchName.SecondTeam)
                        {
                            if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                            {
                                result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                    }
                    if (TotalorHand.Contains("To Win Match"))
                    {
                        if (type == matchName.FirstTeam)
                        {
                            if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                            {
                                result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        else
                        if (type == matchName.SecondTeam)
                        {
                            if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                            {
                                result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                    }
                    if (type == matchName.FirstTeam + " To Win")
                    {
                        if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                        {
                            result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                        else
                        {
                            result = new ResultBet(ResultBetType.First, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                    }
                    else
                    if (type == "Draw")
                    {
                        result = new ResultBet(ResultBetType.Draw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                    else
                    if (type == matchName.SecondTeam + " To Win")
                    {
                        if (node.Attributes["data-market-type"] != null && node.Attributes["data-market-type"].Value == "RESULT_2WAY")
                        {
                            result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                        else
                        {
                            result = new ResultBet(ResultBetType.Second, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                    }
                    else
                    if (type == matchName.FirstTeam + " To Win or Draw")
                    {
                        result = new ResultBet(ResultBetType.FirstOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                    else
                    if (type == matchName.FirstTeam + " To Win or " + matchName.SecondTeam + " To Win")
                    {
                        result = new ResultBet(ResultBetType.FirstOrSecond, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                    else
                    if (type == matchName.SecondTeam + " To Win or Draw")
                    {
                        result = new ResultBet(ResultBetType.SecondOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                }
                #endregion
                else
                #region Totals for All Team
                // Totals
                if (TotalorHand.Contains("Total") && !TotalorHand.Contains("Sets") && !TotalorHand.Contains("Innings"))
                {
                    if (type.Contains("Under"))
                    {
                        if (TotalorHand.Contains("Asian"))
                        {
                            try
                            {
                                double first_param  = Convert.ToDouble(type.Split(new string[] { "Under ", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));
                                double second_param = Convert.ToDouble(type.Split(new string[] { "Under ", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                double param = (first_param + second_param) / 2;
                                result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            catch { }
                        }
                        else
                        {
                            try
                            {
                                double param = Convert.ToDouble(type.Split(new string[] { "Under ", "\0" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));

                                result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            catch { }
                        }
                    }
                    if (type.Contains("Over"))
                    {
                        if (TotalorHand.Contains("Asian"))
                        {
                            try
                            {
                                double first_param  = Convert.ToDouble(type.Split(new string[] { "Over ", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));
                                double second_param = Convert.ToDouble(type.Split(new string[] { "Over ", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                double param = (first_param + second_param) / 2;
                                result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            catch { }
                        }
                        else
                        {
                            try
                            {
                                double param = Convert.ToDouble(type.Split(new string[] { "Over ", "\0" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));

                                result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            catch { }
                        }
                    }
                }
                #endregion
                else
                #region All Handicaps
                if (TotalorHand.Contains("Handicap") || TotalorHand.Contains("Draw No Bet"))     // переробити. draw no bet = 0 все інше нормально. з ханд робити
                {
                    if (type.Contains(matchName.FirstTeam))
                    {
                        double param = 0;
                        string test;
                        if (TotalorHand.Contains("Draw No Bet"))
                        {
                            param = 0;
                        }
                        else
                        {
                            if (TotalorHand.Contains("Asian"))
                            {
                                try
                                {
                                    double first_param  = Convert.ToDouble(type.Split(new string[] { matchName.FirstTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));
                                    double second_param = Convert.ToDouble(type.Split(new string[] { matchName.FirstTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                    param = (first_param + second_param) / 2;
                                }
                                catch { }
                            }
                            else
                            {
                                try
                                {
                                    test  = type.Split(new string[] { matchName.FirstTeam + " (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",");
                                    param = Convert.ToDouble(test);
                                }
                                catch
                                {
                                    continue;
                                }
                            }
                        }

                        result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                    if (type.Contains(matchName.SecondTeam))
                    {
                        double param = 0;
                        string test;
                        if (TotalorHand.Contains("Draw No Bet"))
                        {
                            param = 0;
                        }
                        else
                        {
                            if (TotalorHand.Contains("Asian"))
                            {
                                try
                                {
                                    double first_param  = Convert.ToDouble(type.Split(new string[] { matchName.SecondTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));
                                    double second_param = Convert.ToDouble(type.Split(new string[] { matchName.SecondTeam + " (", ")", "," }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                    param = (first_param + second_param) / 2;
                                }
                                catch { }
                            }
                            else
                            {
                                try
                                {
                                    test  = type.Split(new string[] { matchName.SecondTeam + " (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ",");
                                    param = Convert.ToDouble(test);
                                }
                                catch
                                {
                                    continue;
                                }
                            }
                        }
                        result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                    }
                }
                #endregion

                if (result != null)
                {
                    int index = BetList.IndexOf(result);
                    if (index != -1)
                    {
                        BetList[index].ChangeOdds(result.Odds);
                    }
                    else
                    {
                        BetList.Add(result);
                    }
                }
            }

            System.Threading.Thread.Sleep(50);
        }
示例#2
0
        /*
         * private void ParseMatch(ChromiumWebBrowser browser)
         * {
         *  if (!browser.IsBrowserInitialized || browser.IsLoading)
         *      return;
         *
         *  var task = browser.GetSourceAsync();
         *  task.Wait(2000);
         *  if (!task.IsCompleted) return;
         *  string html = task.Result;
         *
         *  HtmlDocument doc = new HtmlDocument();
         *  doc.LoadHtml(html);
         *
         *  ParseMatchPageHtml(doc, browser.Address);
         * }*/

        public override void ParseMatchPageHtml(HtmlDocument doc, string url)
        {
            MatchName matchName = GetFullMatchName(doc);

            if (matchName == null)
            {
                return;
            }
            Sport sport = GetSport(doc);

            if (sport == Sport.NotSupported)
            {
                return;
            }

            string BetUrl = url;

            Bet result = null;

            HtmlNodeCollection maindocument = doc.DocumentNode.SelectNodes("//li[@class='groupedListItem']");

            if (maindocument == null)
            {
                return;
            }

            foreach (var node in maindocument)
            {
                result = null;
                try
                {
                    string all_main = node.InnerHtml;

                    HtmlDocument document = new HtmlDocument();
                    document.LoadHtml(all_main);

                    string             Way       = document.DocumentNode.SelectNodes("//table[@class]").First().Attributes["class"].Value;
                    string             maintype  = document.DocumentNode.SelectNodes("//h3").First().InnerText;
                    HtmlNodeCollection betsNodes = document.DocumentNode.SelectNodes("//a[@id]");

                    Team team = GetTeam(maintype);
                    Time time = GetTime(maintype);// зробити час
                    foreach (var node2 in betsNodes)
                    {
                        string value = node2.InnerHtml;
                        if (!value.Contains("class=\"oddHolder\""))
                        {
                            continue;
                        }
                        HtmlDocument document2 = new HtmlDocument();
                        document2.LoadHtml(value);
                        HtmlNodeCollection test = document2.DocumentNode.SelectNodes("//div");

                        HtmlAttribute idAttribude = node.Attributes["id"];
                        if (idAttribude == null)
                        {
                            continue;
                        }
                        JavaSelectCode = "(function() { var element = document.evaluate( '" + node2.XPath + "' ,document, null, XPathResult.ANY_TYPE, null ).singleNodeValue;  element.click(); })();";

                        string type  = test.First().InnerText;
                        string coeff = test.Last().InnerText;

                        double Probability = Convert.ToDouble(coeff.Replace(".", ","));
                        if (maintype.Contains("1X2"))
                        {
                            if (Way == "list cell2")
                            {
                                if (type == "1")
                                {
                                    result = new ResultBet(ResultBetType.P1, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }

                                if (type == "2")
                                {
                                    result = new ResultBet(ResultBetType.P2, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }
                            }
                            if (Way == "list cell3")
                            {
                                if (type == "1")
                                {
                                    result = new ResultBet(ResultBetType.First, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }
                                if (type == "x" || type == "X")
                                {
                                    result = new ResultBet(ResultBetType.Draw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }
                                if (type == "2")
                                {
                                    result = new ResultBet(ResultBetType.Second, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }
                            }
                        }
                        if (maintype.Contains("Double Chance") || maintype.Contains("Double chance"))// за весь час чи нормальний час брати? Inc All OT
                        {
                            if (type == "1x" || type == "1X")
                            {
                                result = new ResultBet(ResultBetType.FirstOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (type == "12")
                            {
                                result = new ResultBet(ResultBetType.FirstOrSecond, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (type == "x2" || type == "X2")
                            {
                                result = new ResultBet(ResultBetType.SecondOrDraw, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        // importantly!!!!
                        // You have to see it.
                        if ((maintype.Contains("Total") || maintype.Contains("total")) && (!maintype.Contains("aggregated") && !maintype.Contains("Totals")))
                        {
                            if (sport == Sport.Basketball &&
                                (!maintype.Contains("including overtime") && !maintype.Contains("Including overtime") && !maintype.Contains("including Overtime")))
                            {
                                continue;
                            }
                            // перевірити правильність написання including overtime(регістр)

                            if (type.Contains("Under"))
                            {
                                try
                                {
                                    double param = Convert.ToDouble(type.Split(new string[] { "Under (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));

                                    result = new TotalBet(TotalBetType.Under, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                                }
                                catch { }
                            }
                            if (type.Contains("Over"))
                            {
                                double param = Convert.ToDouble(type.Split(new string[] { "Over (", ")" }, StringSplitOptions.RemoveEmptyEntries)[0].Replace(".", ","));

                                result = new TotalBet(TotalBetType.Over, param, time, team, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        if ((maintype.Contains("Handicap") || maintype.Contains("handicap")) && maintype.Contains("Asian"))
                        {
                            if (sport == Sport.Basketball &&
                                (!maintype.Contains("inc. ОТ") && !maintype.Contains("Inc. OT") && !maintype.Contains("INC. OT") && !maintype.Contains("including overtime")))
                            {
                                continue;
                            }

                            // перевірити правильність написання including overtime(регістр)
                            string first_or_second_team = type.Split(new string[] { " (" }, StringSplitOptions.RemoveEmptyEntries)[0];
                            if (first_or_second_team == "1")
                            {
                                double param = Convert.ToDouble(type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (first_or_second_team == "2")
                            {
                                double param = Convert.ToDouble(type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace(".", ","));

                                result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        else
                        if (maintype.Contains("Handicap") && !maintype.Contains("Asian"))
                        {
                            // коли буде матч переглянути як тут пишуть INC.OT.

                            string first_or_second_team = type.Split(new string[] { " (" }, StringSplitOptions.RemoveEmptyEntries)[0];
                            if (first_or_second_team == "1")
                            {
                                string initial_score = type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1];
                                int    first_number  = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0]);
                                int    second_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1]);
                                double param         = 0;
                                if (first_number != 0)
                                {
                                    param = first_number - 0.5;
                                }
                                if (second_number != 0)
                                {
                                    param = (-1) * (second_number) - 0.5;
                                }
                                result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            else
                            if (first_or_second_team == "2")
                            {
                                string initial_score = type.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries)[1];
                                int    first_number  = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0]);
                                int    second_number = Convert.ToInt32(initial_score.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1]);
                                double param         = 0;
                                if (first_number != 0)
                                {
                                    param = (-1) * first_number - 0.5;
                                }
                                if (second_number != 0)
                                {
                                    param = second_number - 0.5;
                                }
                                result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                        else
                        if (maintype.Contains("Draw No Bet"))
                        {
                            if (sport == Sport.Basketball &&
                                (!maintype.Contains("inc. ОТ") && !maintype.Contains("Inc. OT") && !maintype.Contains("INC. OT") && !maintype.Contains("including overtime")))
                            {
                                continue;
                            }

                            double param = 0;
                            if (type.Contains("1"))
                            {
                                result = new HandicapBet(HandicapBetType.F1, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            else
                            if (type.Contains("2"))
                            {
                                result = new HandicapBet(HandicapBetType.F2, param, time, Probability, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }

                        if (result != null)
                        {
                            int index = BetList.IndexOf(result);
                            if (index != -1)
                            {
                                BetList[index].ChangeOdds(result.Odds);
                            }
                            else
                            {
                                BetList.Add(result);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.Write(e.Message);
                }
            }
            System.Threading.Thread.Sleep(50);
        }
示例#3
0
        public override void ParseMatchPageHtml(HtmlDocument doc, string url)
        {
            MatchName matchName = GetMatchName(doc);

            if (matchName == null)
            {
                return;
            }
            Sport sport = GetSport(doc);

            if (sport == Sport.NotSupported)
            {
                return;
            }


            string BetUrl = url;
            Bet    result = null;

            HtmlNodeCollection maindocument = doc.DocumentNode.SelectNodes("//span[@class='bet_sel koefs']");

            if (maindocument == null)
            {
                return;
            }
            foreach (var node in maindocument)
            {
                result = null;
                try
                {
                    string[]           betParams  = node.Attributes["data-select"].Value.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
                    HtmlNodeCollection coeffNodes = node.SelectNodes(".//b");
                    if (coeffNodes == null)
                    {
                        continue;
                    }

                    string coeff = coeffNodes.First().InnerText;
                    double odds  = Convert.ToDouble(coeff.Replace(".", ","));
                    Time   time  = GetTime(betParams);
                    if (time == null)
                    {
                        continue;
                    }

                    JavaSelectCode =
                        "(function() { var elements = Array.from(document.getElementsByClassName('bet_sel koefs')); elements.forEach(function(item, i, arr) {" +
                        "if(item.getAttribute('data-select') == '" + node.Attributes["data-select"].Value + "') item.click(); }); })();";

                    if (betParams[1] == "1")                                                                             // 1, X, 2, 1X, 12, x2
                    {
                        if (betParams[2] == "1" || betParams[2] == "10" || betParams[2] == "13" || betParams[2] == "16") // 1, X, 2
                        {
                            if (betParams[4] == "1")
                            {
                                result = new ResultBet(ResultBetType.First, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (betParams[4] == "2")
                            {
                                result = new ResultBet(ResultBetType.Draw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (betParams[4] == "3")
                            {
                                result = new ResultBet(ResultBetType.Second, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }

                        if (betParams[2] == "2" || betParams[2] == "9" || betParams[2] == "22") // 1, 2 all game
                        {
                            if (betParams[4] == "1")
                            {
                                result = new ResultBet(ResultBetType.P1, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (betParams[4] == "2")
                            {
                                result = new ResultBet(ResultBetType.P2, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }

                        if (betParams[2] == "3") // 1x, 12, x2 all game
                        {
                            if (betParams[4] == "1")
                            {
                                result = new ResultBet(ResultBetType.FirstOrDraw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (betParams[4] == "2")
                            {
                                result = new ResultBet(ResultBetType.FirstOrSecond, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                            if (betParams[4] == "3")
                            {
                                result = new ResultBet(ResultBetType.SecondOrDraw, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                            }
                        }
                    }

                    if (betParams[1] == "2") // handicap, under
                    {
                        double param = Convert.ToDouble(betParams[3].Replace(".", ","));

                        if (betParams[2] == "4" || betParams[2] == "168" || betParams[2] == "11" || betParams[2] == "14" || betParams[2] == "17") // f1/f2
                        {
                            HandicapBetType type = betParams[4] == "1" ? HandicapBetType.F1 : HandicapBetType.F2;
                            result = new HandicapBet(type, param, time, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }

                        if (betParams[2] == "5" || betParams[2] == "12" || betParams[2] == "15" || betParams[2] == "18") // under
                        {
                            result = new TotalBet(TotalBetType.Under, param, time, Team.All, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }

                        if (betParams[2] == "7") //first team
                        {
                            result = new TotalBet(TotalBetType.Under, param, time, Team.First, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }

                        if (betParams[2] == "8") //second team
                        {
                            result = new TotalBet(TotalBetType.Under, param, time, Team.Second, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                    }

                    if (betParams[1] == "3") // over
                    {
                        double param = Convert.ToDouble(betParams[3].Replace(".", ","));

                        if (betParams[2] == "5" || betParams[2] == "12" || betParams[2] == "15" || betParams[2] == "18") // over
                        {
                            result = new TotalBet(TotalBetType.Over, param, time, Team.All, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }

                        if (betParams[2] == "7") //first team
                        {
                            result = new TotalBet(TotalBetType.Over, param, time, Team.First, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }

                        if (betParams[2] == "8") //second team
                        {
                            result = new TotalBet(TotalBetType.Over, param, time, Team.Second, odds, matchName, BetUrl, JavaSelectCode, sport, Maker);
                        }
                    }

                    if (result != null)
                    {
                        int index = BetList.IndexOf(result);
                        if (index != -1)
                        {
                            BetList[index].ChangeOdds(result.Odds);
                        }
                        else
                        {
                            BetList.Add(result);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.Write(e.Message);
                }
            }
            System.Threading.Thread.Sleep(50);
        }