diff options
author | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-14 02:09:12 +0400 |
---|---|---|
committer | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-14 02:09:12 +0400 |
commit | 78dc7ab616ff9c86f63ba9eb79bccba9bad6d754 (patch) | |
tree | 9a5fe7b4ff9976378c0df1650441764c53945fb8 /mcs/class/System/System.Diagnostics | |
parent | 5bc39e4713ae8656b8039516d71fb2ab66d258af (diff) |
2003-07-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* DiagnosticsConfigurationHandler.cs: Removed a never used variable
* EventLog.cs: Small update to prevent a warning
* EventLogPermission.cs: Implemented or implementation added
* EventLogPermissionAttribute.cs: Implemented or implementation added
* EventLogPermissionEntry.cs: Implemented or implementation added
* EventLogPermissionEntryCollection.cs: Implemented or implementation added
* EventLogTraceListener.cs: Implemented or implementation added
* PerformanceCounterManager.cs: Implemented or implementation added
* PerformanceCounterInstaller.cs: Made internal
* PerformanceCounterCategory.cs: Implemented few members
* PerformanceCounterPermission.cs: Implemented or implementation added
* PerformanceCounterPermissionAttribute.cs: Implemented or implementation added
* PerformanceCounterPermissionEntry.cs: Implemented or implementation added
* PerformanceCounterPermissionEntryCollection.cs: Implemented or implementation added
svn path=/trunk/mcs/; revision=16177
Diffstat (limited to 'mcs/class/System/System.Diagnostics')
15 files changed, 540 insertions, 455 deletions
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog index 39b9daa596d..5909a53d2b3 100644 --- a/mcs/class/System/System.Diagnostics/ChangeLog +++ b/mcs/class/System/System.Diagnostics/ChangeLog @@ -1,3 +1,20 @@ +2003-07-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * DiagnosticsConfigurationHandler.cs: Removed a never used variable + * EventLog.cs: Small update to prevent a warning + * EventLogPermission.cs: Implemented or implementation added + * EventLogPermissionAttribute.cs: Implemented or implementation added + * EventLogPermissionEntry.cs: Implemented or implementation added + * EventLogPermissionEntryCollection.cs: Implemented or implementation added + * EventLogTraceListener.cs: Implemented or implementation added + * PerformanceCounterManager.cs: Implemented or implementation added + * PerformanceCounterInstaller.cs: Made internal + * PerformanceCounterCategory.cs: Implemented few members + * PerformanceCounterPermission.cs: Implemented or implementation added + * PerformanceCounterPermissionAttribute.cs: Implemented or implementation added + * PerformanceCounterPermissionEntry.cs: Implemented or implementation added + * PerformanceCounterPermissionEntryCollection.cs: Implemented or implementation added + 2003-07-07 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * EventLog.cs: Removed unneccesary attribute according to corecompare diff --git a/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs index 37125a66acf..c4e9647def2 100644 --- a/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs +++ b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs @@ -274,7 +274,7 @@ namespace System.Diagnostics try {
TraceImpl.Listeners.Remove (name);
}
- catch (ArgumentException e) {
+ catch (ArgumentException) {
// The specified listener wasn't in the collection
// Ignore this; .NET does.
}
diff --git a/mcs/class/System/System.Diagnostics/EventLog.cs b/mcs/class/System/System.Diagnostics/EventLog.cs index 079d097ab71..3553e2ec9b8 100644 --- a/mcs/class/System/System.Diagnostics/EventLog.cs +++ b/mcs/class/System/System.Diagnostics/EventLog.cs @@ -285,6 +285,12 @@ namespace System.Diagnostics { throw new NotImplementedException (); } + internal void OnEntryWritten (EventLogEntry newEntry) + { + if (EntryWritten != null) + EntryWritten (this, new EntryWrittenEventArgs (newEntry)); + } + [MonitoringDescription ("Raised for each eventlog entry written.")] public event EntryWrittenEventHandler EntryWritten; } diff --git a/mcs/class/System/System.Diagnostics/EventLogPermission.cs b/mcs/class/System/System.Diagnostics/EventLogPermission.cs index 1858ab6794a..8b858fbf88f 100644 --- a/mcs/class/System/System.Diagnostics/EventLogPermission.cs +++ b/mcs/class/System/System.Diagnostics/EventLogPermission.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Jonathan Pryor +// (C) 2003 Andreas Nahr // using System; @@ -14,37 +16,34 @@ using System.Security.Permissions; namespace System.Diagnostics { [Serializable] - [MonoTODO("Just Stubbed Out")] - public class EventLogPermission -// : ResourcePermissionBase + public sealed class EventLogPermission : ResourcePermissionBase { -// [MonoTODO] -// public EventLogPermission() -// { -// } -// -// [MonoTODO] -// public EventLogPermission( -// EventLogPermissionEntry[] permissionAccessEntries) -// { -// } -// -// [MonoTODO] -// public EventLogPermission(PermissionState state) -// { -// } -// -// [MonoTODO] -// public EventLogPermission( -// EventLogPermissionAccess permissionAccess, -// string machineName) -// { -// } -// -// [MonoTODO] -// public EventLogPermissionEntryCollection PermissionEntries { -// get {throw new NotImplementedException();} -// } + + public EventLogPermission() + { + } + + public EventLogPermission (EventLogPermissionEntry[] permissionAccessEntries) + { + if (permissionAccessEntries == null) + throw new ArgumentNullException("permissionAccessEntries"); + foreach (EventLogPermissionEntry entry in permissionAccessEntries) + AddPermissionAccess (entry.CreateResourcePermissionBaseEntry ()); + } + + public EventLogPermission (PermissionState state) + : base (state) + { + } + + public EventLogPermission (EventLogPermissionAccess permissionAccess, string machineName) + { + AddPermissionAccess (new EventLogPermissionEntry (permissionAccess, machineName).CreateResourcePermissionBaseEntry ()); + } + + public EventLogPermissionEntryCollection PermissionEntries { + get {return new EventLogPermissionEntryCollection (base.GetPermissionEntries()); } + } } } diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs index 17eb6ca9935..d6db335d9df 100644 --- a/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs +++ b/mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; @@ -12,36 +14,46 @@ using System.Diagnostics; using System.Security; using System.Security.Permissions; -namespace System.Diagnostics { +namespace System.Diagnostics +{ [AttributeUsage( AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Event)] [Serializable] - [MonoTODO("Just Stubbed Out")] - public class EventLogPermissionAttribute : CodeAccessSecurityAttribute { + public class EventLogPermissionAttribute : CodeAccessSecurityAttribute + { + private string machineName; + private EventLogPermissionAccess permissionAccess; public EventLogPermissionAttribute(SecurityAction action) : base(action) { + machineName = "."; + permissionAccess = EventLogPermissionAccess.Browse; + } + + // May throw ArgumentException if computer name is invalid + public string MachineName { + get {return machineName;} + set { + // TODO check machine name + machineName = value; + } + } + + public EventLogPermissionAccess PermissionAccess { + get {return permissionAccess;} + set {permissionAccess = value;} } -// // May throw ArgumentException if computer name is invalid -// public string MachineName { -// get {throw new NotImplementedException();} -// set {throw new NotImplementedException();} -// } -// -// public EventLogPermissionAccess PermissionAccess { -// get {throw new NotImplementedException();} -// set {throw new NotImplementedException();} -// } -// - [MonoTODO] public override IPermission CreatePermission() { - throw new NotImplementedException(); + if (base.Unrestricted) { + return new EventLogPermission (PermissionState.Unrestricted); + } + return new EventLogPermission (PermissionAccess, MachineName); } } } diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs index efcbbc2016f..1e2e9867822 100644 --- a/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs +++ b/mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs @@ -3,35 +3,44 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; using System.Diagnostics; +using System.Security.Permissions; -namespace System.Diagnostics { - +namespace System.Diagnostics +{ [Serializable] - [MonoTODO("Just Stubbed Out")] - public class EventLogPermissionEntry { + public class EventLogPermissionEntry + { + private EventLogPermissionAccess permissionAccess; + private string machineName; -// [MonoTODO] -// public EventLogPermissionEntry( -// EventLogPermissionAccess permissionAccess, -// string machineName) -// { -// } -// -// [MonoTODO] -// public string MachineName { -// get {throw new NotImplementedException();} -// } -// -// [MonoTODO] -// public EventLogPermissionAccess PermissionAccess { -// get {throw new NotImplementedException();} -// } + public EventLogPermissionEntry ( + EventLogPermissionAccess permissionAccess, + string machineName) + { + this.permissionAccess = permissionAccess; + this.machineName = machineName; + } + + public string MachineName { + get {return machineName; } + } + + public EventLogPermissionAccess PermissionAccess { + get {return permissionAccess; } + } + + internal ResourcePermissionBaseEntry CreateResourcePermissionBaseEntry () + { + return new ResourcePermissionBaseEntry ((int) permissionAccess, new string[] {machineName}); + } } } diff --git a/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs index e078af0a509..cd2da3fe82b 100644 --- a/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs +++ b/mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs @@ -1,104 +1,108 @@ // -// System.Diagnostics.EventLogEntryCollection.cs +// System.Diagnostics.EventLogPermissionEntryCollection.cs // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Jonathan Pryor +// (C) 2003 Andreas Nahr // using System; using System.Collections; using System.Diagnostics; +using System.Security.Permissions; -namespace System.Diagnostics { +namespace System.Diagnostics +{ - [MonoTODO] - public class EventLogPermissionEntryCollection : CollectionBase { + [Serializable] + public class EventLogPermissionEntryCollection : CollectionBase + { + + private EventLogPermissionEntryCollection() + { + } + + internal EventLogPermissionEntryCollection (ResourcePermissionBaseEntry[] entries) + { + foreach (ResourcePermissionBaseEntry entry in entries) { + List.Add (new EventLogPermissionEntry ((EventLogPermissionAccess) entry.PermissionAccess, entry.PermissionAccessPath[0])); + } + } + + public virtual EventLogEntry this [int index] { + get {return (EventLogEntry) List[index];} + } + + public int Add(EventLogPermissionEntry value) + { + return List.Add (value); + } + + public void AddRange(EventLogPermissionEntry[] value) + { + foreach (EventLogPermissionEntry entry in value) + List.Add (entry); + } + + public void AddRange(EventLogPermissionEntryCollection value) + { + foreach (EventLogPermissionEntry entry in value) + List.Add (entry); + } + + public bool Contains(EventLogPermissionEntry value) + { + return List.Contains (value); + } + + public void CopyTo(EventLogPermissionEntry[] array, int index) + { + List.CopyTo (array, index); + } + + public int IndexOf(EventLogPermissionEntry value) + { + return List.IndexOf (value); + } + + public void Insert(int index, EventLogPermissionEntry value) + { + List.Insert (index, value); + } [MonoTODO] - internal EventLogPermissionEntryCollection() + protected override void OnClear() { + throw new NotImplementedException(); } -// [MonoTODO] -// public virtual EventLogEntry this [int index] { -// get {throw new NotImplementedException();} -// } -// -// [MonoTODO] -// public int Add(EventLogPermissionEntry value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public void AddRange(EventLogPermissionEntry[] value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public void AddRange(EventLogPermissionEntryCollection value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public bool Contains(EventLogPermissionEntry value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public void CopyTo(EventLogPermissionEntry[] array, int index) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public int IndexOf(EventLogPermissionEntry value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public void Insert(int index, EventLogPermissionEntry value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// protected override void OnClear() -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// protected override void OnInsert(int index, object value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// protected override void OnRemove(int index, object value) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// protected override void OnSet(int index, object oldValue, -// object newValue) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public void Remove(EventLogPermissionEntry value) -// { -// throw new NotImplementedException(); -// } + [MonoTODO] + protected override void OnInsert(int index, object value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + protected override void OnRemove(int index, object value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + protected override void OnSet(int index, object oldValue, + object newValue) + { + throw new NotImplementedException(); + } + + public void Remove(EventLogPermissionEntry value) + { + List.Remove (value); + } } } diff --git a/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs index 56115b44522..bd19ad42399 100644 --- a/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs +++ b/mcs/class/System/System.Diagnostics/EventLogTraceListener.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Jonathan Pryor +// (C) 2003 Andreas Nahr // @@ -12,61 +14,58 @@ using System; using System.Collections; using System.Diagnostics; -namespace System.Diagnostics { +namespace System.Diagnostics +{ - [MonoTODO] - public class EventLogTraceListener : TraceListener { + public class EventLogTraceListener : TraceListener + { + private EventLog eventLog; + private string source; + + public EventLogTraceListener () + { + } + + public EventLogTraceListener (EventLog eventLog) + { + this.eventLog = eventLog; + } + + public EventLogTraceListener (string source) + { + this.source = source; + } + + public EventLog EventLog { + get {return eventLog;} + set {eventLog = value;} + } + + public override string Name { + get {return source;} + set {source = value;} + } + + [MonoTODO] + public override void Close () + { + throw new NotImplementedException(); + } + + [MonoTODO] + protected override void Dispose (bool disposing) + { + throw new NotImplementedException(); + } -// [MonoTODO] -// public EventLogTraceListener() -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public EventLogTraceListener(EventLog eventLog) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public EventLogTraceListener(string source) -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// public EventLog EventLog { -// get {throw new NotImplementedException();} -// set {throw new NotImplementedException();} -// } -// -// [MonoTODO] -// public override string Name { -// get {throw new NotImplementedException();} -// set {throw new NotImplementedException();} -// } -// -// [MonoTODO] -// public override void Close() -// { -// throw new NotImplementedException(); -// } -// -// [MonoTODO] -// protected override void Dispose(bool disposing) -// { -// throw new NotImplementedException(); -// } -// [MonoTODO] - public override void Write(string message) + public override void Write (string message) { throw new NotImplementedException(); } [MonoTODO] - public override void WriteLine(string message) + public override void WriteLine (string message) { throw new NotImplementedException(); } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs index 8d7a8e4a5cb..cc8c194c8b9 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs @@ -10,173 +10,184 @@ using System; using System.Diagnostics; -namespace System.Diagnostics { +namespace System.Diagnostics +{ - public class PerformanceCounterCategory { + public sealed class PerformanceCounterCategory + { + private string categoryName; + private string machineName; -// [MonoTODO] -// public PerformanceCounterCategory () -// { -// throw new NotImplementedException (); -// } -// -// // may throw ArgumentException (""), ArgumentNullException -// [MonoTODO] -// public PerformanceCounterCategory (string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// // may throw ArgumentException (""), ArgumentNullException -// [MonoTODO] -// public PerformanceCounterCategory (string categoryName, -// string machineName) -// { -// throw new NotImplementedException (); -// } -// -// // may throw InvalidOperationException, Win32Exception -// [MonoTODO] -// public string CategoryHelp { -// get {throw new NotImplementedException ();} -// } -// -// // may throw ArgumentException (""), ArgumentNullException -// [MonoTODO] -// public string CategoryName { -// get {throw new NotImplementedException ();} -// set {throw new NotImplementedException ();} -// } -// -// // may throw ArgumentException -// [MonoTODO] -// public string MachineName { -// get {throw new NotImplementedException ();} -// set {throw new NotImplementedException ();} -// } -// -// // may throw ArgumentNullException, InvalidOperationException -// // (categoryName isn't set), Win32Exception -// [MonoTODO] -// public bool CounterExists (string counterName) -// { -// throw new NotImplementedException (); -// } -// -// // may throw ArgumentNullException, InvalidOperationException -// // (categoryName is ""), Win32Exception -// [MonoTODO] -// public bool CounterExists (string counterName, -// string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// // may throw ArgumentNullException, InvalidOperationException -// // (categoryName is "", machine name is bad), Win32Exception -// [MonoTODO] -// public bool CounterExists (string counterName, -// string categoryName, -// string machineName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static PerformanceCounterCategory Create ( -// string categoryName, -// string categoryHelp, -// CounterCreationDataCollection counterData) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static PerformanceCounterCategory Create ( -// string categoryName, -// string categoryHelp, -// string counterName, -// string counterHelp) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static void Delete (string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static bool Exists (string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static bool Exists (string categoryName, -// string machineName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static PerformanceCounterCategory[] GetCategories () -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public static PerformanceCounterCategory[] GetCategories ( -// string machineName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public PerformanceCounter[] GetCounters () -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public PerformanceCounter[] GetCounters (string instanceName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public string[] GetInstanceNames () -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public bool InstanceExists (string instanceName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public bool InstanceExists (string instanceName, -// string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public bool InstanceExists (string instanceName, -// string categoryName, -// string machineName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public InstanceDataCollectionCollection ReadCategory () -// { -// throw new NotImplementedException (); -// } + public PerformanceCounterCategory () + : this ("", ".") + { + } + + // may throw ArgumentException (""), ArgumentNullException + public PerformanceCounterCategory (string categoryName) + : this (categoryName, ".") + { + } + + // may throw ArgumentException (""), ArgumentNullException + [MonoTODO] + public PerformanceCounterCategory (string categoryName, + string machineName) + { + // TODO checks and whatever else is needed + this.categoryName = categoryName; + this.machineName = machineName; + throw new NotImplementedException (); + } + + // may throw InvalidOperationException, Win32Exception + [MonoTODO] + public string CategoryHelp { + get {throw new NotImplementedException ();} + } + + // may throw ArgumentException (""), ArgumentNullException + [MonoTODO] + public string CategoryName { + get {return categoryName;} + set { + // TODO needs validity checks + categoryName = value; + } + } + + // may throw ArgumentException + [MonoTODO] + public string MachineName { + get {return machineName;} + set { + // TODO needs validity checks + machineName = value; + } + } + + // may throw ArgumentNullException, InvalidOperationException + // (categoryName isn't set), Win32Exception + [MonoTODO] + public bool CounterExists (string counterName) + { + throw new NotImplementedException (); + } + + // may throw ArgumentNullException, InvalidOperationException + // (categoryName is ""), Win32Exception + [MonoTODO] + public bool CounterExists (string counterName, + string categoryName) + { + throw new NotImplementedException (); + } + + // may throw ArgumentNullException, InvalidOperationException + // (categoryName is "", machine name is bad), Win32Exception + [MonoTODO] + public bool CounterExists (string counterName, + string categoryName, + string machineName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PerformanceCounterCategory Create ( + string categoryName, + string categoryHelp, + CounterCreationDataCollection counterData) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PerformanceCounterCategory Create ( + string categoryName, + string categoryHelp, + string counterName, + string counterHelp) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static void Delete (string categoryName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static bool Exists (string categoryName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static bool Exists (string categoryName, + string machineName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PerformanceCounterCategory[] GetCategories () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PerformanceCounterCategory[] GetCategories ( + string machineName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public PerformanceCounter[] GetCounters () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public PerformanceCounter[] GetCounters (string instanceName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public string[] GetInstanceNames () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool InstanceExists (string instanceName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool InstanceExists (string instanceName, + string categoryName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool InstanceExists (string instanceName, + string categoryName, + string machineName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public InstanceDataCollectionCollection ReadCategory () + { + throw new NotImplementedException (); + } } } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs index f6183e9e168..8752dfd29d6 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs @@ -15,7 +15,7 @@ using System.ComponentModel; namespace System.Diagnostics { - public class PerformanceCounterInstaller { + internal class PerformanceCounterInstaller { // [MonoTODO] // public PerformanceCounterInstaller () diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs index 629bb3f545c..134006e5ab8 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs @@ -14,15 +14,14 @@ using System.Runtime.InteropServices; namespace System.Diagnostics { [ComVisible(true)] - // [Guid("")] - public class PerformanceCounterManager : ICollectData { + [Guid("82840be1-d273-11d2-b94a-00600893b17a")] + public sealed class PerformanceCounterManager : ICollectData { + + [MonoTODO] + public PerformanceCounterManager () + { + } -// [MonoTODO] -// public PerformanceCounterManager () -// { -// throw new NotImplementedException (); -// } -// [MonoTODO] void ICollectData.CloseData () { diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs index d858df63345..a783e319011 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; @@ -13,33 +15,37 @@ using System.Security.Permissions; namespace System.Diagnostics { - public class PerformanceCounterPermission : ResourcePermissionBase { + [Serializable] + public sealed class PerformanceCounterPermission : ResourcePermissionBase { -// public PerformaceCounterPermission () -// { -// } -// -// public PerformaceCounterPermission ( -// PerformanceCounterPermissionEntry[] -// permissionAccessEntries) -// { -// } -// -// public PerformaceCounterPermission (PermissionState state) -// { -// } -// -// public PerformaceCounterPermission ( -// PerformanceCounterPermissionAccess permissionAccess, -// string machineName, -// string categoryName) -// { -// } -// -// public PerformanceCounterPermissionEntryCollection -// PermissionEntries { -// get {throw new NotImplementedException ();} -// } + public PerformanceCounterPermission () + { + } + + public PerformanceCounterPermission (PerformanceCounterPermissionEntry[] permissionAccessEntries) + { + if (permissionAccessEntries == null) + throw new ArgumentNullException("permissionAccessEntries"); + foreach (PerformanceCounterPermissionEntry entry in permissionAccessEntries) + AddPermissionAccess (entry.CreateResourcePermissionBaseEntry ()); + } + + public PerformanceCounterPermission (PermissionState state) + : base (state) + { + } + + public PerformanceCounterPermission ( + PerformanceCounterPermissionAccess permissionAccess, + string machineName, + string categoryName) + { + AddPermissionAccess (new PerformanceCounterPermissionEntry (permissionAccess, machineName, categoryName).CreateResourcePermissionBaseEntry ()); + } + + public PerformanceCounterPermissionEntryCollection PermissionEntries { + get {return new PerformanceCounterPermissionEntryCollection (base.GetPermissionEntries()); } + } } } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs index 9a011050368..739e20fa7a2 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; @@ -12,7 +14,8 @@ using System.Diagnostics; using System.Security; using System.Security.Permissions; -namespace System.Diagnostics { +namespace System.Diagnostics +{ [AttributeUsage( AttributeTargets.Assembly | @@ -21,40 +24,46 @@ namespace System.Diagnostics { AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Event )] - [MonoTODO] - public class PerformanceCounterPermissionAttribute - : CodeAccessSecurityAttribute { + [Serializable] + public class PerformanceCounterPermissionAttribute : CodeAccessSecurityAttribute + { + private string categoryName; + private string machineName; + private PerformanceCounterPermissionAccess permissionAccess; - [MonoTODO] - public PerformanceCounterPermissionAttribute ( - SecurityAction action) + public PerformanceCounterPermissionAttribute (SecurityAction action) : base (action) { - throw new NotImplementedException (); + categoryName = "*"; + machineName = "."; + permissionAccess = PerformanceCounterPermissionAccess.Browse; + } + + public string CategoryName { + get {return categoryName;} + set {categoryName = value;} + } + + // May throw ArgumentException if computer name is invalid + public string MachineName { + get {return machineName;} + set { + // TODO check machine name + machineName = value; + } + } + + public PerformanceCounterPermissionAccess PermissionAccess { + get {return permissionAccess;} + set {permissionAccess = value;} } -// [MonoTODO] -// public string CategoryName { -// get {throw new NotImplementedException ();} -// set {throw new NotImplementedException ();} -// } -// -// [MonoTODO] -// public string MachineName { -// get {throw new NotImplementedException ();} -// set {throw new NotImplementedException ();} -// } -// -// [MonoTODO] -// public PerformanceCounterPermissionAccess PermissionAccess { -// get {throw new NotImplementedException ();} -// set {throw new NotImplementedException ();} -// } -// - [MonoTODO] public override IPermission CreatePermission () { - throw new NotImplementedException (); + if (base.Unrestricted) { + return new PerformanceCounterPermission (PermissionState.Unrestricted); + } + return new PerformanceCounterPermission (PermissionAccess, MachineName, categoryName); } } } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs index ae2cd93ff95..dcfc2dc1468 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs @@ -3,42 +3,51 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; using System.Diagnostics; +using System.Security.Permissions; -namespace System.Diagnostics { - +namespace System.Diagnostics +{ [Serializable] - [MonoTODO] - public class PerformanceCounterPermissionEntry { - -// [MonoTODO] -// public PerformanceCounterPermissionEntry ( -// PerformanceCounterPermissionAccess permissionAccess, -// string machineName, -// string categoryName) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// public string CategoryName { -// get {throw new NotImplementedException ();} -// } -// -// [MonoTODO] -// public string MachineName { -// get {throw new NotImplementedException ();} -// } -// -// [MonoTODO] -// public PerformanceCounterPermissionAccess PermissionAccess { -// get {throw new NotImplementedException ();} -// } + public class PerformanceCounterPermissionEntry + { + private PerformanceCounterPermissionAccess permissionAccess; + private string machineName; + private string categoryName; + + public PerformanceCounterPermissionEntry ( + PerformanceCounterPermissionAccess permissionAccess, + string machineName, + string categoryName) + { + this.permissionAccess = permissionAccess; + this.machineName = machineName; + this.categoryName = categoryName; + } + + public string CategoryName { + get {return categoryName; } + } + + public string MachineName { + get {return machineName; } + } + + public PerformanceCounterPermissionAccess PermissionAccess { + get {return permissionAccess; } + } + + internal ResourcePermissionBaseEntry CreateResourcePermissionBaseEntry () + { + return new ResourcePermissionBaseEntry ((int) permissionAccess, new string[] {machineName, categoryName}); + } } } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs index 818c3886a7e..06092dcbbf3 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs @@ -3,23 +3,28 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; using System.Diagnostics; using System.Collections; using System.Globalization; +using System.Security.Permissions; namespace System.Diagnostics { [Serializable] - public class PerformanceCounterPermissionEntryCollection - : CollectionBase + public class PerformanceCounterPermissionEntryCollection : CollectionBase { - internal PerformanceCounterPermissionEntryCollection () + internal PerformanceCounterPermissionEntryCollection (ResourcePermissionBaseEntry[] entries) { + foreach (ResourcePermissionBaseEntry entry in entries) { + List.Add (new PerformanceCounterPermissionEntry ((PerformanceCounterPermissionAccess) entry.PermissionAccess, entry.PermissionAccessPath[0], entry.PermissionAccessPath[1])); + } } public PerformanceCounterPermissionEntry this [int index] { |