Exemplo n.º 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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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());
            }
        }