Revize f9dd116f
Přidáno uživatelem Alex Konig před téměř 4 roky(ů)
Server/ServerApp/Parser/Parsers/DataParser.cs | ||
---|---|---|
220 | 220 |
/// </summary> |
221 | 221 |
private void WriteToConsole(List<ActivityInfo> list) |
222 | 222 |
{ |
223 |
// TODO useless in finished app |
|
224 | 223 |
if (list == null) |
225 | 224 |
{ |
226 | 225 |
Console.WriteLine("Unsuccessful parsing"); |
... | ... | |
240 | 239 |
/// </summary> |
241 | 240 |
private void WriteToConsole(List<WeatherInfo> list) |
242 | 241 |
{ |
243 |
// TODO useless in finished app |
|
244 | 242 |
if (list == null) |
245 | 243 |
{ |
246 | 244 |
Console.WriteLine("Unsuccessful parsing"); |
Server/ServerApp/Parser/Parsers/JisParser.cs | ||
---|---|---|
5 | 5 |
using System; |
6 | 6 |
using System.Collections.Generic; |
7 | 7 |
using System.IO; |
8 |
using log4net; |
|
8 | 9 |
using ServerApp.Parser.InputData; |
9 | 10 |
using ServerApp.Parser.OutputInfo; |
10 | 11 |
|
... | ... | |
17 | 18 |
/// <author>A. Konig</author> |
18 | 19 |
public class JisParser |
19 | 20 |
{ |
21 |
/// <summary> Logger </summary> |
|
22 |
private static readonly ILog _log = LogManager.GetLogger(typeof(JisParser)); |
|
20 | 23 |
|
21 | 24 |
/// <summary> Datafile loader </summary> |
22 | 25 |
IDataLoader loader; |
... | ... | |
71 | 74 |
} |
72 | 75 |
catch |
73 | 76 |
{ |
74 |
Console.WriteLine("Incorrect jis input file " + current);
|
|
77 |
_log.Error("Incorrect jis input file " + current);
|
|
75 | 78 |
} |
76 | 79 |
|
77 | 80 |
return list; |
... | ... | |
141 | 144 |
} |
142 | 145 |
else |
143 | 146 |
{ |
144 |
// TODO uknown code handling -> to file? |
|
145 |
// Console.WriteLine("Unknown code " + list[i].placeTag); |
|
147 |
_log.Warn("Unknown code " + list[i].placeTag); |
|
146 | 148 |
} |
147 | 149 |
|
148 | 150 |
} |
... | ... | |
217 | 219 |
// start time of last interval |
218 | 220 |
DateTime stTime = new DateTime(lastStartTime.Year, lastStartTime.Month, lastStartTime.Day, startingTime, 0, 0); |
219 | 221 |
|
220 |
// TODO zjistit kolik se vynechalo a přidat tolik nul? |
|
221 |
|
|
222 | 222 |
// find end and start time |
223 | 223 |
if (!trigger) |
224 | 224 |
index++; |
... | ... | |
260 | 260 |
} |
261 | 261 |
else |
262 | 262 |
{ |
263 |
// TODO uknown code handling -> to file? |
|
264 |
// Console.WriteLine("Unknown code " + list[i].placeTag); |
|
263 |
_log.Warn("Unknown code " + list[i].placeTag); |
|
265 | 264 |
} |
266 | 265 |
|
267 | 266 |
} |
Server/ServerApp/Parser/Parsers/LogInParser.cs | ||
---|---|---|
2 | 2 |
// Author: A. Konig |
3 | 3 |
// |
4 | 4 |
|
5 |
using log4net; |
|
5 | 6 |
using ServerApp.Parser.InputData; |
6 | 7 |
using ServerApp.Parser.OutputInfo; |
7 | 8 |
using System; |
... | ... | |
17 | 18 |
/// <author>A. Konig</author> |
18 | 19 |
public class LogInParser |
19 | 20 |
{ |
21 |
/// <summary> Logger </summary> |
|
22 |
private static readonly ILog _log = LogManager.GetLogger(typeof(LogInParser)); |
|
23 |
|
|
20 | 24 |
/// <summary> Datafile loader </summary> |
21 | 25 |
IDataLoader loader; |
22 | 26 |
|
... | ... | |
69 | 73 |
} |
70 | 74 |
} catch |
71 | 75 |
{ |
72 |
Console.WriteLine("Incorrect Login input file " + current);
|
|
76 |
_log.Error("Incorrect Login input file " + current);
|
|
73 | 77 |
} |
74 | 78 |
|
75 | 79 |
return list; |
... | ... | |
131 | 135 |
if (TagInfo.buildingTags.ContainsKey(place)) |
132 | 136 |
{ |
133 | 137 |
int index = TagInfo.buildingTags[place]; |
134 |
//Console.WriteLine(place + " " + index); |
|
135 | 138 |
|
136 | 139 |
// to all |
137 | 140 |
if (index == -1) |
... | ... | |
143 | 146 |
} |
144 | 147 |
else |
145 | 148 |
{ |
146 |
// TODO uknown code handling -> to file? |
|
147 |
// Console.WriteLine("Unknown code " + list[i].building); |
|
149 |
_log.Warn("Unknown code " + list[i].building); |
|
148 | 150 |
} |
149 | 151 |
|
150 | 152 |
} |
... | ... | |
262 | 264 |
} |
263 | 265 |
else |
264 | 266 |
{ |
265 |
// TODO uknown code handling -> write to file? |
|
266 |
// Console.WriteLine("Unknown code " + list[i].building); |
|
267 |
_log.Warn("Unknown code " + list[i].building); |
|
267 | 268 |
} |
268 | 269 |
|
269 | 270 |
} |
Server/ServerApp/Parser/Parsers/TagInfo.cs | ||
---|---|---|
12 | 12 |
/// <author>Alex Konig</author> |
13 | 13 |
public class TagInfo |
14 | 14 |
{ |
15 |
/// <summary> Array with names of buildings </summary> |
|
15 | 16 |
public static string[] buildings; |
16 | 17 |
|
17 |
// -1 all |
|
18 |
/// <summary> |
|
19 |
/// Dictionary of places from jis files, and the index of building to which they belong |
|
20 |
/// -1 means all indices |
|
21 |
/// </summary> |
|
18 | 22 |
public static Dictionary<string, int> jisPlaces; |
19 | 23 |
|
20 |
// -1 all -2 FST, FEK |
|
24 |
/// <summary> |
|
25 |
/// Dictionary of room prefixes and the index of building to which they belong |
|
26 |
/// -1 means all indices |
|
27 |
/// </summary> |
|
21 | 28 |
public static Dictionary<string, int> buildingTags; |
22 | 29 |
|
30 |
/// <summary> |
|
31 |
/// Get the index of a specific building in array buildings |
|
32 |
/// </summary> |
|
33 |
/// <param name="tag">Building abbrevation</param> |
|
34 |
/// <returns>Index in array buildings, -1 if not found</returns> |
|
23 | 35 |
public static int IndexOfBuilding(string tag) |
24 | 36 |
{ |
25 | 37 |
for (int i = 0; i < buildings.Length; i++) |
... | ... | |
31 | 43 |
return -1; |
32 | 44 |
} |
33 | 45 |
|
46 |
/// <summary> |
|
47 |
/// Create dictionaries with jis places and room prefixes |
|
48 |
/// </summary> |
|
34 | 49 |
public static void CreateDictionaries() |
35 | 50 |
{ |
36 | 51 |
jisPlaces = new Dictionary<string, int>(); |
Server/ServerApp/Parser/Parsers/WeatherParser.cs | ||
---|---|---|
2 | 2 |
// Author: A. Konig |
3 | 3 |
// |
4 | 4 |
|
5 |
using log4net; |
|
5 | 6 |
using ServerApp.Parser.InputData; |
6 | 7 |
using ServerApp.Parser.OutputInfo; |
7 | 8 |
using System; |
... | ... | |
17 | 18 |
/// <author>A. Konig</author> |
18 | 19 |
public class WeatherParser |
19 | 20 |
{ |
21 |
/// <summary> Logger </summary> |
|
22 |
private static readonly ILog _log = LogManager.GetLogger(typeof(WeatherParser)); |
|
20 | 23 |
|
21 | 24 |
/// <summary> Datafile loader </summary> |
22 | 25 |
IDataLoader loader; |
... | ... | |
72 | 75 |
} |
73 | 76 |
} catch |
74 | 77 |
{ |
75 |
Console.WriteLine("Incorrect Weather input file " + current);
|
|
78 |
_log.Error("Incorrect Weather input file " + current);
|
|
76 | 79 |
} |
77 | 80 |
|
78 | 81 |
return list; |
Server/ServerApp/WeatherPredictionParser/JsonParser.cs | ||
---|---|---|
2 | 2 |
// Author: A. Konig |
3 | 3 |
// |
4 | 4 |
|
5 |
using log4net; |
|
5 | 6 |
using ServerApp.DataDownload; |
6 | 7 |
using ServerApp.Parser.InputData; |
7 | 8 |
using ServerApp.Parser.OutputInfo; |
8 | 9 |
using System; |
9 | 10 |
using System.Collections.Generic; |
10 | 11 |
using System.Globalization; |
11 |
using System.IO; |
|
12 |
using System.Net; |
|
13 | 12 |
using System.Text.Json; |
14 | 13 |
using static System.Text.Json.JsonElement; |
15 | 14 |
|
... | ... | |
21 | 20 |
/// <author>A. Konig</author> |
22 | 21 |
public class JsonParser : IJsonParser |
23 | 22 |
{ |
23 |
/// <summary> Logger </summary> |
|
24 |
private static readonly ILog _log = LogManager.GetLogger(typeof(JsonParser)); |
|
25 |
|
|
24 | 26 |
/// <summary> Data downloader </summary> |
25 | 27 |
IDataDownloader downloader; |
26 | 28 |
/// <summary> Data loader </summary> |
... | ... | |
135 | 137 |
while (weatherP.MoveNext()) |
136 | 138 |
{ |
137 | 139 |
string name = weatherP.Current.Name; |
138 |
Console.WriteLine(name); |
|
139 | 140 |
|
140 | 141 |
switch (name) |
141 | 142 |
{ |
... | ... | |
162 | 163 |
EncompassSunRiseSetTimes(); |
163 | 164 |
} catch |
164 | 165 |
{ |
165 |
Console.WriteLine("Weather prediction file in incorrect format");
|
|
166 |
_log.Error("Weather prediction file in incorrect format");
|
|
166 | 167 |
Current = new WeatherInfo(); |
167 | 168 |
Predictions = new List<WeatherInfo>(); |
168 | 169 |
} |
... | ... | |
343 | 344 |
DateTime newSunrise = new DateTime(); |
344 | 345 |
DateTime.TryParseExact(astrInfo.Current.Value.GetString(), "hh:mm tt", CultureInfo.InvariantCulture, DateTimeStyles.None, out newSunrise); |
345 | 346 |
sunriseTime.Add(newSunrise); |
346 |
//Console.WriteLine("\t sunrise time : " + sunriseTime + " " + astrInfo.Current.Value.GetString()); |
|
347 | 347 |
break; |
348 | 348 |
} |
349 | 349 |
case "sunset": |
... | ... | |
351 | 351 |
DateTime newSunset = new DateTime(); |
352 | 352 |
DateTime.TryParseExact(astrInfo.Current.Value.GetString(), "hh:mm tt", CultureInfo.InvariantCulture, DateTimeStyles.None, out newSunset); |
353 | 353 |
sunsetTime.Add(newSunset); |
354 |
//Console.WriteLine("\t sunset time : " + sunsetTime + " " + astrInfo.Current.Value.GetString()); |
|
355 | 354 |
break; |
356 | 355 |
} |
357 | 356 |
} |
... | ... | |
423 | 422 |
} |
424 | 423 |
} |
425 | 424 |
|
426 |
// Console.WriteLine(weather.ToString()); |
|
427 | 425 |
Predictions.Add(weather); |
428 | 426 |
} |
429 | 427 |
|
Také k dispozici: Unified diff
re #9036 Editing logging