+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
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
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;
}
//
// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Jonathan Pryor
+// (C) 2003 Andreas Nahr
//
using System;
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()); }
+ }
}
}
//
// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002
+// (C) 2003 Andreas Nahr
//
using System;
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);
}
}
}
//
// 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});
+ }
}
}
//
-// 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);
+ }
}
}
//
// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Jonathan Pryor
+// (C) 2003 Andreas Nahr
//
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();
}
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 ();
+ }
}
}
namespace System.Diagnostics {
- public class PerformanceCounterInstaller {
+ internal class PerformanceCounterInstaller {
// [MonoTODO]
// public PerformanceCounterInstaller ()
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 ()
{
//
// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002
+// (C) 2003 Andreas Nahr
//
using System;
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()); }
+ }
}
}
//
// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002
+// (C) 2003 Andreas Nahr
//
using System;
using System.Security;
using System.Security.Permissions;
-namespace System.Diagnostics {
+namespace System.Diagnostics
+{
[AttributeUsage(
AttributeTargets.Assembly |
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);
}
}
}
//
// 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});
+ }
}
}
//
// 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] {