1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System.Xml;
- namespace Wayne.Lib.Log
- {
- /// <summary>
- /// Event log subscription output
- /// </summary>
- public class LogConfigEventLogSubscriptionOutput : LogConfigOutput
- {
- /// <summary>
- /// Subscriber ID
- /// </summary>
- public string SubscriberId { get; set; }
- /// <summary>
- /// Storage type
- /// </summary>
- public LogConfigEventLogStorageType StorageType { get; set; }
- internal const string XmlType = "EventLogSubscription";
- /// <summary>
- /// Constructor
- /// </summary>
- public LogConfigEventLogSubscriptionOutput()
- {
- }
- /// <summary>
- /// Constructor
- /// </summary>
- /// <param name="subscriberId"></param>
- /// <param name="storageType"></param>
- public LogConfigEventLogSubscriptionOutput(string subscriberId, LogConfigEventLogStorageType storageType)
- {
- SubscriberId = subscriberId;
- StorageType = storageType;
- }
- /// <summary>
- /// Deserialization constructor
- /// </summary>
- /// <param name="parametersNode"></param>
- /// <param name="ns"></param>
- 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);
- }
- /// <summary>
- /// Serialization
- /// </summary>
- /// <param name="xmlWriter"></param>
- 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
- }
- /// <summary>
- /// Creates a clone object.
- /// </summary>
- /// <returns></returns>
- public override object Clone()
- {
- return new LogConfigEventLogSubscriptionOutput(SubscriberId, StorageType);
- }
- }
- }
|