EventLogEntry.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // System.Diagnostics.EventLogEntry.cs
  3. //
  4. // Authors:
  5. // Jonathan Pryor ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) 2002
  9. // (C) 2003 Andreas Nahr
  10. //
  11. using System;
  12. using System.ComponentModel;
  13. using System.Diagnostics;
  14. using System.Runtime.Serialization;
  15. namespace System.Diagnostics
  16. {
  17. [Serializable]
  18. [ToolboxItem (false), DesignTimeVisible (false)]
  19. public sealed class EventLogEntry : Component, ISerializable
  20. {
  21. private string category;
  22. private short categoryNumber;
  23. private byte[] data;
  24. private EventLogEntryType entryType;
  25. private int eventID;
  26. private int index;
  27. private string machineName;
  28. private string message;
  29. private string[] replacementStrings;
  30. private string source;
  31. private DateTime timeGenerated;
  32. private DateTime timeWritten;
  33. private string userName;
  34. internal EventLogEntry (string category, short categoryNumber, int index,
  35. int eventID, string message, string source,
  36. string userName, string machineName, EventLogEntryType entryType,
  37. DateTime timeGenerated, DateTime timeWritten, byte[] data,
  38. string[] replacementStrings)
  39. {
  40. this.category = category;
  41. this.categoryNumber = categoryNumber;
  42. this.data = data;
  43. this.entryType = entryType;
  44. this.eventID = eventID;
  45. this.index = index;
  46. this.machineName = machineName;
  47. this.message = message;
  48. this.replacementStrings = replacementStrings;
  49. this.source = source;
  50. this.timeGenerated = timeGenerated;
  51. this.timeWritten = timeWritten;
  52. this.userName = userName;
  53. }
  54. [MonoTODO]
  55. private EventLogEntry (SerializationInfo info, StreamingContext context)
  56. {
  57. }
  58. [MonitoringDescription ("The category of this event entry.")]
  59. public string Category {
  60. get { return category; }
  61. }
  62. [MonitoringDescription ("An ID for the category of this event entry.")]
  63. public short CategoryNumber {
  64. get { return categoryNumber; }
  65. }
  66. [MonitoringDescription ("Binary data associated with this event entry.")]
  67. public byte[] Data {
  68. get { return data; }
  69. }
  70. [MonitoringDescription ("The type of this event entry.")]
  71. public EventLogEntryType EntryType {
  72. get { return entryType; }
  73. }
  74. [MonitoringDescription ("An ID number for this event entry.")]
  75. public int EventID {
  76. get { return eventID; }
  77. }
  78. [MonitoringDescription ("Sequence numer of this event entry.")]
  79. public int Index {
  80. get { return index; }
  81. }
  82. [MonitoringDescription ("The Computer on which this event entry occured.")]
  83. public string MachineName {
  84. get { return machineName; }
  85. }
  86. [Editor ("System.ComponentModel.Design.BinaryEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
  87. [MonitoringDescription ("The message of this event entry.")]
  88. public string Message {
  89. get { return message; }
  90. }
  91. [MonitoringDescription ("Application strings for this event entry.")]
  92. public string[] ReplacementStrings {
  93. get { return replacementStrings; }
  94. }
  95. [MonitoringDescription ("The source application of this event entry.")]
  96. public string Source {
  97. get { return source; }
  98. }
  99. [MonitoringDescription ("Generation time of this event entry.")]
  100. public DateTime TimeGenerated {
  101. get { return timeGenerated; }
  102. }
  103. [MonitoringDescription ("The time at which this event entry was written to the logfile.")]
  104. public DateTime TimeWritten {
  105. get { return timeWritten; }
  106. }
  107. [MonitoringDescription ("The name of a user associated with this event entry.")]
  108. public string UserName {
  109. get { return userName; }
  110. }
  111. public bool Equals (EventLogEntry otherEntry)
  112. {
  113. if (otherEntry == this)
  114. return true;
  115. return (
  116. (otherEntry.Category == category) &&
  117. (otherEntry.CategoryNumber == categoryNumber) &&
  118. (otherEntry.Data.Equals (data)) &&
  119. (otherEntry.EntryType == entryType) &&
  120. (otherEntry.EventID == eventID) &&
  121. (otherEntry.Index == index) &&
  122. (otherEntry.MachineName == machineName) &&
  123. (otherEntry.Message == message) &&
  124. (otherEntry.ReplacementStrings.Equals (replacementStrings)) &&
  125. (otherEntry.Source == source) &&
  126. (otherEntry.TimeGenerated.Equals (timeGenerated)) &&
  127. (otherEntry.TimeWritten.Equals (timeWritten)) &&
  128. (otherEntry.UserName == userName)
  129. );
  130. }
  131. [MonoTODO ("Needs serialization support")]
  132. void ISerializable.GetObjectData (SerializationInfo info,
  133. StreamingContext context)
  134. {
  135. throw new NotImplementedException ();
  136. }
  137. }
  138. }