forked from dimustriz/autokorsak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SysConfigDL.cs
56 lines (43 loc) · 1.35 KB
/
SysConfigDL.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Reflection;
using System.Net;
using Tourtoss.BE;
namespace Tourtoss.DL
{
public class SysConfigDL: BaseDL
{
private SysConfig ImportSysConfig(string url)
{
WebRequest request;
XmlSerializer serializer = new XmlSerializer(typeof(SysConfig));
var result = new SysConfig();
try
{
request = (HttpWebRequest)WebRequest.Create(url);
using (WebResponse response = request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
result = (SysConfig)serializer.Deserialize(reader);
}
}
}
catch (Exception)
{
}
return result;
}
public SysConfig ImportSysConfig()
{
SysConfig result = null;
string urlBase = @"http://kfgo.org.ua/autokorsak/";
result = ImportSysConfig(urlBase + "ar_sys.xml?stamp=" + DateTime.Now.Ticks.ToString());
return result;
}
}
}