示例#1
0
        public GameDto GetGame()
        {
            var gameInfo = _httpClient.DoGet(_uri);

            var result = Task.Factory.StartNew(() => JsonConvert.DeserializeObject <GameDto>(gameInfo.Result)).Result;

            _logger.Write("GameId = " + result.GameId);
            _logger.Write("Knight's name = " + result.Knight.Name);
            _logger.Write("Knight's agility = " + result.Knight.Agility);
            _logger.Write("Knight's armor = " + result.Knight.Armor);
            _logger.Write("Knight's attack = " + result.Knight.Attack);
            _logger.Write("Knight's endurance = " + result.Knight.Endurance);

            return(result);
        }
示例#2
0
        public ReportDto GetWeather(int gameId)
        {
            var path     = Convert.ToString(gameId);
            var fullPath = String.Format("{0}{1}", _uri, path);

            var response = _httpClient.DoGet(fullPath);

            var        serializer = new XmlSerializer(typeof(ReportDto));
            TextReader reader     = new StringReader(response.Result);

            var result = (ReportDto)serializer.Deserialize(reader);

            reader.Dispose();

            _logger.Write("Weather code = " + result.Code);
            _logger.Write("Weather message = " + result.Message);
            _logger.Write("Weather Rating = " + result.Rating);

            return(result);
        }