public string Format(string data)
        {
            var rawWeather = JsonConvert.DeserializeObject <OpenWeatherPublicModel>(data);
            var json       = JsonConvert.SerializeObject(rawWeather);

            return(_format.Format(json));
        }
Beispiel #2
0
        /// <summary>
        /// The method used to format and push over a stream a given logging information.
        /// </summary>
        /// <param name="log">The given logging information to store.</param>
        public void Store(Log log)
        {
            var formattedLog = _format.Format(log);

            _writer.WriteLine(formattedLog);

            _writer.Flush();
        }
Beispiel #3
0
        public string Execute(string cityName, IFormat formatter)
        {
            var cityResult = _weatherCityRepository.GetOpenWeatherCityId(cityName);

            if (cityResult.IsFailure)
            {
                return(cityResult.Error);
            }

            var weatherInformationResult = _weatherCityService.GetCityWeatherInformation(cityResult.Value);

            return(weatherInformationResult.IsSuccess ? formatter.Format(weatherInformationResult.Value) : weatherInformationResult.Error);
        }
        public TItem GetAllData()
        {
            var cacheKey = "all_data";

            var cachedData = _cache.Get(cacheKey);

            if (cachedData == null)
            {
                var filePath      = _dataSource.GetDataSource();
                var fileContent   = File.ReadAllText(filePath);
                var formattedData = _formatter.Format(fileContent);

                _cache.Add(cacheKey, formattedData);

                return(formattedData);
            }

            return(cachedData);
        }
 public string GetSummary()
 {
     return(_format.Format(_flightService));
 }
Beispiel #6
0
 public override string ToString()
 {
     return(_formatter.Format(this));
 }
 /// <summary>
 /// The FormatData method is used to convert a file into a format that users want
 /// </summary>
 /// <param name="formatType"></param>
 /// <param name="file"></param>
 /// <param name="itemName"></param>
 /// <returns></returns>
 public FormatItem FormatData(IFormat formatType, BaseFile file, string itemName = "")
 {
     return(formatType.Format(file.GetValueList(), itemName));
 }