84 lines
1.8 KiB
C#
84 lines
1.8 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Text;
|
|
using System.Xml;
|
|
using JWH;
|
|
using JWH.DATA;
|
|
|
|
namespace DDUtilityApp.TIBRENDEZVOUS.DATA
|
|
{
|
|
|
|
public class Daemon : DataTableBase
|
|
{
|
|
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
public string Value { get; set; } = string.Empty;
|
|
|
|
[ReadOnly(true)]
|
|
public string Description { get { return $"[{this.Name}] {this.Value}"; } }
|
|
|
|
public Daemon()
|
|
{
|
|
}
|
|
|
|
public Daemon(string name, string value)
|
|
{
|
|
this.Name = name;
|
|
this.Value = value;
|
|
}
|
|
|
|
public Daemon(XmlNode node)
|
|
{
|
|
try
|
|
{
|
|
node.PropertiesCopyAttribute(this);
|
|
this.Value = node.InnerText;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
XLogger.Instance.Fatal(ex);
|
|
}
|
|
}
|
|
|
|
public string ToXmlString(string indent = "")
|
|
{
|
|
try
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine($"{indent}<{this.GetType().Name}>{this.Value}</{this.GetType().Name}>");
|
|
|
|
return sb.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
XLogger.Instance.Fatal(ex);
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"[{this.Name}] {this.Value}";
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
Daemon other = obj as Daemon;
|
|
if (other == null) return false;
|
|
|
|
if (!this.Name.Equals(other.Name)) return false;
|
|
if (!this.Value.Equals(other.Value)) return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
|
|
}
|
|
|
|
}
|