Revize e257ae8f
Přidáno uživatelem Eliška Mourycová před téměř 4 roky(ů)
Server/ServerApp/Program.cs | ||
---|---|---|
30 | 30 |
static void Main(string[] args) |
31 | 31 |
{ |
32 | 32 |
|
33 |
Config config = FillConfigInfo(args); |
|
34 |
if (config == null) |
|
35 |
{ |
|
36 |
Console.ReadLine(); |
|
37 |
return; |
|
38 |
} |
|
33 |
// Config config = FillConfigInfo(args);
|
|
34 |
//if (config == null)
|
|
35 |
//{
|
|
36 |
// Console.ReadLine();
|
|
37 |
// return;
|
|
38 |
//}
|
|
39 | 39 |
|
40 | 40 |
// create a thread for commands accepting: |
41 | 41 |
//Thread inputThread = new Thread(CommandsAcceptor.AcceptCommand); |
... | ... | |
49 | 49 |
|
50 | 50 |
|
51 | 51 |
// test scenario - data download: |
52 |
DataDownloader dd = new DataDownloader(config.DataRootDir, config.DataWebsite, config.DownloadedFilesNaming); |
|
53 |
dd.OverwriteExisting = false; |
|
54 |
List<string> savedFiles = new List<string>(); |
|
55 |
//savedFiles.AddRange(dd.DownloadData(DataType.JIS, DataFormat.CSV, new Date(1, 2019), new Date(12, 2020))); |
|
56 |
//savedFiles.AddRange(dd.DownloadData(DataType.STROJE, DataFormat.CSV, new Date(1, 2017), new Date(12, 2020))); |
|
57 |
//savedFiles.AddRange(dd.DownloadData(DataType.POCASI, DataFormat.CSV, new Date(1, 2017), new Date(12, 2020))); |
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
Console.WriteLine("Saved files: "); |
|
62 |
foreach (string s in savedFiles) |
|
63 |
{ |
|
64 |
Console.WriteLine(s); |
|
65 |
} |
|
66 |
|
|
67 |
Console.WriteLine("subdirectories: "); |
|
68 |
foreach (KeyValuePair<DataType, string> kvp in dd.DataSubDirectories) |
|
69 |
{ |
|
70 |
Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); |
|
71 |
} |
|
72 |
|
|
73 |
List<string> retrievedData = dd.GetData(dd.DataSubDirectories[DataType.JIS], new Date(10, 2019), new Date(12, 2020)); |
|
74 |
Console.WriteLine("Retrieved data: "); |
|
75 |
foreach (string s in retrievedData) |
|
76 |
{ |
|
77 |
Console.WriteLine(s); |
|
78 |
} |
|
79 |
|
|
52 |
//DataDownloader dd = new DataDownloader(config.DataRootDir, config.DataWebsite, config.DownloadedFilesNaming); |
|
53 |
//dd.OverwriteExisting = false; |
|
54 |
//List<string> savedFiles = new List<string>(); |
|
55 |
////savedFiles.AddRange(dd.DownloadData(DataType.JIS, DataFormat.CSV, new Date(1, 2019), new Date(12, 2020))); |
|
56 |
////savedFiles.AddRange(dd.DownloadData(DataType.STROJE, DataFormat.CSV, new Date(1, 2017), new Date(12, 2020))); |
|
57 |
////savedFiles.AddRange(dd.DownloadData(DataType.POCASI, DataFormat.CSV, new Date(1, 2017), new Date(12, 2020))); |
|
80 | 58 |
|
81 | 59 |
|
82 | 60 |
|
61 |
//Console.WriteLine("Saved files: "); |
|
62 |
//foreach (string s in savedFiles) |
|
63 |
//{ |
|
64 |
// Console.WriteLine(s); |
|
65 |
//} |
|
83 | 66 |
|
67 |
//Console.WriteLine("subdirectories: "); |
|
68 |
//foreach (KeyValuePair<DataType, string> kvp in dd.DataSubDirectories) |
|
69 |
//{ |
|
70 |
// Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); |
|
71 |
//} |
|
84 | 72 |
|
85 |
// date testing |
|
86 |
//Date d1 = new Date(2, 2020); |
|
87 |
//Date d2 = new Date(1, 2019); |
|
73 |
//List<string> retrievedData = dd.GetData(dd.DataSubDirectories[DataType.JIS], new Date(10, 2019), new Date(12, 2020)); |
|
74 |
//Console.WriteLine("Retrieved data: "); |
|
75 |
//foreach (string s in retrievedData) |
|
76 |
//{ |
|
77 |
// Console.WriteLine(s); |
|
78 |
//} |
|
88 | 79 |
|
89 |
//Console.WriteLine("equals" + d1.Equals(d2)); |
|
90 |
//Console.WriteLine("==" + (d1 == d2)); |
|
91 |
//Console.WriteLine("!=" + (d1 != d2)); |
|
92 |
//Console.WriteLine(">" + (d1 > d2)); |
|
93 |
//Console.WriteLine("<" + (d1 < d2)); |
|
94 |
//Console.WriteLine(">=" + (d1 >= d2)); |
|
95 |
//Console.WriteLine("<=" + (d1 <= d2)); |
|
96 | 80 |
|
97 | 81 |
|
98 | 82 |
|
99 | 83 |
|
100 | 84 |
// test - connection: |
101 |
//AsynchronousSocketListener asl = new AsynchronousSocketListener();
|
|
102 |
//asl.StartListening();
|
|
85 |
ConnectionListener cl = new ConnectionListener(8000/*int.Parse(config.Port)*/);
|
|
86 |
cl.StartListening();
|
|
103 | 87 |
|
104 | 88 |
|
105 | 89 |
//NaiveBayesClassifier naiveBayesClassifier = new NaiveBayesClassifier(); |
Také k dispozici: Unified diff
Re #8770. Somewhat working example of HttpListener. Can receive requests from other than host machine. Firawall adjustment was necessary.