Welcome to mirror list, hosted at ThFree Co, Russian Federation.

EventLogEntry.cs « System.Diagnostics « System « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5dd34c9f99a7174c290f1b885ae814c261a2eb64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//
// System.Diagnostics.EventLogEntry.cs
//
// Authors:
//   Jonathan Pryor (jonpryor@vt.edu)
//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (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)]
		[MonitoringDescription ("The instance ID for this event entry.")]
		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 ();
		}
	}
}