Пример #1
0
        public static OddsChangeEventStatus Parse(dynamic dynamicXml)
        {
            if (dynamicXml == null)
            {
                return(null);
            }

            var builder = new OddsChangeEventStatus
            {
                Claims           = ParseClaims(),
                Clock            = OddsChangeClock.Parse(dynamicXml.Clock),
                MatchStatus      = dynamicXml.MatchStatus <int>(),
                PeriodScores     = OddsChangePeriodScore.ParseList(dynamicXml.PeriodScores?.GetPeriodScoreList()),
                Results          = OddsChangeResult.ParseList(dynamicXml.Results?.GetResultList()),
                Statistics       = OddsChangeStatistics.Parse(dynamicXml.Statistics),
                Status           = dynamicXml.Status <GameEventStatus>(),
                AwayScore        = dynamicXml.AwayScore <double?>(),
                HomeScore        = dynamicXml.HomeScore <double?>(),
                AwayGameScore    = dynamicXml.AwayGamescore <double?>(),
                HomeGameScore    = dynamicXml.HomeGamescore <double?>(),
                AwayPenaltyScore = dynamicXml.AwayPenaltyScore <double?>(),
                HomePenaltyScore = dynamicXml.HomePenaltyScore <double?>(),
                CurrentServer    = dynamicXml.CurrentServer <byte?>(),
            };

            return(builder);

            Dictionary <string, string> ParseClaims()
            {
                return(((IDictionary <string, string>)dynamicXml.GetAttributes())
                       .Where(x => x.Key != "status" && x.Key != "match_status")
                       .ToDictionary(k => k.Key, v => v.Value));
            }
        }
        public static OddsChangeClock Parse(dynamic dynamicXml)
        {
            if (dynamicXml == null)
            {
                return(null);
            }

            var builder = new OddsChangeClock
            {
                MatchTime             = dynamicXml.MatchTime,
                StoppageTime          = dynamicXml.StoppageTime,
                StoppageTimeAnnounced = dynamicXml.StoppageTimeAnnounced,
                RemainingTime         = dynamicXml.RemainingTime,
                RemainingTimeInPeriod = dynamicXml.RemainingTimeInPeriod,
                Stopped = dynamicXml.Stopped <bool?>()
            };

            return(builder);
        }