초기 커밋.
This commit is contained in:
79
DDUtilityApp/TIBRENDEZVOUS/DATA/TargetServer.cs
Normal file
79
DDUtilityApp/TIBRENDEZVOUS/DATA/TargetServer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using JWH;
|
||||
using JWH.DATA;
|
||||
|
||||
namespace DDUtilityApp.TIBRENDEZVOUS.DATA
|
||||
{
|
||||
|
||||
public class TargetServer : DataTableBase
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<Mode> Modes { get; set; } = new List<Mode>();
|
||||
|
||||
[ReadOnly(true)]
|
||||
public string Description { get { return $"{this.Name}"; } }
|
||||
|
||||
public TargetServer()
|
||||
{
|
||||
}
|
||||
|
||||
public TargetServer(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
public TargetServer(XmlNode node)
|
||||
{
|
||||
try
|
||||
{
|
||||
node.PropertiesCopyAttribute(this);
|
||||
XmlNode[] nodes = null;
|
||||
|
||||
// Modes
|
||||
nodes = node.GetNodesByName("Mode");
|
||||
foreach (XmlNode item in nodes)
|
||||
this.Modes.Add(new Mode(item));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XLogger.Instance.Fatal(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string ToXmlString(string indent = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
string indent02 = $"{indent} ";
|
||||
string indent04 = $"{indent02} ";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"{indent}<{this.GetType().Name} Name=\"{this.Name}\">");
|
||||
|
||||
// Modes
|
||||
foreach (Mode value in this.Modes)
|
||||
sb.Append(value.ToXmlString(indent02));
|
||||
|
||||
sb.AppendLine($"{indent}</{this.GetType().Name}>");
|
||||
return sb.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XLogger.Instance.Fatal(ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.Name}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user