Exemple #1
0
        public static SportEvent Parse(dynamic dynamicXml)
        {
            if (dynamicXml == null)
            {
                return(null);
            }

            var builder = new SportEvent
            {
                Competitors     = Team.ParseList(dynamicXml.Competitors?.GetCompetitorList()),
                Id              = dynamicXml.Id,
                Liveodds        = dynamicXml.Liveodds,
                Name            = dynamicXml.Name,
                Parent          = ParentStage.Parse(dynamicXml.Parent),
                Races           = SportEventChild.ParseList(dynamicXml.Races?.GetSportEventList()),
                Scheduled       = dynamicXml.Scheduled <DateTimeOffset?>(),
                ScheduledEnd    = dynamicXml.ScheduledEnd <DateTimeOffset?>(),
                Season          = Responses.Season.Parse(dynamicXml.Season),
                Status          = dynamicXml.Status,
                Tournament      = Responses.Tournament.Parse(dynamicXml.Tournament),
                TournamentRound = MatchRound.Parse(dynamicXml.TournamentRound),
                Type            = dynamicXml.Type
            };

            return(builder);
        }
Exemple #2
0
        public static ParentStage Parse(dynamic dynamicXml)
        {
            if (dynamicXml == null)
            {
                return(null);
            }

            var builder = new ParentStage
            {
                Id           = dynamicXml.Id,
                Name         = dynamicXml.Name,
                Scheduled    = dynamicXml.Scheduled <DateTimeOffset?>(),
                ScheduledEnd = dynamicXml.ScheduledEnd <DateTimeOffset?>(),
                Type         = dynamicXml.Type
            };

            return(builder);
        }
Exemple #3
0
        public static Fixture Parse(dynamic dynamicXml)
        {
            if (dynamicXml == null)
            {
                return(null);
            }

            var builder = new Fixture
            {
                Competitors        = Team.ParseList(dynamicXml.Competitors?.GetCompetitorList()),
                CoverageInfo       = Responses.CoverageInfo.Parse(dynamicXml.CoverageInfo),
                DelayedInfo        = Responses.DelayedInfo.Parse(dynamicXml.DelayedInfo),
                ExtraInfo          = ParseExtraInfo(dynamicXml.ExtraInfo),
                Id                 = dynamicXml.Id,
                Liveodds           = dynamicXml.Liveodds,
                Name               = dynamicXml.Name,
                NextLiveTime       = dynamicXml.NextLiveTime <DateTimeOffset?>(),
                Parent             = ParentStage.Parse(dynamicXml.Parent),
                ProductInfo        = Responses.ProductInfo.Parse(dynamicXml.ProductInfo),
                Races              = SportEventChild.ParseList(dynamicXml.Races?.GetSportEventList()),
                ReferenceIds       = Responses.ReferenceIds.Parse(dynamicXml.ReferenceIds),
                Scheduled          = dynamicXml.Scheduled <DateTimeOffset?>(),
                ScheduledEnd       = dynamicXml.ScheduledEnd <DateTimeOffset?>(),
                Season             = Responses.Season.Parse(dynamicXml.Season),
                StartTime          = dynamicXml.StartTime <DateTimeOffset>(),
                StartTimeConfirmed = dynamicXml.StartTimeConfirmed <bool?>(),
                Status             = dynamicXml.Status,
                Tournament         = Responses.Tournament.Parse(dynamicXml.Tournament),
                TournamentRound    = MatchRound.Parse(dynamicXml.TournamentRound),
                TvChannels         = TvChannel.ParseList(dynamicXml.TvChannels?.GetTvChannelList()),
                Type               = dynamicXml.Type,
                Venue              = Responses.Venue.Parse(dynamicXml.Venue)
            };

            return(builder);

            Dictionary <string, string> ParseExtraInfo(dynamic extraInfo)
            {
                return(extraInfo == null
                     ? new Dictionary <string, string>()
                     : ((IEnumerable <dynamic>)extraInfo.GetInfoList()).ToDictionary(x => (string)x.Key, x => (string)x.Value));
            }
        }