Exemplo n.º 1
0
        public static void ChallengeAccepted(string sender, string receiver)
        {
            GlobalItems.OngoingMatches.Add(new LiveMatch(sender, receiver));

            int a = GlobalItems.OngoingMatches.Count;

            for (int i = 0; i < a; i++)
            {
                LiveMatch alpha = GlobalItems.OngoingMatches[i];

                if (alpha != null)
                {
                    var abc = alpha.Sender;
                }
            }

            for (var i = 0; i < GlobalItems.Requests.Count; i++)
            {
                GameRequests item   = GlobalItems.Requests[i];
                var          sentBy = item.SenderName;
                var          sentTo = item.ReceiverName;
                if (sentTo != null && sentBy != null)
                {
                    if (sentTo == receiver && sentBy == sender)
                    {
                        GlobalItems.Requests.RemoveAt(i);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void UpdateSnapshots(String matchId)
        {
            IReadOnlyCollection <DomainEvent> events = _eventRepository.GetEventStreamFor(matchId);

            CommandStack.Match matchInfo = EventHelper.PlayEvents(matchId, events.ToList());

            var lm = (from m in _dbContext.Matches where m.Id == matchId select m).FirstOrDefault();

            if (lm == null)
            {
                var liveMatch = new LiveMatch
                {
                    Id            = matchId,
                    Team1         = matchInfo.Team1,
                    Team2         = matchInfo.Team2,
                    State         = (QueryStack.MatchState)matchInfo.State,
                    IsBallInPlay  = matchInfo.IsBallInPlay,
                    TotalGoals1   = matchInfo.CurrentScore.TotalGoals1,
                    TotalGoals2   = matchInfo.CurrentScore.TotalGoals2,
                    CurrentPeriod = matchInfo.CurrentPeriod,
                    TimeInPeriod  = 0
                };
                _dbContext.Matches.Add(liveMatch);
            }
            else
            {
                lm.State         = (QueryStack.MatchState)matchInfo.State;
                lm.IsBallInPlay  = matchInfo.IsBallInPlay;
                lm.TotalGoals1   = matchInfo.CurrentScore.TotalGoals1;
                lm.TotalGoals2   = matchInfo.CurrentScore.TotalGoals2;
                lm.CurrentPeriod = matchInfo.CurrentPeriod;
                lm.TimeInPeriod  = 0;
            }
            _dbContext.SaveChanges();
        }
Exemplo n.º 3
0
        public async Task <LiveMatch> GetLiveMatch(string url)
        {
            var doc = await LoadHtmlDocAsync(url);

            if (doc == null)
            {
                return(null);
            }

            var match      = new LiveMatch();
            var streamInfo = doc.SelectSingleNode("//div[@class='content']/div[@class='row-news']//div[@class='stream-info']");

            if (streamInfo == null)
            {
                return(null);
            }
            // champion
            match.Champion     = streamInfo.SelectSingleNode("./div[@class='shortInfo']").InnerText();
            match.DateTime     = streamInfo.SelectSingleNode(".//span[@class='time-by-timezone']").InnerText();
            match.OriginServer = doc.SelectSingleNode("//div[@class='content']//div[@class='news-articles']/div[@id='zone-match-livetv-stream']/iframe").AttributeValue("src", string.Empty);

            // stream info
            match.TeamA.TeamName = streamInfo.SelectSingleNode("./div[@class='competeTeams']/span[contains(@class,'teamA') and contains(@class, 'tright')]").InnerText();
            match.TeamB.TeamName = streamInfo.SelectSingleNode("./div[@class='competeTeams']/span[contains(@class,'teamA') and contains(@class, 'tleft')]").InnerText();
            match.TeamA.Score    = streamInfo.SelectSingleNode(".//span[@class='score-teamA']").InnerText();
            match.TeamB.Score    = streamInfo.SelectSingleNode(".//span[@class='score-teamB']").InnerText();
            match.TeamA.TeamFlag = streamInfo.SelectSingleNode("./span[@class='bageTeamA']/img").AttributeValue("src", string.Empty);
            match.TeamB.TeamFlag = streamInfo.SelectSingleNode("./span[@class='bageTeamB']/img").AttributeValue("src", string.Empty);

            // server
            var arrServers = doc.SelectNodes("//div[@class='content']//div[@id='zone-other-livetv']/a");

            if (arrServers != null && arrServers.Count > 0)
            {
                var count = arrServers.Count;
                for (int i = 0; i < count; i++)
                {
                    var a      = arrServers[i];
                    var server = new LiveServer();
                    server.Id = a.GetAttributeValue("data-pid", string.Empty);
                    if (string.IsNullOrEmpty(server.Id))
                    {
                        // try get by title if data-pid cannot get value
                        server.Id = a.GetAttributeValue("title", string.Empty);
                    }
                    // a.SelectSingleNode("")

                    server.Text = a.InnerText;
                    if (string.IsNullOrEmpty(server.Text) == false)
                    {
                        server.Text = server.Text.Replace("&nbsp;", string.Empty);
                    }
                    server.Flags = a.SelectSingleNode("./span").AttributeValue("class", string.Empty);

                    match.Servers.Add(server);
                }
            }

            return(match);
        }
Exemplo n.º 4
0
        private void UpdateSnapshots(String matchId)
        {
            var repo      = new EventRepository();
            var events    = repo.GetEventStreamFor(matchId);
            var matchInfo = EventHelper.PlayEvents(matchId, events.ToList());

            using (var db = new WaterpoloContext())
            {
                var lm = (from m in db.Matches where m.Id == matchId select m).FirstOrDefault();
                if (lm == null)
                {
                    var liveMatch = new LiveMatch
                    {
                        Id            = matchId,
                        Team1         = matchInfo.Team1,
                        Team2         = matchInfo.Team2,
                        State         = matchInfo.State,
                        IsBallInPlay  = matchInfo.IsBallInPlay,
                        CurrentScore  = matchInfo.CurrentScore,
                        CurrentPeriod = matchInfo.CurrentPeriod,
                        TimeInPeriod  = 0
                    };
                    db.Matches.Add(liveMatch);
                }
                else
                {
                    lm.State         = matchInfo.State;
                    lm.IsBallInPlay  = matchInfo.IsBallInPlay;
                    lm.CurrentScore  = matchInfo.CurrentScore;
                    lm.CurrentPeriod = matchInfo.CurrentPeriod;
                    lm.TimeInPeriod  = 0;
                }
                db.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public static void AddMove(string username, string idPassed)
        {
            for (int i = 0; i < GlobalItems.OngoingMatches.Count; i++)
            {
                LiveMatch temp          = GlobalItems.OngoingMatches[i];
                string    gameId        = temp.GameId;
                int       buttonClicked = 0;
                if (gameId.Contains(username))
                {
                    //current = temp.CurrentMove;
                    if (idPassed == "one")
                    {
                        buttonClicked = 1;
                    }
                    else if (idPassed == "two")
                    {
                        buttonClicked = 2;
                    }
                    else if (idPassed == "three")
                    {
                        buttonClicked = 3;
                    }
                    else if (idPassed == "four")
                    {
                        buttonClicked = 4;
                    }
                    else if (idPassed == "five")
                    {
                        buttonClicked = 5;
                    }
                    else if (idPassed == "six")
                    {
                        buttonClicked = 6;
                    }
                    else if (idPassed == "seven")
                    {
                        buttonClicked = 7;
                    }
                    else if (idPassed == "eight")
                    {
                        buttonClicked = 8;
                    }
                    else if (idPassed == "nine")
                    {
                        buttonClicked = 9;
                    }

                    temp.ButtonStatus.Add(buttonClicked);

                    int a = temp.ButtonStatus.Count;
                }
            }
        }
        private void RequestAccepted(LiveMatch match)
        {
            GameBoardWindow gameBoardWindow = new GameBoardWindow();

            gameBoardWindow.Mode       = GameMode.Mode.Online;
            gameBoardWindow.Match      = match;
            gameBoardWindow.GameParams = match.GameParams;
            gameBoardWindow.Client     = Client;
            gameBoardWindow.UserName   = UserName;
            gameBoardWindow.Type       = PlayerType.Home;
            gameBoardWindow.CallBack   = CallBack;
            this.Close();
            gameBoardWindow.Show();
        }
Exemplo n.º 7
0
        private bool isScoreRight(LiveMatch match)
        {
            var    score         = _chromeDriver.FindElement(By.ClassName("iuGgIl")).FindElements(By.TagName("span"));
            string homeGoalsText = score[0].Text;
            string awayGoalsText = score[1].Text;

            int.TryParse(awayGoalsText, out int awayGoals);
            int.TryParse(homeGoalsText, out int homeGoals);

            match.AwayGoals = awayGoals;
            match.HomeGoals = homeGoals;

            return(awayGoals == 0 || homeGoals == 0);
        }
Exemplo n.º 8
0
        public static List <Int32> GetButtonsStatus(string username)
        {
            List <int> buttonsStatus = new List <int>();

            for (int i = 0; i < GlobalItems.OngoingMatches.Count; i++)
            {
                LiveMatch temp   = GlobalItems.OngoingMatches[i];
                string    gameId = temp.GameId;
                if (gameId.Contains(username))
                {
                    buttonsStatus = temp.ButtonStatus;
                }
            }

            return(buttonsStatus);
        }
        private void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Client.AcceptInvitation(SenderName, Username, GameParams);
            }
            catch (FaultException <UserFaultException> ex)
            {
                MessageBox.Show(ex.Detail.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            LiveMatch       match           = Client.GetSameGridAsOpponent(SenderName, Username);
            GameBoardWindow gameBoardWindow = new GameBoardWindow();

            gameBoardWindow.Mode       = GameMode.Mode.Online;
            gameBoardWindow.Match      = match;
            gameBoardWindow.GameParams = match.GameParams;
            gameBoardWindow.Client     = Client;
            gameBoardWindow.UserName   = Username;
            gameBoardWindow.CallBack   = CallBack;
            gameBoardWindow.Type       = PlayerType.Away;
            this.Close();
            gameBoardWindow.Show();
        }
Exemplo n.º 10
0
        public static string GetCurrentChance(string username)
        {
            string current = "";
            string playerX = "";
            string player0 = "";

            List <int> list = new List <int>();

            for (int i = 0; i < GlobalItems.OngoingMatches.Count; i++)
            {
                LiveMatch temp   = GlobalItems.OngoingMatches[i];
                string    gameId = temp.GameId;
                if (gameId.Contains(username))
                {
                    //current = temp.CurrentMove;
                    playerX = temp.Sender;
                    player0 = temp.Receiver;

                    list = temp.ButtonStatus;
                    if (list.Count == 0)
                    {
                        current = "X";
                    }
                    else if (list.Count % 2 == 0)
                    {
                        current = "X";
                    }
                    else
                    {
                        current = "0";
                    }
                }
            }
            return(JsonConvert.SerializeObject(new { PlayerX = playerX, Player0 = player0, Current = current }));

            ;
        }
Exemplo n.º 11
0
        public void SearchMatch()
        {
            string SummonerName  = "";
            string Region        = "";
            int    MenuListCount = 0;

            TextBoxSummonerName.Invoke(new MethodInvoker(delegate { SummonerName = TextBoxSummonerName.Text; }));
            regionsComboBox.Invoke(new MethodInvoker(delegate { Region = regionsComboBox.Text; }));
            VersionClass ver = GetVersion.ReturnVersion(Region, apiKey);

            version = ver.n.champion;
            this.Invoke((MethodInvoker) delegate
            {
                MenuListCount = MenuControls.Count;
            });

            try
            {
                for (int a = 0; a < MenuListCount; a++)
                {
                    SetControlPropertyThreadSafe(MenuControls[a], "Enabled", false);
                }
                SummonerInfo summonerInfo = GetSummoner.ReturnSummoner(SummonerName, Region, apiKey);
                MatchInfo = MatchSearch.GetMatch(Region, summonerInfo.id, apiKey);
                string[] Keys  = MatchSearch.GetKeys(JSON, MatchInfo);
                string[] Names = MatchSearch.GetName(JSON, MatchInfo);

                SetControlPropertyThreadSafe(Summoner1, "Text", MatchInfo.participants[0].summonerName);
                SetControlPropertyThreadSafe(Summoner2, "Text", MatchInfo.participants[1].summonerName);
                SetControlPropertyThreadSafe(Summoner3, "Text", MatchInfo.participants[2].summonerName);
                SetControlPropertyThreadSafe(Summoner4, "Text", MatchInfo.participants[3].summonerName);
                SetControlPropertyThreadSafe(Summoner5, "Text", MatchInfo.participants[4].summonerName);
                SetControlPropertyThreadSafe(Summoner6, "Text", MatchInfo.participants[5].summonerName);
                SetControlPropertyThreadSafe(Summoner7, "Text", MatchInfo.participants[6].summonerName);
                SetControlPropertyThreadSafe(Summoner8, "Text", MatchInfo.participants[7].summonerName);
                SetControlPropertyThreadSafe(Summoner9, "Text", MatchInfo.participants[8].summonerName);
                SetControlPropertyThreadSafe(Summoner10, "Text", MatchInfo.participants[9].summonerName);


                PictureBox[] pb = new PictureBox[10] {
                    TeamMatePictureBox0, TeamMatePictureBox1, TeamMatePictureBox2, TeamMatePictureBox3, TeamMatePictureBox4, TeamMatePictureBox5, TeamMatePictureBox6, TeamMatePictureBox7, TeamMatePictureBox8, TeamMatePictureBox9
                };

                for (int i = 0; i < 10; i++)
                {
                    pb[i].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + Keys[i] + ".png");
                    this.Invoke((MethodInvoker) delegate
                    {
                        LoLToolTip.SetToolTip(pb[i], Names[i]);
                    });
                }
                if (MatchInfo.gameQueueConfigId == 4 || MatchInfo.gameQueueConfigId == 6 || MatchInfo.gameQueueConfigId == 9 || MatchInfo.gameQueueConfigId == 41 || MatchInfo.gameQueueConfigId == 42)
                {
                    PictureBox[] pbBans = new PictureBox[6] {
                        banPB1, banPB2, banPB3, banPB4, banPB5, banPB6
                    };
                    for (int i = 10; i < Keys.Length; i++)
                    {
                        pbBans[i - 10].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + Keys[i] + ".png");
                        this.Invoke((MethodInvoker) delegate
                        {
                            LoLToolTip.SetToolTip(pbBans[i - 10], Names[i]);
                        });
                    }
                }
                PictureBox[] summonerSpell_1 = new PictureBox[10] {
                    Summoner1Spell1, Summoner2Spell1, Summoner3Spell1, Summoner4Spell1, Summoner5Spell1, Summoner6Spell1, Summoner7Spell1, Summoner8Spell1, Summoner9Spell1, Summoner10Spell1
                };
                PictureBox[] summonerSpell_2 = new PictureBox[10] {
                    Summoner1Spell2, Summoner2Spell2, Summoner3Spell2, Summoner4Spell2, Summoner5Spell2, Summoner6Spell2, Summoner7Spell2, Summoner8Spell2, Summoner9Spell2, Summoner10Spell2
                };

                List <Spells> summonerSpell = SummonerSpells.GetSpells(Region, apiKey);

                int      x      = 0;
                string[] SummID = new string[10];
                foreach (Participant part in MatchInfo.participants)
                {
                    SummID[x] = part.summonerId.ToString();
                    foreach (var item in summonerSpell)
                    {
                        if (item.Id == part.spell1Id)
                        {
                            summonerSpell_1[x].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + item.Key + ".png");

                            this.Invoke((MethodInvoker) delegate
                            {
                                LoLToolTip.SetToolTip(summonerSpell_1[x], item.Name);
                            });
                        }
                        if (item.Id == part.spell2Id)
                        {
                            summonerSpell_2[x].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + item.Key + ".png");
                            this.Invoke((MethodInvoker) delegate
                            {
                                LoLToolTip.SetToolTip(summonerSpell_2[x], item.Name);
                            });
                        }
                    }
                    x++;
                }


                PictureBox[] DivisionsPB = new PictureBox[10] {
                    divPb1, divPB2, divPB3, divPB4, divPB5, divPB6, divPB7, divPB8, divPB9, divPB10
                };
                Label[] divLabels = new Label[10] {
                    DivString1, DivString2, DivString3, DivString4, DivString5, DivString6, DivString7, DivString8, DivString9, DivString10
                };

                ReturnDivision divisionsImages = ReturnDivisionInfo.GetDivisions(Region, apiKey, SummID);



                for (int i = 0; i < divisionsImages.divList.Count(); i++)
                {
                    SetControlPropertyThreadSafe(divLabels[i], "Text", divisionsImages.divList[i].Division);
                    SetControlPropertyThreadSafe(DivisionsPB[i], "Image", divisionsImages.image[i]);

                    this.Invoke((MethodInvoker) delegate
                    {
                        LoLToolTip.SetToolTip((Control)DivisionsPB[i], divisionsImages.divList[i].Name);
                    });
                }



                //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
                SetControlPropertyThreadSafe(LoadCircle, "Visible", false);
                for (int a = 0; a < MenuListCount; a++)
                {
                    SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true);
                }
                this.Invoke((MethodInvoker) delegate
                {
                    basicPage.Hide();
                    FIVEvsFIVEpanel.Show();
                    FIVEvsFIVEpanel.BringToFront();
                });
            }
            catch (WebException ex)
            {
                MessageBox.Show(ex.ToString());
                if (ex.Status == WebExceptionStatus.ProtocolError)
                {
                    var response = (HttpWebResponse)ex.Response;
                    if (response.StatusCode == HttpStatusCode.NotFound)
                    {
                        SetControlPropertyThreadSafe(MessageLabel, "Visible", true);
                        SetControlPropertyThreadSafe(MessageLabel, "Text", "The summoner " + SummonerName + " is not currently in a game!");

                        this.Invoke((MethodInvoker) delegate
                        {
                            emptyTextBoxControlTimer.Enabled = true;
                        });

                        SetControlPropertyThreadSafe(LoadCircle, "Visible", false);
                        for (int a = 0; a < MenuListCount; a++)
                        {
                            SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true);
                        }
                    }
                }
                for (int a = 0; a < MenuListCount; a++)
                {
                    SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true);
                }
                SetControlPropertyThreadSafe(LoadCircle, "Visible", false);
            }
        }
Exemplo n.º 12
0
 public void AcceptSenderInvitation(LiveMatch match)
 {
     acceptInvitation(match);
 }
Exemplo n.º 13
0
        /// <summary>
        /// Updates the Db
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        private bool TryUpdateGame(Game game)
        {
            // return true;
            // check  whether To save this game the db or not
            var matchInList = isMatchAlreadySavedToDb(game.MatchNo);

            if (matchInList.IsAlreadysaved)
            {
                if (game != null)
                {
                    saveLiveGameResults(game);
                }
                return(true);
            }

            //Todo: update the records in the DB
            #region trySaveMatchesToDb
            LiveMatch liveMatchToSave;
            // List<LiveMatches> liveMatchesList=new List<LiveMatches>();
            Match match;

            // List<Match> matches=new List<Match>();
            // foreach (var game in allGames)
            // {
            try
            {
                Country country;
                int     _HomeTeamId = 0;
                int     _AwayTeamId = 0;
                int     _countryId  = 0;
                var     league      = BetDatabase.Leagues.SingleOrDefault(c => c.LeagueName == game.League);
                if (league != null)
                {
                    country = BetDatabase.Countries.SingleOrDefault(c => c.CountryId == league.CountryId);

                    if (country == null)
                    {
                        country = new Country
                        {
                            CountryName = "Unknown"
                        };
                        BetDatabase.Countries.AddOrUpdate(c => c.CountryName, country);
                        BetDatabase.SaveChanges();
                    }
                    _countryId = country.CountryId;
                }
                else
                {
                    country = BetDatabase.Countries.SingleOrDefault(c => c.CountryName == "Unknown");

                    if (country == null)
                    {
                        country = new Country
                        {
                            CountryName = "Unknown"
                        };
                        BetDatabase.Countries.AddOrUpdate(c => c.CountryName, country);
                        BetDatabase.SaveChanges();
                    }
                    _countryId = country.CountryId;
                    BetDatabase.Leagues.AddOrUpdate(l => l.LeagueName, new League
                    {
                        LeagueName = game.League,
                        CountryId  = _countryId,
                    });
                    BetDatabase.SaveChanges();
                }

                Team _homeTeam;
                if (game.LocalTeam != null)
                {
                    _homeTeam = new Team
                    {
                        TeamName  = game.LocalTeam,
                        CountryId = _countryId
                    };
                    BetDatabase.Teams.AddOrUpdate(t => t.TeamName, _homeTeam);
                    BetDatabase.SaveChanges();
                    _HomeTeamId = _homeTeam.TeamId;
                }

                Team _awayTeam;
                if (game.AwayTeam != null)
                {
                    _awayTeam = new Team
                    {
                        TeamName  = game.AwayTeam,
                        CountryId = _countryId
                    };
                    BetDatabase.Teams.AddOrUpdate(t => t.TeamName, _awayTeam);
                    BetDatabase.SaveChanges();
                    _AwayTeamId = _awayTeam.TeamId;
                }
                match = new Match
                {
                    StartTime         = getFormattedStartDate(game.StartDateToSave, game.StartTime),
                    AwayTeamId        = _AwayTeamId,
                    HomeTeamId        = _HomeTeamId,
                    BetServiceMatchNo = game.ShortCode,
                    //ShortMatchCode = new ShortMatchCode(),// Convert.ToInt32(game.ShortCode),
                    League           = game.League,
                    RegistrationDate = DateTime.Now,
                    ResultStatus     = 0,
                    GameStatus       = double.Parse(formatMinutes(game.Minutes)) > 0 ? "Started" : "Not Started",
                };

                // matches.Add(match);
                liveMatchToSave = new LiveMatch
                {
                    LiveMatchNo       = game.MatchNo,
                    BetServiceMatchNo = game.ShortCode,
                    DailyShortCode    = game.DailyShortCode,
                    SetDate           = DateTime.Now.Date.ToString()
                };
                // liveMatchesList.Add(liveMatchToSave);
                //we could have used AddOrUpdate btu since we always check if match already exits in memory,its useless, unless need be later

                #endregion
                // matches.ForEach(m => BetDatabase.Matches.Add(m));
                try
                {
                    BetDatabase.Matches.AddOrUpdate(match);
                    BetDatabase.SaveChanges();

                    BetDatabase.LiveMatches.AddOrUpdate(liveMatchToSave);
                    BetDatabase.SaveChanges();
                    saveLiveGameResults(game);
                }
                catch (Exception ex)
                {
                    matchInList.IsAlreadysaved = false;
                    return(false);
                }

                //save the live macthes MatchNo int the LiveMatches table



                // }
                ////_games.Clear();
                //_games.TryAdd(game.MatchNo, game);
                //update the matchcode list if save is successfull
                matchInList.IsAlreadysaved = true;
                return(true);
            }
            catch (Exception ex)
            {
                //update the matchcode list if save is successfull
                matchInList.IsAlreadysaved = false;
                return(false);
            }

            //if youve got this far, dont broadcast the match
            return(false);
        }
Exemplo n.º 14
0
        private async Task GetMatch(IWebElement element, List <LiveMatch> matches)
        {
            try
            {
                Task.Run(() => element.Click()).Wait();
                var    teamNames    = element.FindElements(By.ClassName("kCvfzg"));
                string homeTeamName = teamNames[0].Text;
                string awayTeamName = teamNames[1].Text;

                Thread.Sleep(300);

                var    timeSpan  = _chromeDriver.FindElement(By.ClassName("cLKHcg"));
                string timeLines = timeSpan.Text.Substring(0, 2);
                var    match     = new LiveMatch();

                isScoreRight(match);
                if (int.TryParse(timeLines, out int time))
                {
                    //if (time >= 60 && time <= 75 && isScoreRight())
                    //{
                    var statistic = _chromeDriver.FindElement(By.XPath("//a[normalize-space() = 'Statistics']"));
                    if (statistic != null)
                    {
                        Task.Run(() => statistic.Click()).Wait();
                        Thread.Sleep(300);


                        var allStatistic = _chromeDriver.FindElements(By.ClassName("StatisticsStyles__StatisticsItemCell-zf4n59-2"));
                        match.AwayTeamName = awayTeamName;
                        match.HomeTeamName = homeTeamName;
                        // match.AwayTeam = new LiveTeam { Name = awayTeamName };iuGgIl
                        // match.HomeTeam = new LiveTeam { Name = homeTeamName };

                        foreach (var item in allStatistic)
                        {
                            try
                            {
                                string homeTeamValue        = string.Empty;
                                string statisticItemName    = string.Empty;
                                string awayTeamValue        = string.Empty;
                                var    threeStatisticBlocks = item.FindElements(By.ClassName("Section-sc-1a7xrsb-0"));
                                homeTeamValue     = threeStatisticBlocks[0].FindElement(By.TagName("div")).Text;
                                statisticItemName = threeStatisticBlocks[1].FindElement(By.TagName("div")).Text;
                                awayTeamValue     = threeStatisticBlocks[2].FindElement(By.TagName("div")).Text;

                                match.Statistics.Add(new LiveStatistic {
                                    StatisticName = statisticItemName, HomeTeamValue = homeTeamValue, AwayTeamValue = awayTeamValue
                                });
                                //   match.Statistics.Add(new LiveStatistic { Name = statisticItemName, Value = awayTeamValue });
                            }
                            catch (Exception e)
                            {
                            }
                        }
                        matches.Add(match);
                    }
                    //}
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 15
0
 private bool isAwayTeamMadeEnough(LiveMatch match)
 {
 }