2003-07-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
authorAndreas N <andreas@mono-cvs.ximian.com>
Sun, 13 Jul 2003 22:09:12 +0000 (22:09 -0000)
committerAndreas N <andreas@mono-cvs.ximian.com>
Sun, 13 Jul 2003 22:09:12 +0000 (22:09 -0000)
* 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

15 files changed:
mcs/class/System/System.Diagnostics/ChangeLog
mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
mcs/class/System/System.Diagnostics/EventLog.cs
mcs/class/System/System.Diagnostics/EventLogPermission.cs
mcs/class/System/System.Diagnostics/EventLogPermissionAttribute.cs
mcs/class/System/System.Diagnostics/EventLogPermissionEntry.cs
mcs/class/System/System.Diagnostics/EventLogPermissionEntryCollection.cs
mcs/class/System/System.Diagnostics/EventLogTraceListener.cs
mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs
mcs/class/System/System.Diagnostics/PerformanceCounterInstaller.cs
mcs/class/System/System.Diagnostics/PerformanceCounterManager.cs
mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs
mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAttribute.cs
mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntry.cs
mcs/class/System/System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs

index 39b9daa596d3ac2a02caa4205c8ddc8891c24a76..5909a53d2b37b3c3264d1651a74306dba5d473cb 100644 (file)
@@ -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
index 37125a66acfc911c93942ba7d754739597882f6e..c4e9647def241186144de1a8a3cb51c6a0006c9a 100644 (file)
@@ -274,7 +274,7 @@ namespace System.Diagnostics
                        try {\r
                                TraceImpl.Listeners.Remove (name);\r
                        }\r
-                       catch (ArgumentException e) {\r
+                       catch (ArgumentException) {\r
                                // The specified listener wasn't in the collection\r
                                // Ignore this; .NET does.\r
                        }\r
index 079d097ab71c7d4c1a0539864c63f2a2b32c1c27..3553e2ec9b849b99fe1fc0b96df9a8705b1d7303 100644 (file)
@@ -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;
        }
index 1858ab6794af1baaa83f3dd17e965c35e2bfc54f..8b858fbf88ff11bf11e0dd5360b7e959ce394257 100644 (file)
@@ -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()); }
+               }
        }
 }
 
index 17eb6ca99357b357460917851e15c186bd9f4a63..d6db335d9dfca57119106d889772d1ac813c8088 100644 (file)
@@ -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); 
                }
        }
 }
index efcbbc2016ffff15b76c0aa5fd514a6eb2251d10..1e2e9867822f8e6f72338de5b96be600fd33788c 100644 (file)
@@ -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});
+               } 
        }
 }
 
index e078af0a5090523ef7cb6639ed60540bf3cbdcd3..cd2da3fe82b210dfd4e9e6af29c639408a0a82cd 100644 (file)
 //
-// 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);
+               }
        }
 }
 
index 56115b44522be6b273dd76e0a6e08740794a599a..bd19ad42399ae9f7837a9b1e348ded188e615039 100644 (file)
@@ -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();
                }
index 8d7a8e4a5cb229b44dbc099c7676fa1c5b11fd27..cc8c194c8b92e7a81dfe4008103f25e88964eeb6 100644 (file)
 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 ();
+               }
        }
 }
 
index f6183e9e168099507cc5dd3ab1e7a76404139e59..8752dfd29d60835c72dde9395ab466476227dc20 100644 (file)
@@ -15,7 +15,7 @@ using System.ComponentModel;
 
 namespace System.Diagnostics {
 
-       public class PerformanceCounterInstaller {
+       internal class PerformanceCounterInstaller {
 
 //             [MonoTODO]
 //             public PerformanceCounterInstaller ()
index 629bb3f545c99fd93f57f09ffe0b9fb00279fac3..134006e5ab812a842b6e5a6da62f62ed300301da 100644 (file)
@@ -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 ()
                {
index d858df63345b2c8efd6ddebb283671129be17360..a783e319011c6de9b6b000fa546a114fe90144d0 100644 (file)
@@ -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()); }
+               }
        }
 }
 
index 9a01105036865db4d9f4211b2b4aee845b24eb70..739e20fa7a2947e62b8182a1f2124a4c3eaa265c 100644 (file)
@@ -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); 
                }
        }
 }
index ae2cd93ff9518a0bf3e7e446b64f49c2e899b352..dcfc2dc14689e86bb6e35aff896e93dc71d9dde9 100644 (file)
@@ -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});
+               } 
        }
 }
 
index 818c3886a7e9c2a548c3df96fe7dcbdb7bbc32c0..06092dcbbf38e3756ad006fb779a8a781eacc9b3 100644 (file)
@@ -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] {