dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics AlphabeticalEnumCo


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics AlphabeticalEnumConverter.cs, NONE, 1.1 DiagnosticsConfigurationHandler.cs, NONE, 1.1 PerformanceCounterPermission.cs, NONE, 1.1 PerformanceCounterPermissionAttribute.cs, NONE, 1.1 PerformanceCounterPermissionEntry.cs, NONE, 1.1 PerformanceCounterPermissionEntryCollection.cs, NONE, 1.1 DefaultTraceListener.cs, 1.4, 1.5 EventLog.cs, 1.3, 1.4 EventLogEntry.cs, 1.4, 1.5 EventLogEntryCollection.cs, 1.3, 1.4 PerformanceCounter.cs, 1.3, 1.4 PerformanceCounterType.cs, 1.2, 1.3
Date: Wed, 17 Sep 2003 00:50:57 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics
In directory subversions:/tmp/cvs-serv16997/System/Diagnostics

Modified Files:
        DefaultTraceListener.cs EventLog.cs EventLogEntry.cs 
        EventLogEntryCollection.cs PerformanceCounter.cs 
        PerformanceCounterType.cs 
Added Files:
        AlphabeticalEnumConverter.cs 
        DiagnosticsConfigurationHandler.cs 
        PerformanceCounterPermission.cs 
        PerformanceCounterPermissionAttribute.cs 
        PerformanceCounterPermissionEntry.cs 
        PerformanceCounterPermissionEntryCollection.cs 
Log Message:


Missing functionality and signature-compatibility for the
"System.Diagnostics" namespace.


--- NEW FILE ---
/*
 * AlphabeticalEnumConverter.cs - Implementation of the
 *              
"System.ComponentModel.ComponentModel.AlphabeticalEnumConverter" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

using System.ComponentModel;

internal sealed class AlphabeticalEnumConverter : EnumConverter
{
        // Constructor.
        public AlphabeticalEnumConverter()
                        : base(typeof(PerformanceCounterType)) {}

}; // class AlphabeticalEnumConverter

#endif // CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * DiagnosticsConfigurationHandler.cs - Implementation of the
 *              "System.Diagnostics.DiagnosticsConfigurationHandler" interface.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_EXTENDED_DIAGNOSTICS

using System;
using System.Xml;
using System.Configuration;

public class DiagnosticsConfigurationHandler : IConfigurationSectionHandler
{
        // Constructor.
        public DiagnosticsConfigurationHandler() {}

#if SECOND_PASS

        // Create a configuration object for a section.
        [TODO]
        public Object Create(Object parent, Object configContext, XmlNode 
section)
                        {
                                // TODO
                                return null;
                        }

#endif // SECOND_PASS

}; // class DiagnosticsConfigurationHandler

#endif // CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * PerformanceCounterPermission.cs - Implementation of the
 *                      "System.Diagnostics.PerformanceCounterPermission" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

using System.Security.Permissions;

[Serializable]
public sealed class PerformanceCounterPermission : ResourcePermissionBase
{
        // Constructors.
        public PerformanceCounterPermission() : this(PermissionState.None) {}
        public PerformanceCounterPermission(PermissionState state)
                        : base(state)
                        {
                                PermissionAccessType =
                                        
typeof(PerformanceCounterPermissionAccess);
                                TagNames = new String [] {"Machine", 
"Category"};
                        }
        public PerformanceCounterPermission
                                (PerformanceCounterPermissionEntry[] 
permissionAccessEntries)
                        : this(PermissionState.None)
                        {
                                foreach(PerformanceCounterPermissionEntry entry 
in
                                                        permissionAccessEntries)
                                {
                                        
AddPermissionAccess(entry.ToResourceEntry());
                                }
                        }
        public PerformanceCounterPermission
                                (PerformanceCounterPermissionAccess 
permissionAccess,
                                 String machineName, String categoryName)
                        : this(PermissionState.None)
                        {
                                AddPermissionAccess
                                        (new PerformanceCounterPermissionEntry
                                                        (permissionAccess, 
machineName, categoryName)
                                                .ToResourceEntry());
                        }

        // Get the permission entries in this collection.
        public PerformanceCounterPermissionEntryCollection PermissionEntries
                        {
                                get
                                {
                                        
PerformanceCounterPermissionEntryCollection coll;
                                        coll = new 
PerformanceCounterPermissionEntryCollection
                                                (this);
                                        ResourcePermissionBaseEntry[] entries;
                                        entries = GetPermissionEntries();
                                        
foreach(PerformanceCounterPermissionEntry
                                                                
.PerformanceCounterPermissionResourceEntry
                                                                        entry 
in entries)
                                        {
                                                coll.AddDirect(entry.ToEntry());
                                        }
                                        return coll;
                                }
                        }

        // Helper methods for "PerformanceCounterPermissionEntryCollection".
        internal new void Clear()
                        {
                                base.Clear();
                        }
        internal void Add(PerformanceCounterPermissionEntry entry)
                        {
                                AddPermissionAccess(entry.ToResourceEntry());
                        }
        internal void Remove(PerformanceCounterPermissionEntry entry)
                        {
                                RemovePermissionAccess(entry.ToResourceEntry());
                        }

}; // class PerformanceCounterPermission

#endif // CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * PerformanceCounterPermissionAttribute.cs - Implementation of the
 *                      
"System.Diagnostics.PerformanceCounterPermissionAttribute" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

using System.Security;
using System.Security.Permissions;

[Serializable]
[AttributeUsage(AttributeTargets.Assembly |
                                AttributeTargets.Class |
                                AttributeTargets.Struct |
                                AttributeTargets.Constructor |
                                AttributeTargets.Method |
                                AttributeTargets.Event,
                                AllowMultiple=true, Inherited=false)]
public class PerformanceCounterPermissionAttribute
                : CodeAccessSecurityAttribute
{
        // Internal state.
        private String machineName;
        private String categoryName;
        private PerformanceCounterPermissionAccess permissionAccess;

        // Constructors.
        public PerformanceCounterPermissionAttribute(SecurityAction action)
                        : base(action)
                        {
                                machineName = ".";
                                categoryName = "*";
                                permissionAccess = 
PerformanceCounterPermissionAccess.Browse;
                        }

        // Get or set the attribute's properties.
        public String CategoryName
                        {
                                get
                                {
                                        return categoryName;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        categoryName = value;
                                }
                        }
        public String MachineName
                        {
                                get
                                {
                                        return machineName;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        machineName = value;
                                }
                        }
        public PerformanceCounterPermissionAccess PermissionAccess
                        {
                                get
                                {
                                        return permissionAccess;
                                }
                                set
                                {
                                        permissionAccess = value;
                                }
                        }

        // Create a permission object from this attribute.
        public override IPermission CreatePermission()
                        {
                                if(Unrestricted)
                                {
                                        return new PerformanceCounterPermission
                                                (PermissionState.Unrestricted);
                                }
                                else
                                {
                                        return new PerformanceCounterPermission
                                                (permissionAccess, machineName, 
categoryName);
                                }
                        }

}; // class PerformanceCounterPermissionAttribute

#endif // CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * PerformanceCounterPermissionEntry.cs - Implementation of the
 *                      "System.Diagnostics.PerformanceCounterPermissionEntry" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

using System.Security.Permissions;

[Serializable]
public class PerformanceCounterPermissionEntry
{
        // Internal state.
        private PerformanceCounterPermissionAccess access;
        private String machineName;
        private String categoryName;
        private PerformanceCounterPermissionResourceEntry resourceEntry;

        // Constructor.
        public PerformanceCounterPermissionEntry
                                (PerformanceCounterPermissionAccess access,
                                 String machineName, String categoryName)
                        {
                                this.access = access;
                                this.machineName = machineName;
                                this.categoryName = categoryName;
                                resourceEntry = new 
PerformanceCounterPermissionResourceEntry
                                        (this, (int)access,
                                         new String [] {machineName, 
categoryName});
                        }

        // Get this object's properties.
        public String CategoryName
                        {
                                get
                                {
                                        return categoryName;
                                }
                        }
        public String MachineName
                        {
                                get
                                {
                                        return machineName;
                                }
                        }
        public PerformanceCounterPermissionAccess PermissionAccess
                        {
                                get
                                {
                                        return access;
                                }
                        }

        // Convert this object into a resource entry.
        internal ResourcePermissionBaseEntry ToResourceEntry()
                        {
                                return resourceEntry;
                        }

        // Resource wrapper class.
        internal class PerformanceCounterPermissionResourceEntry
                : ResourcePermissionBaseEntry
        {
                // Internal state.
                private PerformanceCounterPermissionEntry entry;

                // Constructor.
                public PerformanceCounterPermissionResourceEntry
                                        (PerformanceCounterPermissionEntry 
entry,
                                         int access, String[] path)
                                : base(access, path)
                                {
                                        this.entry = entry;
                                }

                // Convert this object into an event log permission entry.
                public PerformanceCounterPermissionEntry ToEntry()
                                {
                                        return entry;
                                }

        }; // class PerformanceCounterPermissionResourceEntry

}; // class PerformanceCounterPermissionEntry

#endif // CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * PerformanceCounterPermissionEntryCollection.cs - Implementation of the
 *      "System.Diagnostics.PerformanceCounterPermissionEntryCollection" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

using System.Collections;

[Serializable]
public class PerformanceCounterPermissionEntryCollection : CollectionBase
{
        // Internal state.
        private PerformanceCounterPermission perm;

        // Constructor.
        internal PerformanceCounterPermissionEntryCollection
                                (PerformanceCounterPermission perm)
                        {
                                this.perm = perm;
                        }

        // Get or set a collection member.
        public PerformanceCounterPermissionEntry this[int index]
                        {
                                get
                                {
                                        return 
(PerformanceCounterPermissionEntry)
                                                (((IList)this)[index]);
                                }
                                set
                                {
                                        ((IList)this)[index] = value;
                                }
                        }

        // Add an element to this collection.
        public int Add(PerformanceCounterPermissionEntry value)
                        {
                                return ((IList)this).Add(value);
                        }
        internal void AddDirect(PerformanceCounterPermissionEntry value)
                        {
                                InnerList.Add(value);
                        }

        // Add a range of elements to this collection.
        public void AddRange(PerformanceCounterPermissionEntry[] value)
                        {
                                if(value == null)
                                {
                                        throw new 
ArgumentNullException("value");
                                }
                                foreach(PerformanceCounterPermissionEntry val 
in value)
                                {
                                        Add(val);
                                }
                        }
        public void AddRange(PerformanceCounterPermissionEntryCollection value)
                        {
                                if(value == null)
                                {
                                        throw new 
ArgumentNullException("value");
                                }
                                foreach(PerformanceCounterPermissionEntry val 
in value)
                                {
                                        Add(val);
                                }
                        }

        // Determine if an item exists in this collection.
        public bool Contains(PerformanceCounterPermissionEntry value)
                        {
                                return ((IList)this).Contains(value);
                        }

        // Copy the elements in this collection to an array.
        public void CopyTo(PerformanceCounterPermissionEntry[] array, int index)
                        {
                                ((IList)this).CopyTo(array, index);
                        }

        // Get the index of a specific element in this collection.
        public int IndexOf(PerformanceCounterPermissionEntry value)
                        {
                                return ((IList)this).IndexOf(value);
                        }

        // Insert an element into this collection.
        public void Insert(int index, PerformanceCounterPermissionEntry value)
                        {
                                ((IList)this).Insert(index, value);
                        }

        // Remove an element from this collection.
        public void Remove(PerformanceCounterPermissionEntry value)
                        {
                                ((IList)this).Remove(value);
                        }

        // Detect when the collection is cleared.
        protected override void OnClear()
                        {
                                perm.Clear();
                        }

        // Detect when an item is inserted.
        protected override void OnInsert(int index, Object value)
                        {
                                
perm.Add((PerformanceCounterPermissionEntry)value);
                        }

        // Detect when an item is removed.
        protected override void OnRemove(int index, Object value)
                        {
                                
perm.Remove((PerformanceCounterPermissionEntry)value);
                        }

        // Detect when an item is changed.
        protected override void OnSet(int index, Object oldValue, Object 
newValue)
                        {
                                
perm.Remove((PerformanceCounterPermissionEntry)oldValue);
                                
perm.Add((PerformanceCounterPermissionEntry)newValue);
                        }

}; // class PerformanceCounterPermissionEntryCollection

#endif // CONFIG_PERMISSIONS && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

Index: DefaultTraceListener.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/DefaultTraceListener.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** DefaultTraceListener.cs     31 May 2003 03:32:02 -0000      1.4
--- DefaultTraceListener.cs     17 Sep 2003 04:50:55 -0000      1.5
***************
*** 25,28 ****
--- 25,29 ----
  #if !ECMA_COMPAT
  
+ using System.IO;
  using System.Runtime.InteropServices;
  
***************
*** 38,51 ****
        public DefaultTraceListener() : base("Default") {}
  
!       // Load the configuration settings.
!       private void LoadConfig()
!                       {
!                               if(!loadDone)
!                               {
!                                       // TODO
!                               }
!                       }
! 
!       // Get or set the "UI enabled" flag.
        public bool AssertUiEnabled
                        {
--- 39,43 ----
        public DefaultTraceListener() : base("Default") {}
  
!       // Get or set the "UI enabled" flag (not used in this implementation).
        public bool AssertUiEnabled
                        {
***************
*** 54,58 ****
                                        lock(this)
                                        {
-                                               LoadConfig();
                                                return assertUiEnabled;
                                        }
--- 46,49 ----
***************
*** 62,66 ****
                                        lock(this)
                                        {
-                                               LoadConfig();
                                                assertUiEnabled = value;
                                        }
--- 53,56 ----
***************
*** 75,79 ****
                                        lock(this)
                                        {
-                                               LoadConfig();
                                                return logFileName;
                                        }
--- 65,68 ----
***************
*** 83,87 ****
                                        lock(this)
                                        {
-                                               LoadConfig();
                                                logFileName = value;
                                        }
--- 72,75 ----
***************
*** 120,124 ****
                                lock(this)
                                {
-                                       LoadConfig();
                                        if(NeedIndent)
                                        {
--- 108,111 ----
***************
*** 139,143 ****
                                lock(this)
                                {
-                                       LoadConfig();
                                        if(NeedIndent)
                                        {
--- 126,129 ----
***************
*** 157,163 ****
        private void WriteLog(String message, bool eol)
                        {
!                               // We don't support log files yet, as they are 
not secure.
!                               // This method is a placeholder for a future 
implementation
!                               // should it ever make sense to add this 
feature.
                        }
  
--- 143,161 ----
        private void WriteLog(String message, bool eol)
                        {
!                               if(logFileName != null && logFileName.Length > 
0)
!                               {
!                                       StreamWriter writer = new StreamWriter
!                                               (logFileName, true);
!                                       if(eol)
!                                       {
!                                               writer.WriteLine(message);
!                                       }
!                                       else
!                                       {
!                                               writer.Write(message);
!                                       }
!                                       writer.Flush();
!                                       writer.Close();
!                               }
                        }
  

Index: EventLog.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/EventLog.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** EventLog.cs 29 May 2003 05:38:18 -0000      1.3
--- EventLog.cs 17 Sep 2003 04:50:55 -0000      1.4
***************
*** 26,32 ****
--- 26,37 ----
  
  using System.ComponentModel;
+ using System.Collections;
  using System.Security;
  
  [DefaultEvent("EntryWritten")]
+ #if CONFIG_COMPONENT_MODEL
+ 
[DesignerAttribute("Microsoft.VisualStudio.Install.EventLogInstallableComponentDesigner,
 Microsoft.VisualStudio")]
+ [InstallerType("System.Diagnostics.EventLogInstaller, 
System.Configuration.Install")]
+ #endif
  public class EventLog
  #if CONFIG_COMPONENT_MODEL
***************
*** 39,45 ****
--- 44,52 ----
        private String source;
        private bool enableRaisingEvents;
+       private EventLogEntryCollection entries;
  #if CONFIG_COMPONENT_MODEL
        private ISynchronizeInvoke syncInvoke;
  #endif
+       private static ArrayList logs = new ArrayList();
  
        // Constructor.
***************
*** 61,64 ****
--- 68,72 ----
                                this.machineName = machineName;
                                this.source = (source == null ? "" : source);
+                               this.entries = new EventLogEntryCollection();
                        }
  
***************
*** 81,91 ****
        [Browsable(false)]
        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-       [TODO]
        public EventLogEntryCollection Entries
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                        }
--- 89,97 ----
        [Browsable(false)]
        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public EventLogEntryCollection Entries
                        {
                                get
                                {
!                                       return entries;
                                }
                        }
***************
*** 184,198 ****
  
        // Clear all entries from the event log.
-       [TODO]
        public void Clear()
                        {
!                               // TODO
                        }
  
        // Close this event log.
-       [TODO]
        public void Close()
                        {
!                               // TODO
                        }
  
--- 190,202 ----
  
        // Clear all entries from the event log.
        public void Clear()
                        {
!                               entries.Clear();
                        }
  
        // Close this event log.
        public void Close()
                        {
!                               // Nothing to do here in this implementation.
                        }
  
***************
*** 202,206 ****
                                CreateEventSource(source, logName, ".");
                        }
-       [TODO]
        public static void CreateEventSource
                                (String source, String logName, String 
machineName)
--- 206,209 ----
***************
*** 227,231 ****
                                }
  
!                               // TODO
                        }
  
--- 230,252 ----
                                }
  
!                               // See if we already have a log with this name,
!                               // and bail out if we have.
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Source == source &&
!                                                  log.Log == logName &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       return;
!                                               }
!                                       }
! 
!                                       // Create a new event log on this 
machine.
!                                       EventLog eventLog = new EventLog
!                                               (logName, machineName, source);
!                                       logs.Add(eventLog);
!                               }
                        }
  
***************
*** 235,242 ****
                                Delete(logName, ".");
                        }
-       [TODO]
        public static void Delete(String logName, String machineName)
                        {
!                               // TODO
                        }
  
--- 256,289 ----
                                Delete(logName, ".");
                        }
        public static void Delete(String logName, String machineName)
                        {
!                               // Validate the parameters.
!                               if(logName == null || logName == String.Empty)
!                               {
!                                       throw new 
ArgumentNullException("logName");
!                               }
!                               if(machineName == null)
!                               {
!                                       throw new 
ArgumentNullException("machineName");
!                               }
!                               if(machineName != ".")
!                               {
!                                       throw new SecurityException
!                                               
(S._("Invalid_RemoteEventSource"));
!                               }
! 
!                               // Look for the log and delete it.
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Log == logName &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       logs.Remove(log);
!                                                       return;
!                                               }
!                                       }
!                               }
                        }
  
***************
*** 246,260 ****
                                DeleteEventSource(source, ".");
                        }
-       [TODO]
        public static void DeleteEventSource(String source, String machineName)
                        {
!                               // TODO
                        }
  
        // Dispose of this event log.
-       [TODO]
        protected override void Dispose(bool disposing)
                        {
!                               // TODO
                        }
  
--- 293,332 ----
                                DeleteEventSource(source, ".");
                        }
        public static void DeleteEventSource(String source, String machineName)
                        {
!                               // Validate the parameters.
!                               if(source == null || source == String.Empty)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(machineName == null)
!                               {
!                                       throw new 
ArgumentNullException("machineName");
!                               }
!                               if(machineName != ".")
!                               {
!                                       throw new SecurityException
!                                               
(S._("Invalid_RemoteEventSource"));
!                               }
! 
!                               // Look for the log and delete it.
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Source == source &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       logs.Remove(log);
!                                                       return;
!                                               }
!                                       }
!                               }
                        }
  
        // Dispose of this event log.
        protected override void Dispose(bool disposing)
                        {
!                               // Nothing to do in this implementation.
                        }
  
***************
*** 264,272 ****
                                return Exists(logName, ".");
                        }
-       [TODO]
        public static bool Exists(String logName, String machineName)
                        {
!                               // TODO
!                               return false;
                        }
  
--- 336,353 ----
                                return Exists(logName, ".");
                        }
        public static bool Exists(String logName, String machineName)
                        {
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Log == logName &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       return true;
!                                               }
!                                       }
!                                       return false;
!                               }
                        }
  
***************
*** 276,284 ****
                                return GetEventLogs(".");
                        }
-       [TODO]
        public static EventLog[] GetEventLogs(String machineName)
                        {
!                               // TODO
!                               return new EventLog [0];
                        }
  
--- 357,392 ----
                                return GetEventLogs(".");
                        }
        public static EventLog[] GetEventLogs(String machineName)
                        {
!                               lock(typeof(EventLog))
!                               {
!                                       if(machineName == ".")
!                                       {
!                                               return 
(EventLog[])(logs.ToArray(typeof(EventLog)));
!                                       }
!                                       else
!                                       {
!                                               throw new SecurityException
!                                                       
(S._("Invalid_RemoteEventSource"));
!                                       }
!                               }
!                       }
! 
!       // Get the name of a log given its source name.
!       public static String LogNameFromSourceName
!                               (String source, String machineName)
!                       {
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Source == source &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       return log.Log;
!                                               }
!                                       }
!                                       return null;
!                               }
                        }
  
***************
*** 288,300 ****
                                return SourceExists(source, ".");
                        }
-       [TODO]
        public static bool SourceExists(String source, String machineName)
                        {
!                               // TODO
!                               return false;
                        }
  
        // Write an entry to this event log.
-       [TODO]
        private void WriteEntryToLog(String source, String message,
                                                                 
EventLogEntryType type, int eventID,
--- 396,416 ----
                                return SourceExists(source, ".");
                        }
        public static bool SourceExists(String source, String machineName)
                        {
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Source == source &&
!                                                  log.MachineName == 
machineName)
!                                               {
!                                                       return true;
!                                               }
!                                       }
!                                       return false;
!                               }
                        }
  
        // Write an entry to this event log.
        private void WriteEntryToLog(String source, String message,
                                                                 
EventLogEntryType type, int eventID,
***************
*** 323,327 ****
  
                                // Write the entry to the log.
!                               // TODO
  
                                // Notify the listening event handlers for 
local events.
--- 439,443 ----
  
                                // Write the entry to the log.
!                               entries.Add(entry);
  
                                // Notify the listening event handlers for 
local events.
***************
*** 382,392 ****
                                                   category, null);
                        }
-       [TODO]
        public static void WriteEntry(String source, String message,
                                                                  
EventLogEntryType type, int eventID,
                                                                  short 
category, byte[] rawData)
                        {
!                               // TODO: find the log for the source and call
!                               // the "WriteEntryToLog" method.
                        }
  
--- 498,516 ----
                                                   category, null);
                        }
        public static void WriteEntry(String source, String message,
                                                                  
EventLogEntryType type, int eventID,
                                                                  short 
category, byte[] rawData)
                        {
!                               lock(typeof(EventLog))
!                               {
!                                       foreach(EventLog log in logs)
!                                       {
!                                               if(log.Source == source)
!                                               {
!                                                       
log.WriteEntryToLog(source, message, type,
!                                                                               
                eventID, category, rawData);
!                                               }
!                                       }
!                               }
                        }
  

Index: EventLogEntry.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/EventLogEntry.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** EventLogEntry.cs    29 May 2003 05:38:18 -0000      1.4
--- EventLogEntry.cs    17 Sep 2003 04:50:55 -0000      1.5
***************
*** 127,130 ****
--- 127,134 ----
                        }
        [MonitoringDescription("LogEntryMessage")]
+ #if CONFIG_COMPONENT_MODEL
+       [Editor("System.ComponentModel.Design.BinaryEditor, System.Design",
+                       "System.Drawing.Design.UITypeEditor, System.Drawing")]
+ #endif
        public String Message
                        {

Index: EventLogEntryCollection.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/EventLogEntryCollection.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** EventLogEntryCollection.cs  29 May 2003 05:38:18 -0000      1.3
--- EventLogEntryCollection.cs  17 Sep 2003 04:50:55 -0000      1.4
***************
*** 86,89 ****
--- 86,101 ----
                        }
  
+       // Add an entry to this collection.
+       internal void Add(EventLogEntry entry)
+                       {
+                               list.Add(entry);
+                       }
+ 
+       // Clear this collection.
+       internal void Clear()
+                       {
+                               list.Clear();
+                       }
+ 
  }; // class EventLogEntryCollection
  

Index: PerformanceCounter.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/PerformanceCounter.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** PerformanceCounter.cs       29 May 2003 05:38:18 -0000      1.3
--- PerformanceCounter.cs       17 Sep 2003 04:50:55 -0000      1.4
***************
*** 31,34 ****
--- 31,38 ----
  // and probably insecure to access anyway.
  
+ #if CONFIG_COMPONENT_MODEL
+ [Designer("Microsoft.VisualStudio.Install.PerformanceCounterDesigner, 
Microsoft.VisualStudio")]
+ 
[InstallerType("System.Diagnostics.PerformanceCounterInstaller,System.Configuration.Install")]
+ #endif
  public sealed class PerformanceCounter
  #if CONFIG_COMPONENT_MODEL

Index: PerformanceCounterType.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/PerformanceCounterType.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** PerformanceCounterType.cs   29 May 2003 05:38:18 -0000      1.2
--- PerformanceCounterType.cs   17 Sep 2003 04:50:55 -0000      1.3
***************
*** 25,29 ****
  #if CONFIG_EXTENDED_DIAGNOSTICS
  
! [Serializable]
  public enum PerformanceCounterType
  {
--- 25,33 ----
  #if CONFIG_EXTENDED_DIAGNOSTICS
  
! using System.ComponentModel;
! 
! #if CONFIG_COMPONENT_MODEL
! [TypeConverter(typeof(AlphabeticalEnumConverter))]
! #endif
  public enum PerformanceCounterType
  {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]