root / HAgent / Horizon(TCP, HTTP) / Horizon / XmlDataManager.cs
이력 | 보기 | 이력해설 | 다운로드 (1.51 KB)
| 1 | 40 | HKM | using System; |
|---|---|---|---|
| 2 | using System.Collections.Generic; |
||
| 3 | using System.IO; |
||
| 4 | using System.Linq; |
||
| 5 | using System.Text; |
||
| 6 | using System.Threading.Tasks; |
||
| 7 | using System.Xml; |
||
| 8 | |||
| 9 | namespace Horizon |
||
| 10 | {
|
||
| 11 | class XmlDataManager |
||
| 12 | {
|
||
| 13 | XmlDocument ServerInfoXML = new XmlDocument(); |
||
| 14 | //string defaultPath = @"Program\"; |
||
| 15 | string XMLFileName = "Setting.xml"; |
||
| 16 | |||
| 17 | |||
| 18 | public void XMLCheck(string Ftpinfo, string ServerIP, string ServerPort, string ContentsName) // xml 파일 체크 |
||
| 19 | {
|
||
| 20 | try |
||
| 21 | {
|
||
| 22 | //ServerInfoXML |
||
| 23 | FileInfo xmlfile = new FileInfo(XMLFileName); |
||
| 24 | XmlElement xmlElement = ServerInfoXML.CreateElement("Info");
|
||
| 25 | XmlElement ServerInfo = ServerInfoXML.CreateElement("ServerInfo");
|
||
| 26 | |||
| 27 | ServerInfoXML.AppendChild(ServerInfoXML.CreateXmlDeclaration("1.0", "utf-8", "yes"));
|
||
| 28 | ServerInfo.SetAttribute("FtpUrl", Ftpinfo); // 서버정보를 xml로 저장
|
||
| 29 | ServerInfo.SetAttribute("IP", ServerIP);
|
||
| 30 | ServerInfo.SetAttribute("PORT", ServerPort);
|
||
| 31 | ServerInfo.SetAttribute("ContentsName", ContentsName);
|
||
| 32 | ServerInfoXML.AppendChild(ServerInfo); |
||
| 33 | |||
| 34 | ServerInfoXML.Save(XMLFileName); |
||
| 35 | Console.WriteLine("생성");
|
||
| 36 | |||
| 37 | } |
||
| 38 | catch (Exception e) |
||
| 39 | {
|
||
| 40 | Console.WriteLine(e.Message); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |