1
|
using Parser.OutputInfo;
|
2
|
using System;
|
3
|
using System.Collections.Generic;
|
4
|
using System.Globalization;
|
5
|
using System.Threading;
|
6
|
|
7
|
namespace Parser.Parsers
|
8
|
{
|
9
|
class CsvParser
|
10
|
{
|
11
|
|
12
|
string path;
|
13
|
WeatherParser weatherParser;
|
14
|
JisParser jisParser;
|
15
|
LogInParser loginParser;
|
16
|
|
17
|
public List<WeatherInfo> weatherList;
|
18
|
public List<JisInfo> jisList;
|
19
|
public List<LogInInfo> loginList;
|
20
|
|
21
|
public CsvParser()
|
22
|
{
|
23
|
TagInfo.CreateDictionaries();
|
24
|
path = "data/";
|
25
|
|
26
|
weatherParser = new WeatherParser();
|
27
|
jisParser = new JisParser();
|
28
|
loginParser = new LogInParser();
|
29
|
}
|
30
|
|
31
|
public void Parse()
|
32
|
{
|
33
|
var cultureInfo = CultureInfo.GetCultureInfo("en-GB");
|
34
|
Thread.CurrentThread.CurrentCulture = cultureInfo;
|
35
|
Thread.CurrentThread.CurrentUICulture = cultureInfo;
|
36
|
|
37
|
string pathWeather = path + "weather";
|
38
|
string pathJis = path + "jis";
|
39
|
string pathLogIn = path + "login";
|
40
|
|
41
|
weatherList = weatherParser.ParseWeatherData(pathWeather);
|
42
|
jisList = jisParser.ParseJisData(pathJis);
|
43
|
loginList = loginParser.ParseLogInData(pathLogIn);
|
44
|
|
45
|
Console.WriteLine("WEATHER");
|
46
|
WriteToConsole(weatherList);
|
47
|
Console.WriteLine("JIS");
|
48
|
WriteToConsole(jisList);
|
49
|
Console.WriteLine("LOGIN");
|
50
|
WriteToConsole(loginList);
|
51
|
}
|
52
|
|
53
|
private void WriteToConsole<T>(List<T> list)
|
54
|
{
|
55
|
if (list == null)
|
56
|
{
|
57
|
Console.WriteLine("Unsuccessful parsing");
|
58
|
return;
|
59
|
}
|
60
|
Console.WriteLine(list.Count);
|
61
|
|
62
|
for (int i = 0; i < list.Count; i++)
|
63
|
Console.WriteLine(list[i].ToString());
|
64
|
}
|
65
|
|
66
|
}
|
67
|
}
|