diff options
author | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-18 15:38:19 +0400 |
---|---|---|
committer | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-18 15:38:19 +0400 |
commit | ca390b431097790a602ade670802cf6180c51041 (patch) | |
tree | ecf02e748e65a4b78d3b66e3bc599757bac23e82 /mcs/class/System/System.Diagnostics | |
parent | 565b8e5b9d25810096301b77f853d1516011d406 (diff) |
2003-07-18 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* AlphabeticalEnumConverter.cs: Added
* EventLogEntry.cs: Implemented
* EventLogPermissionEntryCollection.cs: Fixed signature and implementation of indexer
* EventLogTraceListener.cs: Fixed signature
* PerformanceCounter.cs: Added missing attribute
* PerformanceCounterType.cs: Added missing attribute
* SRDescriptionAttribute.cs: Added and implemented
svn path=/trunk/mcs/; revision=16399
Diffstat (limited to 'mcs/class/System/System.Diagnostics')
8 files changed, 164 insertions, 44 deletions
diff --git a/mcs/class/System/System.Diagnostics/AlphabeticalEnumConverter.cs b/mcs/class/System/System.Diagnostics/AlphabeticalEnumConverter.cs new file mode 100644 index 00000000000..38a852daa9a --- /dev/null +++ b/mcs/class/System/System.Diagnostics/AlphabeticalEnumConverter.cs @@ -0,0 +1,30 @@ +// +// System.Diagnostics.AlphabeticalEnumConverter.cs +// +// Authors: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2003 Andreas Nahr +// + +using System; +using System.ComponentModel; + +namespace System.Diagnostics +{ + + internal sealed class AlphabeticalEnumConverter : EnumConverter + { + + public AlphabeticalEnumConverter (Type type) + : base (type) + { + } + + [MonoTODO ("Create sorted standart values")] + public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) + { + return Values; + } + } +} diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog index f55189c821f..6852618f586 100644 --- a/mcs/class/System/System.Diagnostics/ChangeLog +++ b/mcs/class/System/System.Diagnostics/ChangeLog @@ -1,3 +1,13 @@ +2003-07-18 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * AlphabeticalEnumConverter.cs: Added + * EventLogEntry.cs: Implemented + * EventLogPermissionEntryCollection.cs: Fixed signature and implementation of indexer + * EventLogTraceListener.cs: Fixed signature + * PerformanceCounter.cs: Added missing attribute + * PerformanceCounterType.cs: Added missing attribute + * SRDescriptionAttribute.cs: Added and implemented + 2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * CounterCreationData.cs: diff --git a/mcs/class/System/System.Diagnostics/EventLogEntry.cs b/mcs/class/System/System.Diagnostics/EventLogEntry.cs index 2b6766c4cff..99f2410f20c 100644 --- a/mcs/class/System/System.Diagnostics/EventLogEntry.cs +++ b/mcs/class/System/System.Diagnostics/EventLogEntry.cs @@ -14,105 +14,144 @@ using System.ComponentModel; using System.Diagnostics; using System.Runtime.Serialization; -namespace System.Diagnostics { +namespace System.Diagnostics +{ [Serializable] - [MonoTODO("Just stubbed out")] - [ToolboxItem (""), DesignTimeVisible (false)] - public sealed class EventLogEntry : Component, ISerializable { - - [MonoTODO] - internal EventLogEntry () + [ToolboxItem (false), DesignTimeVisible (false)] + 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; + + internal EventLogEntry (string category, short categoryNumber, int index, + int eventID, string message, string source, + string userName, string machineName, EventLogEntryType entryType, + DateTime timeGenerated, DateTime timeWritten, byte[] data, + string[] replacementStrings) + { + 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; + } + + [MonoTODO] + private EventLogEntry (SerializationInfo info, StreamingContext context) { } - [MonoTODO] [MonitoringDescription ("The category of this event entry.")] public string Category { - get {throw new NotImplementedException ();} + get { return category; } } - [MonoTODO] [MonitoringDescription ("An ID for the category of this event entry.")] public short CategoryNumber { - get {throw new NotImplementedException ();} + get { return categoryNumber; } } - [MonoTODO] [MonitoringDescription ("Binary data associated with this event entry.")] public byte[] Data { - get {throw new NotImplementedException ();} + get { return data; } } - [MonoTODO] [MonitoringDescription ("The type of this event entry.")] public EventLogEntryType EntryType { - get {throw new NotImplementedException ();} + get { return entryType; } } - [MonoTODO] [MonitoringDescription ("An ID number for this event entry.")] public int EventID { - get {throw new NotImplementedException ();} + get { return eventID; } } - [MonoTODO] [MonitoringDescription ("Sequence numer of this event entry.")] public int Index { - get {throw new NotImplementedException ();} + get { return index; } } - [MonoTODO] [MonitoringDescription ("The Computer on which this event entry occured.")] public string MachineName { - get {throw new NotImplementedException ();} + get { return machineName; } } - [MonoTODO] [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 {throw new NotImplementedException ();} + get { return message; } } - [MonoTODO] [MonitoringDescription ("Application strings for this event entry.")] public string[] ReplacementStrings { - get {throw new NotImplementedException ();} + get { return replacementStrings; } } - [MonoTODO] [MonitoringDescription ("The source application of this event entry.")] public string Source { - get {throw new NotImplementedException ();} + get { return source; } } - [MonoTODO] [MonitoringDescription ("Generation time of this event entry.")] public DateTime TimeGenerated { - get {throw new NotImplementedException ();} + get { return timeGenerated; } } - [MonoTODO] [MonitoringDescription ("The time at which this event entry was written to the logfile.")] public DateTime TimeWritten { - get {throw new NotImplementedException ();} + get { return timeWritten; } } - [MonoTODO] [MonitoringDescription ("The name of a user associated with this event entry.")] public string UserName { - get {throw new NotImplementedException ();} + get { return userName; } } - [MonoTODO] - public bool Equals(EventLogEntry otherEntry) + public bool Equals (EventLogEntry otherEntry) { - throw new NotImplementedException (); - } - - [MonoTODO] - void ISerializable.GetObjectData(SerializationInfo info, + 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 (); diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs index cd2da3fe82b..7e4830b17f5 100644 --- a/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs +++ b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs @@ -33,8 +33,9 @@ namespace System.Diagnostics } } - public virtual EventLogEntry this [int index] { - get {return (EventLogEntry) List[index];} + public EventLogPermissionEntry this [int index] { + get { return ((EventLogPermissionEntry) List[index]); } + set { List[index] = value; } } public int Add(EventLogPermissionEntry value) diff --git a/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs index bd19ad42399..fd4f7f6b723 100644 --- a/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs +++ b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs @@ -17,7 +17,7 @@ using System.Diagnostics; namespace System.Diagnostics { - public class EventLogTraceListener : TraceListener + public sealed class EventLogTraceListener : TraceListener { private EventLog eventLog; private string source; diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounter.cs b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs index dca3b0e48c4..5223698ccd4 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounter.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs @@ -90,6 +90,7 @@ namespace System.Diagnostics { // may throw ArgumentNullException [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)] [TypeConverter ("System.Diagnostics.Design.CategoryValueConverter, " + Consts.AssemblySystem_Design)] + [SRDescription ("The category name for this performance counter.")] public string CategoryName { get {return categoryName;} set { @@ -110,6 +111,7 @@ namespace System.Diagnostics { // may throw ArgumentNullException [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)] [TypeConverter ("System.Diagnostics.Design.CounterNameConverter, " + Consts.AssemblySystem_Design)] + [SRDescription ("The name of this performance counter.")] public string CounterName { get {return counterName;} @@ -130,6 +132,7 @@ namespace System.Diagnostics { [DefaultValue (""), ReadOnly (true), RecommendedAsConfigurable (true)] [TypeConverter ("System.Diagnostics.Design.InstanceNameConverter, " + Consts.AssemblySystem_Design)] + [SRDescription ("The instance name for this performance counter.")] public string InstanceName { get {return instanceName;} @@ -139,6 +142,7 @@ namespace System.Diagnostics { // may throw ArgumentException if machine name format is wrong [MonoTODO("What's the machine name format?")] [DefaultValue ("."), Browsable (false), RecommendedAsConfigurable (true)] + [SRDescription ("The machine where this performance counter resides.")] public string MachineName { get {return machineName;} set {machineName = value;} diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs index a98462be1b5..9f1cba30c08 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterType.cs @@ -8,11 +8,12 @@ // using System; -using System.Diagnostics; +using System.ComponentModel; namespace System.Diagnostics { [Serializable] + [TypeConverter (typeof (AlphabeticalEnumConverter))] public enum PerformanceCounterType { NumberOfItemsHEX32=0x00000000, NumberOfItemsHEX64=0x00000100, diff --git a/mcs/class/System/System.Diagnostics/SRDescriptionAttribute.cs b/mcs/class/System/System.Diagnostics/SRDescriptionAttribute.cs new file mode 100644 index 00000000000..1a13053dca6 --- /dev/null +++ b/mcs/class/System/System.Diagnostics/SRDescriptionAttribute.cs @@ -0,0 +1,35 @@ +// +// System.Diagnostics.SRDescriptionAttribute.cs +// +// Authors: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2003 Andreas Nahr +// + +using System; +using System.ComponentModel; + +namespace System.Diagnostics +{ + [AttributeUsage(AttributeTargets.All)] + internal class SRDescriptionAttribute : DescriptionAttribute + { + private bool isReplaced = false; + + public SRDescriptionAttribute (string description) + : base (description) + { + } + + public override string Description { + get { + if (!isReplaced) { + isReplaced = true; + DescriptionValue = Locale.GetText (DescriptionValue); + } + return DescriptionValue; + } + } + } +} |