Revize 26ecc756
Přidáno uživatelem Alex Konig před téměř 4 roky(ů)
Server/ServerApp/WeatherPredictionParser/JsonParser.cs | ||
---|---|---|
3 | 3 |
// |
4 | 4 |
|
5 | 5 |
using ServerApp.DataDownload; |
6 |
using ServerApp.Parser.InputData; |
|
6 | 7 |
using ServerApp.Parser.OutputInfo; |
7 | 8 |
using System; |
8 | 9 |
using System.Collections.Generic; |
... | ... | |
20 | 21 |
/// <author>A. Konig</author> |
21 | 22 |
public class JsonParser : IJsonParser |
22 | 23 |
{ |
24 |
/// <summary> Data downloader </summary> |
|
25 |
DataDownloader downloader; |
|
23 | 26 |
/// <summary> Data loader </summary> |
24 |
DataDownloader loader;
|
|
27 |
IDataLoader loader;
|
|
25 | 28 |
/// <summary> Currently parsed day </summary> |
26 | 29 |
DateTime currParsedDay; |
27 | 30 |
/// <summary> Sunrise time of currently parsed day </summary> |
... | ... | |
32 | 35 |
/// <summary> |
33 | 36 |
/// Constructor |
34 | 37 |
/// </summary> |
35 |
/// <param name="loader"></param> |
|
36 |
public JsonParser(DataDownloader loader) |
|
38 |
/// <param name="downloader"></param>
|
|
39 |
public JsonParser(DataDownloader downloader, IDataLoader loader)
|
|
37 | 40 |
{ |
41 |
this.downloader = downloader; |
|
38 | 42 |
this.loader = loader; |
39 | 43 |
} |
40 | 44 |
|
... | ... | |
107 | 111 |
sunsetTime = new List<DateTime>(); |
108 | 112 |
|
109 | 113 |
// get file |
110 |
string data = loader.DownloadWeatherPrediction(); |
|
114 |
string file = downloader.DownloadWeatherPrediction(); |
|
115 |
string data = loader.LoadPredictionFile(file); |
|
116 |
|
|
117 |
if (data == null) |
|
118 |
return; |
|
119 |
|
|
111 | 120 |
DateTime now = DateTime.Now; |
112 | 121 |
|
113 | 122 |
Current = new WeatherInfo(); |
Také k dispozici: Unified diff
re #8962 Adding reading of file to string to CsvDataLoader