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 Modes { get; set; } = new List(); [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}"); return sb.ToString(); } catch (Exception ex) { XLogger.Instance.Fatal(ex); throw ex; } } public override string ToString() { return $"{this.Name}"; } } }