DeserializedLogEntry.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/Log/DeserializedLogEntry.cs $
  4. *
  5. * 2 08-02-13 9:25 Mattias.larsson
  6. * FxCop fixes.
  7. */
  8. #endregion
  9. using System.Xml;
  10. using System.Diagnostics.CodeAnalysis;
  11. namespace Wayne.Lib.Log
  12. {
  13. /// <summary>
  14. /// An EventLog entry that has been deserialized from a serialized form. The
  15. /// additional data that is supplied with the data is now only accessible as
  16. /// an Xml element in the LogDataElement property.
  17. /// </summary>
  18. public sealed class DeserializedLogEntry : EventLogEntry
  19. {
  20. #region Fields
  21. XmlElement logDataElement;
  22. #endregion
  23. #region Construction
  24. /// <summary>
  25. /// Internal constructor. This class is only created with the EventLogEntry.Deserialize method.
  26. /// </summary>
  27. /// <param name="logEntryNode"></param>
  28. internal DeserializedLogEntry(XmlElement logEntryNode)
  29. : base(logEntryNode)
  30. {
  31. logDataElement = logEntryNode["LogData"];
  32. }
  33. #endregion
  34. #region Properties
  35. /// <summary>
  36. /// Xml element that contains the additional data that was supplied with the event originally.
  37. /// </summary>
  38. [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode")]
  39. public XmlElement LogDataElement
  40. {
  41. get { return logDataElement; }
  42. }
  43. #endregion
  44. #region Methods
  45. /// <summary>
  46. /// Re-serializies the LogData element.
  47. /// </summary>
  48. /// <param name="xmlWriter"></param>
  49. protected override void WriteLogObjectData(XmlWriter xmlWriter)
  50. {
  51. base.WriteLogObjectData(xmlWriter);
  52. logDataElement.WriteContentTo(xmlWriter);
  53. }
  54. #endregion
  55. }
  56. }