コード例 #1
0
        // todo remove once all code uses new XSD classes
        protected T GetGameInfo <T>(Uri sportRadarUri) where T : class
        {
            string gameInfoXmlString = ReadResponseFromUri(sportRadarUri);

            StringReader stringReader = new StringReader(gameInfoXmlString);
            T            gameInfoXml  = (T)GameInfoXmlSerializer.Deserialize(stringReader);

            return(gameInfoXml);
        }
コード例 #2
0
ファイル: RadarNfl.cs プロジェクト: reashore/ConcurrentGames
        public NflGameInfo GetGameSummary(Guid gameId)
        {
            // the SportRadar game boxscore and game summary use the same schema and base URL
            Uri          gameSummaryUri    = GetGameSummaryUri(gameId);
            string       gameSummaryString = ReadResponseFromUri(gameSummaryUri);
            StringReader stringReader      = new StringReader(gameSummaryString);

            if (GameInfoXmlSerializer == null)
            {
                GameInfoXmlSerializer = new XmlSerializer(typeof(NflGameInfo));
            }

            NflGameInfo nflGameSummary = (NflGameInfo)GameInfoXmlSerializer.Deserialize(stringReader);

            return(nflGameSummary);
        }
コード例 #3
0
ファイル: RadarNhl.cs プロジェクト: reashore/ConcurrentGames
        public NhlGameInfo GetGameSummary(Guid gameId)
        {
            try
            {
                // the SportRadar game boxscore and game summary use the same schema and base URL
                Uri          gameSummaryUri    = GetGameSummaryUri(gameId);
                string       gameSummaryString = ReadResponseFromUri(gameSummaryUri);
                StringReader stringReader      = new StringReader(gameSummaryString);

                if (GameInfoXmlSerializer == null)
                {
                    GameInfoXmlSerializer = new XmlSerializer(typeof(NhlGameInfo));
                }

                NhlGameInfo nhlNhlGameInfo = (NhlGameInfo)GameInfoXmlSerializer.Deserialize(stringReader);
                return(nhlNhlGameInfo);
            }
            catch (Exception e)
            {
                Logger.Info(e);

                return(new NhlGameInfo());
            }
        }