private Wind ParseWind(JToken windToken) { return(new Wind() { Direction = DirectionParser.FromDegrees(double.Parse(windToken["deg"].ToString())), Speed = Speed.FromKilometersPerHour(double.Parse(windToken["speed"].ToString())) }); }
public List <WeatherDay> ParseForecast(String forecastString) { var forecast = JsonConvert.DeserializeObject <OwmForecast>(forecastString); var result = new List <WeatherDay>(); foreach (var day in forecast.list) { result.Add(new WeatherDay() { Date = DateTimeOffset.FromUnixTimeSeconds(day.dt).DateTime, Condition = OpenWeatherMapConditionParser.Parse(day.weather[0].icon), Humidity = RelativeHumidity.FromPercentage(day.main.humidity), Temperature = Temperature.FromCelsius(day.main.temp / 10), Wind = new Wind() { Direction = DirectionParser.FromDegrees(day.wind.deg), Speed = Speed.FromKilometersPerHour(day.wind.speed) } }); } return(ForecastFilter.Filter(result)); }