Example #1
0
        public CSoccerGameUpdate ParseBasicGameDetails(HtmlNode node, DateTime date)
        {
            var game = new CSoccerGameUpdate();

            game.HomeTeam.Name = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-a ']/a/.", "title");
            game.AwayTeam.Name = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-b ']/a/.", "title");

            var rawGameStartTime = ParseFunctions.ExtractValueFromNode(node, "//td[@class='score-time status']");
            var rawScore         = ParseFunctions.ExtractValueFromNode(node, "//td[@class='score-time score']");
            var rawStatusMinute  = ParseFunctions.ExtractValueFromNode(node, "//td[@class='minute visible']");

            if (!string.IsNullOrEmpty(rawScore))
            {
                var scores = ParseScore(rawScore);
                game.HomeTeam.Competitor.Scores[(int)ESoccerStages.CurrResult] = scores[0];
                game.AwayTeam.Competitor.Scores[(int)ESoccerStages.CurrResult] = scores[1];
            }

            if (!string.IsNullOrEmpty(rawGameStartTime))
            {
                var time = ParseFunctions.ParseTime(rawGameStartTime);
                game.StartTime = date.Date.Add(time).Subtract(DataFetcher.TimeOffset);
            }
            else
            {
                game.StartTime = date.Date.AddHours(16);
            }

            return(game);
        }
        private List <CompetitorData> ParseBasicGameDetails(HtmlNode node, DateTime date)
        {
            List <CompetitorData> game = null;

            try
            {
                var home = new CompetitorData();
                var away = new CompetitorData();

                home.Name = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-a ']/a/.", "title");
                away.Name = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-b ']/a/.", "title");

                home.Link = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-a ']/a/.", "href");
                away.Link = ParseFunctions.ExtractValueFromNode(node, "//td[@class='team team-b ']/a/.", "href");

                home.Id = ParseFunctions.ParsePositiveNumber(home.Link, "/(?<num>\\d{2,})");
                away.Id = ParseFunctions.ParsePositiveNumber(away.Link, "/(?<num>\\d{2,})");

                var rawGameStartTime = ParseFunctions.ExtractValueFromNode(node, "//td[@class='score-time status']");
                var rawScore         = ParseFunctions.ExtractValueFromNode(node, "//td[@class='score-time score']");

                if (!string.IsNullOrEmpty(rawGameStartTime))
                {
                    var time        = ParseFunctions.ParseTime(rawGameStartTime);
                    var gameTime    = date.Date.Add(time).Subtract(DataFetcher.TimeOffset);
                    var scanContext = new ScanContext(gameTime);
                    home.NextScan = scanContext;
                    away.NextScan = scanContext;
                }
                else
                {
                    var gameTime    = date.Date.AddHours(16);
                    var scanContext = new ScanContext(gameTime);
                    home.NextScan = scanContext;
                    away.NextScan = scanContext;
                }

                game = new List <CompetitorData>()
                {
                    home, away
                };
            }
            catch (Exception exception)
            {
            }

            return(game);
        }