using System.Xml;
namespace Wayne.Lib.Log
{
///
/// Event log subscription output
///
public class LogConfigEventLogSubscriptionOutput : LogConfigOutput
{
///
/// Subscriber ID
///
public string SubscriberId { get; set; }
///
/// Storage type
///
public LogConfigEventLogStorageType StorageType { get; set; }
internal const string XmlType = "EventLogSubscription";
///
/// Constructor
///
public LogConfigEventLogSubscriptionOutput()
{
}
///
/// Constructor
///
///
///
public LogConfigEventLogSubscriptionOutput(string subscriberId, LogConfigEventLogStorageType storageType)
{
SubscriberId = subscriberId;
StorageType = storageType;
}
///
/// Deserialization constructor
///
///
///
internal LogConfigEventLogSubscriptionOutput(XmlNode parametersNode, string ns)
{
XmlNode eventLogParamsNode = parametersNode["EventLogSubscriptionParams", ns];
SubscriberId = eventLogParamsNode.Attributes["SubscriberId"].Value;
StorageType = EnumSupport.Parse(eventLogParamsNode.Attributes["StorageType"].Value, false, LogConfigEventLogStorageType.Volatile);
}
///
/// Serialization
///
///
internal override void WriteXml(XmlWriter xmlWriter)
{
xmlWriter.WriteStartElement("Output");
xmlWriter.WriteAttributeString("Type", XmlType);
xmlWriter.WriteStartElement("Parameters");
xmlWriter.WriteStartElement("EventLogSubscriptionParams");
xmlWriter.WriteAttributeString("SubscriberId", SubscriberId ?? string.Empty);
xmlWriter.WriteAttributeString("StorageType", StorageType.ToString());
xmlWriter.WriteEndElement(); // EventLogSubscriptionParams
xmlWriter.WriteEndElement(); // Parameters
xmlWriter.WriteEndElement(); // Output
}
///
/// Creates a clone object.
///
///
public override object Clone()
{
return new LogConfigEventLogSubscriptionOutput(SubscriberId, StorageType);
}
}
}