| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- //
- // System.Diagnostics.EventLogEntry.cs
- //
- // Authors:
- // Jonathan Pryor ([email protected])
- // Andreas Nahr ([email protected])
- //
- // (C) 2002
- // (C) 2003 Andreas Nahr
- //
- //
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to
- // permit persons to whom the Software is furnished to do so, subject to
- // the following conditions:
- //
- // The above copyright notice and this permission notice shall be
- // included in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- //
- using System.ComponentModel;
- #if NET_2_0
- using System.Runtime.InteropServices;
- #endif
- using System.Runtime.Serialization;
- using System.Security.Permissions;
- namespace System.Diagnostics
- {
- [Serializable]
- [ToolboxItem (false), DesignTimeVisible (false)]
- [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
- public sealed class EventLogEntry : Component, ISerializable
- {
- private string category;
- private short categoryNumber;
- private byte[] data;
- private EventLogEntryType entryType;
- private int eventID;
- private int index;
- private string machineName;
- private string message;
- private string[] replacementStrings;
- private string source;
- private DateTime timeGenerated;
- private DateTime timeWritten;
- private string userName;
- #if NET_2_0
- private long instanceId;
- #endif
- internal EventLogEntry (string category, short categoryNumber, int index,
- int eventID, string source, string message, string userName,
- string machineName, EventLogEntryType entryType,
- DateTime timeGenerated, DateTime timeWritten, byte[] data,
- string[] replacementStrings, long instanceId)
- {
- this.category = category;
- this.categoryNumber = categoryNumber;
- this.data = data;
- this.entryType = entryType;
- this.eventID = eventID;
- this.index = index;
- this.machineName = machineName;
- this.message = message;
- this.replacementStrings = replacementStrings;
- this.source = source;
- this.timeGenerated = timeGenerated;
- this.timeWritten = timeWritten;
- this.userName = userName;
- #if NET_2_0
- this.instanceId = instanceId;
- #endif
- }
- [MonoTODO]
- private EventLogEntry (SerializationInfo info, StreamingContext context)
- {
- }
- [MonitoringDescription ("The category of this event entry.")]
- public string Category {
- get { return category; }
- }
- [MonitoringDescription ("An ID for the category of this event entry.")]
- public short CategoryNumber {
- get { return categoryNumber; }
- }
- [MonitoringDescription ("Binary data associated with this event entry.")]
- public byte[] Data {
- get { return data; }
- }
- [MonitoringDescription ("The type of this event entry.")]
- public EventLogEntryType EntryType {
- get { return entryType; }
- }
- #if NET_2_0
- [Obsolete ("Use InstanceId")]
- #endif
- [MonitoringDescription ("An ID number for this event entry.")]
- public int EventID {
- get { return eventID; }
- }
- [MonitoringDescription ("Sequence numer of this event entry.")]
- public int Index {
- get { return index; }
- }
- #if NET_2_0
- [ComVisible (false)]
- public long InstanceId {
- get { return instanceId; }
- }
- #endif
- [MonitoringDescription ("The Computer on which this event entry occured.")]
- public string MachineName {
- get { return machineName; }
- }
- [Editor ("System.ComponentModel.Design.BinaryEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
- [MonitoringDescription ("The message of this event entry.")]
- public string Message {
- get { return message; }
- }
- [MonitoringDescription ("Application strings for this event entry.")]
- public string[] ReplacementStrings {
- get { return replacementStrings; }
- }
- [MonitoringDescription ("The source application of this event entry.")]
- public string Source {
- get { return source; }
- }
- [MonitoringDescription ("Generation time of this event entry.")]
- public DateTime TimeGenerated {
- get { return timeGenerated; }
- }
- [MonitoringDescription ("The time at which this event entry was written to the logfile.")]
- public DateTime TimeWritten {
- get { return timeWritten; }
- }
- [MonitoringDescription ("The name of a user associated with this event entry.")]
- public string UserName {
- get { return userName; }
- }
- public bool Equals (EventLogEntry otherEntry)
- {
- if (otherEntry == this)
- return true;
- return (
- (otherEntry.Category == category) &&
- (otherEntry.CategoryNumber == categoryNumber) &&
- (otherEntry.Data.Equals (data)) &&
- (otherEntry.EntryType == entryType) &&
- (otherEntry.EventID == eventID) &&
- (otherEntry.Index == index) &&
- (otherEntry.MachineName == machineName) &&
- (otherEntry.Message == message) &&
- (otherEntry.ReplacementStrings.Equals (replacementStrings)) &&
- (otherEntry.Source == source) &&
- (otherEntry.TimeGenerated.Equals (timeGenerated)) &&
- (otherEntry.TimeWritten.Equals (timeWritten)) &&
- (otherEntry.UserName == userName)
- );
- }
- [MonoTODO ("Needs serialization support")]
- void ISerializable.GetObjectData (SerializationInfo info,
- StreamingContext context)
- {
- throw new NotImplementedException ();
- }
- }
- }
|