[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics BooleanSwitch.cs,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics BooleanSwitch.cs,NONE,1.1 CounterCreationData.cs,NONE,1.1 CounterCreationDataCollection.cs,NONE,1.1 CounterSample.cs,NONE,1.1 CounterSampleCalculator.cs,NONE,1.1 DefaultTraceListener.cs,NONE,1.1 EntryWrittenEventArgs.cs,NONE,1.1 EntryWrittenEventHandler.cs,NONE,1.1 EventLog.cs,NONE,1.1 EventLogEntry.cs,NONE,1.1 EventLogEntryCollection.cs,NONE,1.1 EventLogEntryType.cs,NONE,1.1 EventLogInstaller.cs,NONE,1.1 EventLogPermissionAccess.cs,NONE,1.1 FileVersionInfo.cs,NONE,1.1 InstanceData.cs,NONE,1.1 InstanceDataCollection.cs,NONE,1.1 InstanceDataCollectionCollection.cs,NONE,1.1 Makefile,NONE,1.1 MonitoringDescriptionAttribute.cs,NONE,1.1PerformanceCounter.cs,NONE,1.1 PerformanceCounterCategory.cs,NONE,1.1 PerformanceCounterPermissionAccess.cs,NONE,1.1 PerformanceCounterType.cs,NONE,1.1 ProcessPriorityClass.cs,NONE,1.1 Switch.cs,NONE,1.1 TextWriterTraceListener.cs,NONE,1.1 ThreadPriorityLevel.cs,NONE,1.1 ThreadState.cs,NONE,1.1 ThreadWaitReason.cs,NONE,1.1 TraceLevel.cs,NONE,1.1 TraceListener.cs,NONE,1.1 TraceListenerCollection.cs,NONE,1.1 TraceSwitch.cs,NONE,1.1 Debug.cs,1.2,1.3 ProcessWindowStyle.cs,1.2,1.3 Trace.cs,1.1,1.2 |
Date: |
Fri, 11 Apr 2003 03:52:41 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics
In directory subversions:/tmp/cvs-serv26444/System/Diagnostics
Modified Files:
Debug.cs ProcessWindowStyle.cs Trace.cs
Added Files:
BooleanSwitch.cs CounterCreationData.cs
CounterCreationDataCollection.cs CounterSample.cs
CounterSampleCalculator.cs DefaultTraceListener.cs
EntryWrittenEventArgs.cs EntryWrittenEventHandler.cs
EventLog.cs EventLogEntry.cs EventLogEntryCollection.cs
EventLogEntryType.cs EventLogInstaller.cs
EventLogPermissionAccess.cs FileVersionInfo.cs InstanceData.cs
InstanceDataCollection.cs InstanceDataCollectionCollection.cs
Makefile MonitoringDescriptionAttribute.cs
PerformanceCounter.cs PerformanceCounterCategory.cs
PerformanceCounterPermissionAccess.cs
PerformanceCounterType.cs ProcessPriorityClass.cs Switch.cs
TextWriterTraceListener.cs ThreadPriorityLevel.cs
ThreadState.cs ThreadWaitReason.cs TraceLevel.cs
TraceListener.cs TraceListenerCollection.cs TraceSwitch.cs
Log Message:
Implement missing classes in the "System.Diagnostics" namespace
within the "System" assembly.
--- NEW FILE ---
/*
* BooleanSwitch.cs - Implementation of the
* "System.Diagnostics.BooleanSwitch" 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 !ECMA_COMPAT
public class BooleanSwitch : Switch
{
// Constructor.
public BooleanSwitch(String displayName, String description)
: base(displayName, description) {}
// Get or set the switch state.
public bool BooleanSwitch
{
get
{
return (SwitchSetting != 0);
}
set
{
SwitchSetting = (value ? 1 : 0);
}
}
}; // class BooleanSwitch
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* CounterCreationData.cs - Implementation of the
* "System.Diagnostics.CounterCreationData" 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 !ECMA_COMPAT
[Serializable]
public class CounterCreationData
{
// Internal state.
private String counterName;
private String counterHelp;
private PerformanceCounterType counterType;
// Constructor.
public CounterCreationData()
: this(String.Empty, String.Empty,
PerformanceCounterType.NumberOfItems32)
{
// Nothing to do here.
}
public CounterCreationData(String counterName, String counterHelp,
PerformanceCounterType counterType)
{
this.counterName = counterName;
this.counterHelp = counterHelp;
this.counterType = counterType;
}
// Get or set the object properties.
public String CounterHelp
{
get
{
return counterHelp;
}
set
{
counterHelp = value;
}
}
public String CounterName
{
get
{
return counterName;
}
set
{
counterName = value;
}
}
public PerformanceCounterType CounterType
{
get
{
return counterType;
}
set
{
counterType = value;
}
}
}; // class CounterCreationData
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* CounterCreationDataCollection.cs - Implementation of the
* "System.Diagnostics.CounterCreationDataCollection"
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 !ECMA_COMPAT
using System.Collections;
[Serializable]
public class CounterCreationDataCollection : CollectionBase
{
// Constructor.
public CounterCreationDataCollection()
{
// Nothing to do here.
}
public CounterCreationDataCollection(CounterCreationData[] value)
{
AddRange(value);
}
public CounterCreationDataCollection(CounterCreationDataCollection
value)
{
AddRange(value);
}
// Get or set a collection member.
public CounterCreationData this[int index]
{
get
{
return
(CounterCreationData)(((IList)this)[index]);
}
set
{
((IList)this)[index] = value;
}
}
// Add an element to this collection.
public int Add(CounterCreationData value)
{
return ((IList)this).Add(value);
}
// Add a range of elements to this collection.
public void AddRange(CounterCreationData[] value)
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
foreach(CounterCreationData val in value)
{
Add(val);
}
}
public void AddRange(CounterCreationDataCollection value)
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
foreach(CounterCreationData val in value)
{
Add(val);
}
}
// Determine if an item exists in this collection.
public bool Contains(CounterCreationData value)
{
return ((IList)this).Contains(value);
}
// Copy the elements in this collection to an array.
public void CopyTo(CounterCreationData[] array, int index)
{
((IList)this).CopyTo(array, index);
}
// Get the index of a specific element in this collection.
public int IndexOf(CounterCreationData value)
{
return ((IList)this).IndexOf(value);
}
// Insert an element into this collection.
public void Insert(int index, CounterCreationData value)
{
((IList)this).Insert(index, value);
}
// Remove an element from this collection.
public virtual void Remove(CounterCreationData value)
{
((IList)this).Remove(value);
}
// Detect when an item is inserted.
protected override void OnInsert(int index, Object value)
{
// Nothing to do here: other implementations
check
// for a maximum collection size. We support
unlimited
// sized collections in this implementation.
}
}; // class CounterCreationDataCollection
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* CounterSample.cs - Implementation of the
* "System.Diagnostics.CounterSample" 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 !ECMA_COMPAT
public struct CounterSample
{
// Internal state.
private long baseValue;
private long counterFrequency;
private long counterTimeStamp;
private PerformanceCounterType counterType;
private long rawValue;
private long systemFrequency;
private long timeStamp;
private long timeStamp100nSec;
// The "empty" sample.
public static readonly CounterSample Empty =
new CounterSample(0, 0, 0, 0, 0, 0,
PerformanceCounterType.NumberOfItems32);
// Constructors.
public CounterSample(long rawValue, long baseValue,
long counterFrequency, long
systemFrequency,
long timeStamp, long
timeStamp100nSec,
PerformanceCounterType
counterType)
{
this.rawValue = rawValue;
this.baseValue = baseValue;
this.counterFrequency = counterFrequency;
this.systemFrequency = systemFrequency;
this.timeStamp = timeStamp;
this.timeStamp100nSec = timeStamp100nSec;
this.counterType = counterType;
this.counterTimeStamp = 0;
}
public CounterSample(long rawValue, long baseValue,
long counterFrequency, long
systemFrequency,
long timeStamp, long
timeStamp100nSec,
PerformanceCounterType
counterType,
long counterTimeStamp)
{
this.rawValue = rawValue;
this.baseValue = baseValue;
this.counterFrequency = counterFrequency;
this.systemFrequency = systemFrequency;
this.timeStamp = timeStamp;
this.timeStamp100nSec = timeStamp100nSec;
this.counterType = counterType;
this.counterTimeStamp = counterTimeStamp;
}
// Access the members of this structure.
public long BaseValue
{
get
{
return baseValue;
}
}
public long CounterFrequency
{
get
{
return counterFrequency;
}
}
public long CounterTimeStamp
{
get
{
return counterTimeStamp;
}
}
public PerformanceCounterType CounterType
{
get
{
return counterType;
}
}
public long RawValue
{
get
{
return rawValue;
}
}
public long SystemFrequency
{
get
{
return systemFrequency;
}
}
public long TimeStamp
{
get
{
return timeStamp;
}
}
public long TimeStamp100nSec
{
get
{
return timeStamp100nSec;
}
}
}; // struct CounterSample
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* CounterSampleCalculator.cs - Implementation of the
* "System.Diagnostics.CounterSampleCalculator" 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 !ECMA_COMPAT
public sealed class CounterSampleCalculator
{
// Cannot instantiate this class.
private CounterSampleCalculator() {}
// Compute the floating-point form of a counter sample value.
// Don't use these methods.
public static float ComputeCounterValue(CounterSample newSample)
{
throw new NotImplementedException();
}
public static float ComputeCounterValue(CounterSample oldSample,
CounterSample newSample)
{
throw new NotImplementedException();
}
}; // class CounterSampleCalculator
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* DefaultTraceListener.cs - Implementation of the
* "System.Diagnostics.DefaultTraceListener" 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 !ECMA_COMPAT
using System.Runtime.InteropServices;
[ComVisible(false)]
public class DefaultTraceListener : TraceListener
{
// Internal state.
private bool loadDone;
private bool assertUiEnabled;
private String logFileName;
// Constructor.
public DefaultTraceListener() : base("Default") {}
// Load the configuration settings.
private void LoadConfig()
{
if(!loadDone)
{
// TODO
}
}
// Get or set the "UI enabled" flag.
public bool AssertUiEnabled
{
get
{
lock(this)
{
LoadConfig();
return assertUiEnabled;
}
}
set
{
lock(this)
{
LoadConfig();
assertUiEnabled = value;
}
}
}
// Get or set the name of the log file.
public String LogFileName
{
get
{
lock(this)
{
LoadConfig();
return logFileName;
}
}
set
{
lock(this)
{
LoadConfig();
logFileName = value;
}
}
}
// Log a failure message to this trace listener.
public override void Fail(String message)
{
Fail(message, null);
}
public override void Fail(String message, String detailMessage)
{
// Write the failure message, but don't pop up
a dialog.
// Dialog support is not available on all
platforms.
WriteLine(String.Format(S._("Arg_AssertFailed"), message));
if(detailMessage != null && detailMessage !=
String.Empty)
{
WriteLine(detailMessage);
}
String trace = (new
StackTrace(true)).ToString();
if(trace != null && trace != String.Empty)
{
Write(trace);
}
}
// Write data to this trace listener's output stream.
public override void Write(String message)
{
lock(this)
{
LoadConfig();
if(NeedIndent)
{
WriteIndent();
}
Console.Error.Write(message);
WriteLog(message, false);
}
}
// Write data to this trace listener's output stream followed by
newline.
public override void WriteLine(String message)
{
lock(this)
{
LoadConfig();
if(NeedIndent)
{
WriteIndent();
}
Console.Error.WriteLine(message);
WriteLog(message, true);
NeedIndent = true;
}
}
// Write a string to the log file.
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.
}
}; // class DefaultTraceListener
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EntryWrittenEventArgs.cs - Implementation of the
* "System.Diagnostics.EntryWrittenEventArgs" 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 !ECMA_COMPAT
[Serializable]
public class EntryWrittenEventArgs : EventArgs
{
// Internal state.
private EventLogEntry entry;
// Constructor.
public EntryWrittenEventArgs()
{
this.entry = null;
}
public EntryWrittenEventArgs(EventLogEntry entry)
{
this.entry = entry;
}
// Get the entry that was written to the log.
public EventLogEntry Entry
{
get
{
return entry;
}
}
}; // class EntryWrittenEventArgs
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EntryWrittenEventHandler.cs - Implementation of the
* "System.Diagnostics.EntryWrittenEventHandler" 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 !ECMA_COMPAT
[Serializable]
public delegate void EntryWrittenEventHandler
(Object sender, EntryWrittenEventArgs e);
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLog.cs - Implementation of the
* "System.Diagnostics.EventLog" 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 !ECMA_COMPAT
using System.ComponentModel;
using System.Security;
public class EventLog : Component, ISupportInitialize
{
// Internal state.
private String logName;
private String machineName;
private String source;
private bool enableRaisingEvents;
private ISynchronizeInvoke syncInvoke;
// Constructor.
public EventLog() : this("", ".", "") {}
public EventLog(String logName) : this(logName, ".", "") {}
public EventLog(String logName, String machineName)
: this(logName, machineName, "") {}
public EventLog(String logName, String machineName, String source)
{
if(logName == null)
{
throw new
ArgumentNullException("logName");
}
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
this.logName = logName;
this.machineName = machineName;
this.source = (source == null ? "" : source);
}
// Get or set event log properties.
public bool EnableRaisingEvents
{
get
{
return enableRaisingEvents;
}
set
{
enableRaisingEvents = value;
}
}
public EventLogEntryCollection Entries
{
get
{
// TODO
return null;
}
}
public String Log
{
get
{
return logName;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
logName = value;
}
}
public String LogDisplayName
{
get
{
// We use the log name as the display
name
// in this implementation.
return logName;
}
}
public String MachineName
{
get
{
return machineName;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
machineName = value;
}
}
public String Source
{
get
{
return source;
}
set
{
source = (value == null ? "" : source);
}
}
public ISynchronizeInvoke SynchronizingObject
{
get
{
return syncInvoke;
}
set
{
syncInvoke = value;
}
}
// Implement the ISupportInitialize interface.
public void BeginInit()
{
// Nothing to do here in this implementation.
}
public void EndInit()
{
// Nothing to do here in this implementation.
}
// Clear all entries from the event log.
public void Clear()
{
// TODO
}
// Close this event log.
public void Close()
{
// TODO
}
// Create a new event source.
public static void CreateEventSource(String source, String logName)
{
CreateEventSource(source, logName, ".");
}
public static void CreateEventSource
(String source, String logName, String
machineName)
{
// Validate the parameters.
if(source == null || source == String.Empty)
{
throw new
ArgumentNullException("source");
}
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
if(logName == null || logName == String.Empty)
{
logName = "Application";
}
// We can only create local sources in this
implementation.
if(machineName != ".")
{
throw new SecurityException
(S._("Invalid_RemoteEventSource"));
}
// TODO
}
// Delete an event log.
public static void Delete(String logName)
{
Delete(logName, ".");
}
public static void Delete(String logName, String machineName)
{
// TODO
}
// Delete an event source.
public static void DeleteEventSource(String source)
{
DeleteEventSource(source, ".");
}
public static void DeleteEventSource(String source, String machineName)
{
// TODO
}
// Dispose of this event log.
protected override void Dispose(bool disposing)
{
// TODO
}
// Determine if a particular log exists.
public static bool Exists(String logName)
{
return Exists(logName, ".");
}
public static bool Exists(String logName, String machineName)
{
// TODO
return false;
}
// Get all active event logs.
public static EventLog[] GetEventLogs()
{
return GetEventLogs(".");
}
public static EventLog[] GetEventLogs(String machineName)
{
// TODO
return new EventLog [0];
}
// Determine if a particular event source exists.
public static bool SourceExists(String source)
{
return SourceExists(source, ".");
}
public static bool SourceExists(String source, String machineName)
{
// TODO
return false;
}
// Write an entry to an event log.
public void WriteEntry(String message)
{
WriteEntry(Source, message,
EventLogEntryType.Information,
0, (short)0, null);
}
public void WriteEntry(String message, EventLogEntryType type)
{
WriteEntry(Source, message, type, 0, (short)0,
null);
}
public void WriteEntry(String message, EventLogEntryType type, int
eventID)
{
WriteEntry(Source, message, type, eventID,
(short)0, null);
}
public void WriteEntry(String source, String message)
{
WriteEntry(source, message,
EventLogEntryType.Information,
0, (short)0, null);
}
public void WriteEntry(String source, String message,
EventLogEntryType type)
{
WriteEntry(source, message, type, 0, (short)0,
null);
}
public void WriteEntry(String message, EventLogEntryType type,
int eventID, short category)
{
WriteEntry(Source, message, type, eventID,
category, null);
}
public void WriteEntry(String source, String message,
EventLogEntryType type, int
eventID)
{
WriteEntry(source, message, type, eventID,
(short)0, null);
}
public void WriteEntry(String message, EventLogEntryType type,
int eventID, short category,
byte[] rawData)
{
WriteEntry(Source, message, type, eventID,
category, rawData);
}
public void WriteEntry(String source, String message,
EventLogEntryType type, int
eventID,
short category)
{
WriteEntry(source, message, type, eventID,
category, null);
}
public void WriteEntry(String source, String message,
EventLogEntryType type, int
eventID,
short category, byte[]
rawData)
{
// Change to the new source.
if(source != this.source)
{
Source = source;
}
// Create the entry.
EventLogEntry entry = new EventLogEntry();
entry.category = category.ToString();
entry.categoryNumber = category;
entry.data = rawData;
entry.entryType = type;
entry.eventID = eventID;
entry.index = 0;
entry.machineName = this.machineName;
entry.message = message;
entry.replacementStrings = null;
entry.source = this.source;
entry.timeWritten = entry.timeGenerated =
DateTime.Now;
entry.userName = Environment.UserName;
// Write the entry to the log.
// TODO
// Notify the listening event handlers for
local events.
if(enableRaisingEvents && machineName == "." &&
EntryWritten != null)
{
EntryWritten(null, new
EntryWrittenEventArgs(entry));
}
}
// Event that indicates when an entry is written to the log.
public event EntryWrittenEventHandler EntryWritten;
}; // class EventLog
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLogEntry.cs - Implementation of the
* "System.Diagnostics.EventLogEntry" 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 !ECMA_COMPAT
using System.ComponentModel;
using System.Runtime.Serialization;
[Serializable]
[DesignTimeVisible(false)]
[ToolboxItem(false)]
public sealed class EventLogEntry : Component, ISerializable
{
// Internal state.
internal String category;
internal short categoryNumber;
internal byte[] data;
internal EventLogEntryType entryType;
internal int eventID;
internal int index;
internal String machineName;
internal String message;
internal String[] replacementStrings;
internal String source;
internal DateTime timeGenerated;
internal DateTime timeWritten;
internal String userName;
// Constructor.
internal EventLogEntry() {}
internal EventLogEntry(SerializationInfo info, StreamingContext context)
{
// The serialization uses a binary format which
// we don't yet know the details of.
throw new NotImplementedException();
}
// Event log properties.
public String Category
{
get
{
return category;
}
}
public short CategoryNumber
{
get
{
return categoryNumber;
}
}
public byte[] Data
{
get
{
return data;
}
}
public EventLogEntryType EntryType
{
get
{
return entryType;
}
}
public int EventID
{
get
{
return eventID;
}
}
public int Index
{
get
{
return index;
}
}
public String MachineName
{
get
{
return machineName;
}
}
public String Message
{
get
{
return message;
}
}
public String[] ReplacementStrings
{
get
{
return replacementStrings;
}
}
public String Source
{
get
{
return source;
}
}
public DateTime TimeGenerated
{
get
{
return timeGenerated;
}
}
public DateTime TimeWritten
{
get
{
return timeWritten;
}
}
public String UserName
{
get
{
return userName;
}
}
// Determine if two event log entries are equal.
public bool Equals(EventLogEntry otherEntry)
{
if(otherEntry == null)
{
return false;
}
if(category != otherEntry.category)
{
return false;
}
if(categoryNumber != otherEntry.categoryNumber)
{
return false;
}
if(data == null)
{
if(otherEntry.data != null)
{
return false;
}
}
else if(otherEntry.data == null)
{
return false;
}
else if(otherEntry.data.Length != data.Length)
{
return false;
}
else
{
int dposn;
for(dposn = 0; dposn < data.Length;
++dposn)
{
if(data[dposn] !=
otherEntry.data[dposn])
{
return false;
}
}
}
if(entryType != otherEntry.entryType)
{
return false;
}
if(eventID != otherEntry.eventID)
{
return false;
}
if(index != otherEntry.index)
{
return false;
}
if(machineName != otherEntry.machineName)
{
return false;
}
if(message != otherEntry.message)
{
return false;
}
if(replacementStrings == null)
{
if(otherEntry.replacementStrings !=
null)
{
return false;
}
}
else if(otherEntry.replacementStrings == null)
{
return false;
}
else if(otherEntry.replacementStrings.Length
!=
replacementStrings.Length)
{
return false;
}
else
{
int rposn;
for(rposn = 0; rposn <
replacementStrings.Length; ++rposn)
{
if(replacementStrings[rposn] !=
otherEntry.replacementStrings[rposn])
{
return false;
}
}
}
if(source != otherEntry.source)
{
return false;
}
if(timeGenerated != otherEntry.timeGenerated)
{
return false;
}
if(timeWritten != otherEntry.timeWritten)
{
return false;
}
if(userName != otherEntry.userName)
{
return false;
}
return true;
}
public override bool Equals(Object obj)
{
return Equals(obj as EventLogEntry);
}
// Implement the ISerializable interface.
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
// The serialization uses a binary format which
// we don't yet know the details of.
throw new NotImplementedException();
}
}; // class EventLogEntry
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLogEntryCollection.cs - Implementation of the
* "System.Diagnostics.EventLogEntryCollection" 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 !ECMA_COMPAT
using System.Collections;
public class EventLogEntryCollection : ICollection, IEnumerable
{
// Internal state.
private ArrayList list;
// Constructor.
internal EventLogEntryCollection()
{
list = new ArrayList();
}
// Implement the ICollection interface.
void ICollection.CopyTo(Array array, int index)
{
list.CopyTo(array, index);
}
public int Count
{
get
{
return list.Count;
}
}
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
Object ICollection.SyncRoot
{
get
{
return this;
}
}
// Implement the IEnumerable interface.
IEnumerator IEnumerable.GetEnumerator()
{
return list.GetEnumerator();
}
// Get a particular entry from this collection.
public virtual EventLogEntry this[int index]
{
get
{
return (EventLogEntry)(list[index]);
}
}
// Copy the members of this collection to an array.
public void CopyTo(EventLogEntry[] entries, int index)
{
list.CopyTo(entries, index);
}
}; // class EventLogEntryCollection
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLogEntryType.cs - Implementation of the
* "System.Diagnostics.EventLogEntryType" 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 !ECMA_COMPAT
[Serializable]
public enum EventLogEntryType
{
Error = 0x0001,
Warning = 0x0002,
Information = 0x0004,
SuccessAudit = 0x0008,
FailureAudit = 0x0010
}; // enum EventLogEntryType
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLogInstaller.cs - Implementation of the
* "System.Diagnostics.EventLogInstaller" 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 false // TODO - need System.Configuration.Install namespace
#if !ECMA_COMPAT
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
public class EventLogInstaller : ComponentInstaller
{
// Internal state.
private String logName;
private String source;
private UninstallAction uninstallAction;
// Constructor.
public EventLogInstaller()
{
logName = "";
source = "";
uninstallAction = UninstallAction.Remove;
}
// Get or set installer properties.
public String Log
{
get
{
return logName;
}
set
{
logName = value;
}
}
public String Source
{
get
{
return source;
}
set
{
source = value;
}
}
public UninstallAction UninstallAction
{
get
{
return uninstallAction;
}
set
{
uninstallAction = value;
}
}
// Copy configuration information from a component.
public override CopyFromComponent(IComponent component)
{
// TODO
}
// Install the event log.
public override void Install(IDictionary stateSaver)
{
// TODO
}
// Determine if two installers are equivalent.
public override bool IsEquivalentInstaller
(ComponentInstaller otherInstaller)
{
EventLogInstaller other = (otherInstaller as
EventLogInstaller);
if(other != null)
{
return (other.Log == Log &&
other.Source == Source);
}
else
{
return false;
}
}
// Roll back the installation process.
public override void Rollback(IDictionary savedState)
{
// TODO
}
// Uninstall this event log.
public override void Uninstall(IDictionary savedState)
{
// TODO
}
}; // class EventLogInstaller
#endif // !ECMA_COMPAT
#endif // false
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* EventLogPermissionAccess.cs - Implementation of the
* "System.Diagnostics.EventLogPermissionAccess" 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 !ECMA_COMPAT
[Serializable]
[Flags]
public enum EventLogPermissionAccess
{
None = 0x0000,
Browse = 0x0002,
Instrument = 0x0006,
Audit = 0x000A
}; // enum EventLogPermissionAccess
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* FileVersionInfo.cs - Implementation of the
* "System.Diagnostics.FileVersionInfo" 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 !ECMA_COMPAT
using System.IO;
public sealed class FileVersionInfo
{
// Internal state.
private String comments;
private String companyName;
private int fileBuildPart;
private String fileDescription;
private int fileMajorPart;
private int fileMinorPart;
private String fileName;
private int filePrivatePart;
private String internalName;
private bool isDebug;
private bool isPatched;
private bool isPreRelease;
private bool isPrivateBuild;
private bool isSpecialBuild;
private String language;
private String legalCopyright;
private String legalTrademarks;
private String originalFilename;
private String privateBuild;
private int productBuildPart;
private int productMajorPart;
private int productMinorPart;
private String productName;
private int productPrivatePart;
private String specialBuild;
// Constructor.
private FileVersionInfo(String fileName)
{
this.fileName = fileName;
}
// Properties.
public String Comments
{
get
{
return comments;
}
}
public String CompanyName
{
get
{
return companyName;
}
}
public int FileBuildPart
{
get
{
return fileBuildPart;
}
}
public String FileDescription
{
get
{
return fileDescription;
}
}
public int FileMajorPart
{
get
{
return fileMajorPart;
}
}
public int FileMinorPart
{
get
{
return fileMinorPart;
}
}
public String FileName
{
get
{
return fileName;
}
}
public int FilePrivatePart
{
get
{
return filePrivatePart;
}
}
public String FileVersion
{
get
{
return (new Version(FileMajorPart,
FileMinorPart,
FileBuildPart, FilePrivatePart))
.ToString();
}
}
public String InternalName
{
get
{
return internalName;
}
}
public bool IsDebug
{
get
{
return isDebug;
}
}
public bool IsPatched
{
get
{
return isPatched;
}
}
public bool IsPreRelease
{
get
{
return isPreRelease;
}
}
public bool IsPrivateBuild
{
get
{
return isPrivateBuild;
}
}
public bool IsSpecialBuild
{
get
{
return isSpecialBuild;
}
}
public String Language
{
get
{
return language;
}
}
public String LegalCopyright
{
get
{
return legalCopyright;
}
}
public String LegalTrademarks
{
get
{
return legalTrademarks;
}
}
public String OriginalFilename
{
get
{
return originalFilename;
}
}
public String PrivateBuild
{
get
{
return privateBuild;
}
}
public int ProductBuildPart
{
get
{
return productBuildPart;
}
}
public int ProductMajorPart
{
get
{
return productMajorPart;
}
}
public int ProductMinorPart
{
get
{
return productMinorPart;
}
}
public String ProductName
{
get
{
return productName;
}
}
public int ProductPrivatePart
{
get
{
return productPrivatePart;
}
}
public String ProductVersion
{
get
{
return (new Version(ProductMajorPart,
ProductMinorPart,
ProductBuildPart, ProductPrivatePart))
.ToString();
}
}
public String SpecialBuild
{
get
{
return specialBuild;
}
}
// Convert this object into a string.
public override String ToString()
{
// We don't support getting Windows version
information
// in this implementation, so all we have to do
is return
// the filename information.
return "File: " + fileName +
Environment.NewLine;
}
// Get version information for a file.
public static FileVersionInfo GetVersionInfo(String fileName)
{
// We don't support getting Windows version
information
// in this implementation, so all we have to do
is return
// an object that contains the filename.
if(fileName == null)
{
throw new
ArgumentNullException("fileName");
}
return new
FileVersionInfo(Path.GetFullPath(fileName));
}
}; // class FileVersionInfo
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* InstanceData.cs - Implementation of the
* "System.Diagnostics.InstanceData" 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 !ECMA_COMPAT
public class InstanceData
{
// Internal state.
private String instanceName;
private CounterSample sample;
// Constructor.
public InstanceData(String instanceName, CounterSample sample)
{
this.instanceName = instanceName;
this.sample = sample;
}
// Properties.
public String InstanceName
{
get
{
return instanceName;
}
}
public long RawValue
{
get
{
return sample.RawValue;
}
}
public CounterSample Sample
{
get
{
return sample;
}
}
}; // class InstanceData
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* InstanceDataCollection.cs - Implementation of the
* "System.Diagnostics.InstanceDataCollection" 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 !ECMA_COMPAT
using System.Collections;
public class InstanceDataCollection : DictionaryBase
{
// Internal state.
private String counterName;
// Constructor.
public InstanceDataCollection(String counterName)
{
if(counterName == null)
{
throw new
ArgumentNullException("counterName");
}
this.counterName = counterName;
}
// Get the name of this counter.
public String CounterName
{
get
{
return counterName;
}
}
// Get the counter information associated with a particular instance.
public InstanceData this[String instanceName]
{
get
{
return
(InstanceData)(((IDictionary)this)[instanceName]);
}
}
// Get the list of keys within this collection.
public ICollection Keys
{
get
{
return ((IDictionary)this).Keys;
}
}
// Get the list of values within this collection.
public ICollection Values
{
get
{
return ((IDictionary)this).Values;
}
}
// Determine if this collection contains a specific instance.
public bool Contains(String instanceName)
{
return
((IDictionary)this).Contains(instanceName);
}
// Copy the contents of this collection to an array.
public void CopyTo(InstanceData[] array, int index)
{
((IDictionary)this).CopyTo(array, index);
}
}; // class InstanceDataCollection
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* InstanceDataCollectionCollection.cs - Implementation of the
* "System.Diagnostics.InstanceDataCollectionCollection"
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 !ECMA_COMPAT
using System.Collections;
public class InstanceDataCollectionCollection : DictionaryBase
{
// Constructor.
public InstanceDataCollectionCollection() : base() {}
// Get the counter information associated with a particular instance.
public InstanceDataCollection this[String counterName]
{
get
{
return (InstanceDataCollection)
(((IDictionary)this)[counterName]);
}
}
// Get the list of keys within this collection.
public ICollection Keys
{
get
{
return ((IDictionary)this).Keys;
}
}
// Get the list of values within this collection.
public ICollection Values
{
get
{
return ((IDictionary)this).Values;
}
}
// Determine if this collection contains a specific instance.
public bool Contains(String counterName)
{
return
((IDictionary)this).Contains(counterName);
}
// Copy the contents of this collection to an array.
public void CopyTo(InstanceDataCollection[] array, int index)
{
((IDictionary)this).CopyTo(array, index);
}
}; // class InstanceDataCollectionCollection
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
all:
(cd ..;make)
(cd ..;make phase-two)
--- NEW FILE ---
/*
* MonitoringDescriptionAttribute.cs - Implementation of the
* "System.Diagnostics.MonitoringDescriptionAttribute"
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 !ECMA_COMPAT
using System.ComponentModel;
[AttributeUsage(AttributeTargets.All)]
public class MonitoringDescriptionAttribute : DescriptionAttribute
{
// Internal state.
private String description;
// Constructor.
public MonitoringDescriptionAttribute(String description)
{
this.description = description;
}
// Get this attribute's value.
public override String Description
{
get
{
return description;
}
}
}; // class MonitoringDescriptionAttribute
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* PerformanceCounter.cs - Implementation of the
* "System.Diagnostics.PerformanceCounter" 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 !ECMA_COMPAT
using System.ComponentModel;
// Note: this class is mostly a place-holder. We don't actually read
// the system performance counters as they are highly Windows-specific
// and probably insecure to access anyway.
public class PerformanceCounter : Component, ISupportInitialize
{
// Internal state.
private String categoryName;
private String counterHelp;
private String counterName;
private PerformanceCounterType counterType;
private String instanceName;
private String machineName;
private long rawValue;
private bool readOnly;
// Constructor.
public PerformanceCounter() {}
public PerformanceCounter(String categoryName, String counterName)
: this(categoryName, counterName, "", ".") {}
public PerformanceCounter(String categoryName, String counterName,
bool readOnly)
: this(categoryName, counterName, "", ".")
{
this.readOnly = readOnly;
}
public PerformanceCounter(String categoryName, String counterName,
String instanceName)
: this(categoryName, counterName, instanceName, ".") {}
public PerformanceCounter(String categoryName, String counterName,
String instanceName,
bool readOnly)
: this(categoryName, counterName, instanceName, ".")
{
this.readOnly = readOnly;
}
public PerformanceCounter(String categoryName, String counterName,
String instanceName,
String machineName)
{
if(categoryName == null)
{
throw new
ArgumentNullException("categoryName");
}
if(counterName == null)
{
throw new
ArgumentNullException("counterName");
}
if(instanceName == null)
{
throw new
ArgumentNullException("instanceName");
}
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
this.categoryName = categoryName;
this.counterName = counterName;
this.instanceName = instanceName;
this.machineName = machineName;
this.counterType = (PerformanceCounterType)
Enum.Parse(typeof(PerformanceCounterType), counterName);
}
// Counter properties.
public String CategoryName
{
get
{
return categoryName;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
categoryName = value;
}
}
public String CounterHelp
{
get
{
if(categoryName == null)
{
throw new
InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
return counterHelp;
}
}
public String CounterName
{
get
{
return counterName;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
counterName = value;
}
}
public PerformanceCounterType CounterType
{
get
{
if(categoryName == null)
{
throw new
InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
return counterType;
}
}
public String InstanceName
{
get
{
return instanceName;
}
set
{
instanceName = value;
}
}
public String MachineName
{
get
{
return machineName;
}
set
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
machineName = value;
}
}
public long RawValue
{
get
{
if(readOnly)
{
throw new
InvalidOperationException
(S._("Invalid_ReadOnly"));
}
return rawValue;
}
set
{
rawValue = value;
}
}
// Implement the ISupportsInitialize interface.
public void BeginInit()
{
// Nothing to do here.
}
public void EndInit()
{
// Nothing to do here.
}
// Close the performance counter.
public void Close()
{
// Nothing to do here.
}
// Decrement the performance counter's raw value.
public void Decrement()
{
if(readOnly)
{
throw new InvalidOperationException
(S._("Invalid_ReadOnly"));
}
else if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
lock(this)
{
--rawValue;
}
}
// Increment the performance counter's raw value.
public void Increment()
{
if(readOnly)
{
throw new InvalidOperationException
(S._("Invalid_ReadOnly"));
}
else if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
lock(this)
{
++rawValue;
}
}
// Increment the performance counter's raw value by a particular amount.
public void IncrementBy(long value)
{
if(readOnly)
{
throw new InvalidOperationException
(S._("Invalid_ReadOnly"));
}
else if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
lock(this)
{
rawValue += value;
}
}
// Get the next counter sample.
public CounterSample NextSample()
{
if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
return new CounterSample(rawValue, 0, 0, 0, 0,
0, CounterType);
}
// Get the next counter sample value.
public float NextValue()
{
return CounterSampleCalculator
.ComputeCounterValue(NextSample());
}
// Remove a particular instance from this counter.
public void RemoveInstance()
{
if(readOnly)
{
throw new InvalidOperationException
(S._("Invalid_ReadOnly"));
}
else if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CounterNotInited"));
}
}
// Dispose of this object.
protected override void Dispose(bool disposing)
{
Close();
}
}; // class PerformanceCounter
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* PerformanceCounterCategory.cs - Implementation of the
* "System.Diagnostics.PerformanceCounterCategory" 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 !ECMA_COMPAT
public class PerformanceCounterCategory
{
// Internal state.
private String categoryHelp;
private String categoryName;
private String machineName;
// Constructor.
public PerformanceCounterCategory()
{
machineName = ".";
}
public PerformanceCounterCategory(String categoryName)
: this(categoryName, ".") {}
public PerformanceCounterCategory(String categoryName, String
machineName)
{
if(categoryName == null)
{
throw new
ArgumentNullException("categoryName");
}
else if(categoryName == String.Empty)
{
throw new ArgumentException
(S._("Arg_CounterCategory"));
}
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
this.categoryName = categoryName;
this.machineName = machineName;
}
// Category properties.
public String CategoryHelp
{
get
{
if(categoryName == null)
{
throw new
InvalidOperationException
(S._("Invalid_CategoryNotInited"));
}
return categoryHelp;
}
}
public String CategoryName
{
get
{
return categoryName;
}
set
{
if(categoryName == null)
{
throw new
ArgumentNullException("categoryName");
}
else if(categoryName == String.Empty)
{
throw new ArgumentException
(S._("Arg_CounterCategory"));
}
categoryName = value;
}
}
public String MachineName
{
get
{
return machineName;
}
set
{
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
machineName = value;
}
}
// Determine if a particular counter exists.
public bool CounterExists(String counterName)
{
if(counterName == null)
{
throw new
ArgumentNullException("counterName");
}
if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CategoryNotInited"));
}
return false; // We don't support performance
counters.
}
public static bool CounterExists(String counterName,
String
categoryName)
{
return (new
PerformanceCounterCategory(categoryName))
.CounterExists(counterName);
}
public static bool CounterExists(String counterName,
String
categoryName,
String
machineName)
{
return (new PerformanceCounterCategory
(categoryName,
machineName))
.CounterExists(counterName);
}
// Create a performance counter category.
public static PerformanceCounterCategory Create
(String categoryName, String categoryHelp,
CounterCreationDataCollection counterData)
{
// Dummy only: we don't support performance
counters.
return new
PerformanceCounterCategory(categoryName);
}
public static PerformanceCounterCategory Create
(String categoryName, String categoryHelp,
String counterName, String counterHelp)
{
// Dummy only: we don't support performance
counters.
return new
PerformanceCounterCategory(categoryName);
}
// Delete a particular performance counter category.
public static void Delete(String categoryName)
{
if(categoryName == null)
{
throw new
ArgumentNullException("categoryName");
}
}
// Determine if a particluar category has been registered.
public static bool Exists(String categoryName)
{
return Exists(categoryName, ".");
}
public static bool Exists(String categoryName, String machineName)
{
if(categoryName == null)
{
throw new
ArgumentNullException("categoryName");
}
else if(categoryName == String.Empty)
{
throw new ArgumentException
(S._("Arg_CounterCategory"));
}
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
return false; // We don't support performance
counters.
}
// Get a list of all registered categories.
public static PerformanceCounterCategory[] GetCategories()
{
return GetCategories(".");
}
public static PerformanceCounterCategory[] GetCategories
(String machineName)
{
if(machineName == null)
{
throw new
ArgumentNullException("machineName");
}
return new PerformanceCounterCategory [0];
}
// Get the performance counters in this category.
public PerformanceCounter[] GetCounters()
{
return new PerformanceCounter [0];
}
public PerformanceCounter[] GetCounters(String instanceName)
{
if(instanceName == null)
{
throw new
ArgumentNullException("instanceName");
}
return new PerformanceCounter [0];
}
// Get the instance names associated with this category.
public String[] GetInstanceNames()
{
if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CategoryNotInited"));
}
return new String [0];
}
// Determine if a particular instance name exists.
public bool InstanceExists(String instanceName)
{
if(instanceName == null)
{
throw new
ArgumentNullException("instanceName");
}
return false; // We don't support performance
counters.
}
public bool InstanceExists(String instanceName, String categoryName)
{
return (new
PerformanceCounterCategory(categoryName))
.InstanceExists(instanceName);
}
public bool InstanceExists(String instanceName, String categoryName,
String machineName)
{
return (new PerformanceCounterCategory
(categoryName,
machineName))
.InstanceExists(instanceName);
}
// Read all of the instance data associated with a category.
public InstanceDataCollectionCollection ReadCategory()
{
// We don't support performance counters,
// so return an empty result collection.
if(categoryName == null)
{
throw new InvalidOperationException
(S._("Invalid_CategoryNotInited"));
}
return new InstanceDataCollectionCollection();
}
}; // class PerformanceCounterCategory
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* PerformanceCounterPermissionAccess.cs - Implementation of the
* "System.Diagnostics.PerformanceCounterPermissionAccess"
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 !ECMA_COMPAT
[Serializable]
[Flags]
public enum PerformanceCounterPermissionAccess
{
None = 0x0000,
Browse = 0x0002,
Instrument = 0x0006,
Administer = 0x000E
}; // enum PerformanceCounterPermissionAccess
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* PerformanceCounterType.cs - Implementation of the
* "System.Diagnostics.PerformanceCounterType" 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 !ECMA_COMPAT
[Serializable]
public enum PerformanceCounterType
{
NumberOfItemsHEX32 = 0x00000000,
NumberOfItemsHEX64 = 0x00000100,
NumberOfItems32 = 0x00010000,
NumberOfItems64 = 0x00010100,
CounterDelta32 = 0x00400400,
CounterDelta64 = 0x00400500,
SampleCounter = 0x00410400,
CountPerTimeInterval32 = 0x00450400,
CountPerTimeInterval64 = 0x00450500,
RateOfCountsPerSecond32 = 0x10410400,
RateOfCountsPerSecond64 = 0x10410500,
RawFraction = 0x20020400,
CounterTimer = 0x20410500,
Timer100Ns = 0x20510500,
SampleFraction = 0x20C20400,
CounterTimerInverse = 0x21410500,
Timer100NsInverse = 0x21510500,
CounterMultiTimer = 0x22410500,
CounterMultiTimerInverse = 0x23410500,
CounterMultiTimer100Ns = 0x22510500,
CounterMultiTimer100NsInverse = 0x23510500,
AverageTimer32 = 0x30020400,
ElapsedTime = 0x30240500,
AverageCount64 = 0x40020500,
SampleBase = 0x40030401,
AverageBase = 0x40030402,
RawBase = 0x40030403,
CounterMultiBase = 0x42030500
}; // enum PerformanceCounterType
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* ProcessPriorityClass.cs - Implementation of the
* "System.Diagnostics.ProcessPriorityClass" 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 !ECMA_COMPAT
[Serializable]
public enum ProcessPriorityClass
{
Normal = 0x0020,
Idle = 0x0040,
High = 0x0080,
RealTime = 0x0100,
BelowNormal = 0x4000,
AboveNormal = 0x8000
}; // enum ProcessPriorityClass
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* Switch.cs - Implementation of the "System.Diagnostics.Switch" 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 !ECMA_COMPAT
using System.Collections;
public abstract class Switch
{
// Internal state.
private String description;
private String displayName;
private int switchSetting;
private bool switchInitialized;
private static Hashtable switchValues;
// Constructor.
protected Switch(String displayName, String description)
{
if(displayName == null)
{
this.displayName = String.Empty;
}
else
{
this.displayName = displayName;
}
this.description = description;
this.switchSetting = 0;
this.switchInitialized = false;
}
// Description of the switch.
public String Description
{
get
{
return description;
}
}
// Display name for the switch.
public String DisplayName
{
get
{
return displayName;
}
}
// Get or set the switch value.
protected int SwitchSetting
{
get
{
if(!switchInitialized)
{
switchSetting =
GetConfigSetting(displayName);
switchInitialized = true;
OnSwitchSettingChanged();
}
return switchSetting;
}
set
{
switchSetting = value;
switchInitialized = true;
OnSwitchSettingChanged();
}
}
// Notify the subclass of a switch setting change.
protected virtual void OnSwitchSettingChanged()
{
// Nothing to do here.
}
// Load the switch values from the configuration into a hash table.
private static void LoadSwitchValues(Hashtable values)
{
// We don't use this form of configuration at
the moment.
// Provided for compatibility only.
}
// Get a switch value from the configuration.
private static int GetConfigSetting(String displayName)
{
lock(typeof(Switch))
{
if(switchValues == null)
{
switchValues = new Hashtable();
LoadSwitchValues(switchValues);
}
Object value =
switchValues[displayName];
if(value != null)
{
return (int)value;
}
else
{
return 0;
}
}
}
}; // class Switch
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* TextWriterTraceListener.cs - Implementation of the
* "System.Diagnostics.TextWriterTraceListener" 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 !ECMA_COMPAT
using System.IO;
public class TextWriterTraceListener : TraceListener
{
// Internal state.
private TextWriter writer;
// Constructor.
public TextWriterTraceListener() : base("TextWriter") {}
public TextWriterTraceListener(Stream stream) : base("")
{
writer = new StreamWriter(stream);
}
public TextWriterTraceListener(String fileName) : base("")
{
writer = new StreamWriter(fileName);
}
public TextWriterTraceListener(TextWriter writer) : base("")
{
this.writer = writer;
}
public TextWriterTraceListener(Stream stream, String name)
: base(name == null ? String.Empty : name)
{
writer = new StreamWriter(stream);
}
public TextWriterTraceListener(String fileName, String name)
: base(name == null ? String.Empty : name)
{
writer = new StreamWriter(fileName);
}
public TextWriterTraceListener(TextWriter writer, String name)
: base(name == null ? String.Empty : name)
{
this.writer = writer;
}
// Get or set the writer being used by this trace listener.
public TextWriter Writer
{
get
{
return writer;
}
set
{
writer = value;
}
}
// Close this trace listener.
public override void Close()
{
if(writer != null)
{
writer.Close();
}
}
// Dispose this trace listener.
protected override void Dispose(bool disposing)
{
if(disposing)
{
Close();
}
}
// Flush this trace listener's output stream.
public override void Flush()
{
if(writer != null)
{
writer.Flush();
}
}
// Write data to this trace listener's output stream.
public override void Write(String message)
{
if(NeedIndent)
{
WriteIndent();
}
if(writer != null)
{
writer.Write(message);
}
}
// Write data to this trace listener's output stream followed by
newline.
public override void WriteLine(String message)
{
if(NeedIndent)
{
WriteIndent();
}
if(writer != null)
{
writer.WriteLine(message);
}
NeedIndent = true;
}
}; // class TextWriterTraceListener
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* ThreadPriorityLevel.cs - Implementation of the
* "System.Diagnostics.ThreadPriorityLevel" 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 !ECMA_COMPAT
[Serializable]
public enum ThreadPriorityLevel
{
Idle = -15,
Lowest = -2,
BelowNormal = -1,
Normal = 0,
AboveNormal = 1,
Highest = 2,
TimeCritical = 15
}; // enum ThreadPriorityLevel
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* ThreadState.cs - Implementation of the
* "System.Diagnostics.ThreadState" 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 !ECMA_COMPAT
[Serializable]
public enum ThreadState
{
Initialized = 0,
Ready = 1,
Running = 2,
Standby = 3,
Terminated = 4,
Wait = 5,
Transition = 6,
Unknown = 7
}; // enum ThreadState
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* ThreadWaitReason.cs - Implementation of the
* "System.Diagnostics.ThreadWaitReason" 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 !ECMA_COMPAT
[Serializable]
public enum ThreadWaitReason
{
Executive = 0,
FreePage = 1,
PageIn = 2,
SystemAllocation = 3,
ExecutionDelay = 4,
Suspended = 5,
UserRequest = 6,
EventPairHigh = 7,
EventPairLow = 8,
LpcReceive = 9,
LpcReply = 10,
VirtualMemory = 11,
PageOut = 12,
Unknown = 13,
}; // enum ThreadWaitReason
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* TraceLevel.cs - Implementation of the
* "System.Diagnostics.TraceLevel" 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 !ECMA_COMPAT
[Serializable]
public enum TraceLevel
{
Off = 0,
Error = 1,
Warning = 2,
Info = 3,
Verbose = 4
}; // enum TraceLevel
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* TraceListener.cs - Implementation of the
* "System.Diagnostics.TraceListener" 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 !ECMA_COMPAT
public abstract class TraceListener : MarshalByRefObject, IDisposable
{
// Internal state.
private int indentLevel;
private int indentSize;
private String name;
private bool needIndent;
// Constructors.
protected TraceListener()
{
this.indentLevel = 0;
this.indentSize = 4;
this.name = String.Empty;
this.needIndent = false;
}
protected TraceListener(String name)
{
this.indentLevel = 0;
this.indentSize = 4;
this.name = name;
this.needIndent = false;
}
// Listener properties.
public int IndentLevel
{
get
{
return indentLevel;
}
set
{
if(value < 0)
{
value = 0;
}
indentLevel = value;
}
}
public int IndentSize
{
get
{
return indentSize;
}
set
{
if(value < 0)
{
throw new
ArgumentOutOfRangeException
("value",
S._("Arg_NonNegative"));
}
indentSize = value;
}
}
public virtual String Name
{
get
{
return name;
}
set
{
name = value;
}
}
protected bool NeedIndent
{
get
{
return needIndent;
}
set
{
needIndent = true;
}
}
// Close this trace listener.
public virtual void Close()
{
// Nothing to do here.
}
// Dispose this trace listener.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
// Nothing to do here.
}
// Log a failure message to this trace listener.
public virtual void Fail(String message)
{
// Nothing to do here.
}
public virtual void Fail(String message, String detailMessage)
{
// Nothing to do here.
}
// Flush this trace listener's output stream.
public virtual void Flush()
{
// Nothing to do here.
}
// Write data to this trace listener's output stream.
public virtual void Write(Object o)
{
if(o != null)
{
Write(o.ToString());
}
}
public abstract void Write(String message);
public virtual void Write(Object o, String category)
{
if(category == null)
{
if(o != null)
{
Write(o.ToString());
}
}
else if(o != null)
{
Write(o.ToString(), category);
}
else
{
Write(String.Empty, category);
}
}
public virtual void Write(String message, String category)
{
if(category == null)
{
Write(message);
}
else if(message != null)
{
Write(category + ": " + message);
}
else
{
Write(category + ": ");
}
}
// Write indent data to this trace listener.
protected virtual void WriteIndent()
{
NeedIndent = false;
int level = indentLevel;
String indent;
if(indentSize == 4)
{
// Short-cut to improve common-case
performance.
indent = " ";
}
else
{
indent = new String(' ', indentSize);
}
while(level > 0)
{
Write(indent);
--level;
}
}
// Write data to this trace listener's output stream followed by
newline.
public virtual void WriteLine(Object o)
{
if(o != null)
{
WriteLine(o.ToString());
}
else
{
WriteLine(String.Empty);
}
}
public abstract void WriteLine(String message);
public virtual void WriteLine(Object o, String category)
{
if(category == null)
{
if(o != null)
{
WriteLine(o.ToString());
}
}
else if(o != null)
{
WriteLine(o.ToString(), category);
}
else
{
WriteLine(String.Empty, category);
}
}
public virtual void WriteLine(String message, String category)
{
if(category == null)
{
WriteLine(message);
}
else if(message != null)
{
WriteLine(category + ": " + message);
}
else
{
WriteLine(category + ": ");
}
}
}; // class TraceListener
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* TraceListenerCollection.cs - Implementation of the
* "System.Diagnostics.TraceListenerCollection" 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 !ECMA_COMPAT
using System.Collections;
public class TraceListenerCollection : IList, ICollection, IEnumerable
{
// Internal state.
private ArrayList list;
// Constructor.
internal TraceListenerCollection()
{
list = new ArrayList();
}
// Implement the ICollection interface.
void ICollection.CopyTo(Array array, int index)
{
lock(this)
{
list.CopyTo(array, index);
}
}
public int Count
{
get
{
lock(this)
{
return list.Count;
}
}
}
bool ICollection.IsSynchronized
{
get
{
return true;
}
}
Object ICollection.SyncRoot
{
get
{
return this;
}
}
// Implement the IList interface.
int IList.Add(Object value)
{
lock(this)
{
return list.Add((TraceListener)value);
}
}
public void Clear()
{
lock(this)
{
list.Clear();
}
}
bool IList.Contains(Object value)
{
lock(this)
{
return list.Contains(value);
}
}
int IList.IndexOf(Object value)
{
lock(this)
{
return list.IndexOf(value);
}
}
void IList.Insert(int index, Object value)
{
lock(this)
{
list.Insert(index,
(TraceListener)value);
}
}
void IList.Remove(Object value)
{
lock(this)
{
list.Remove(value);
}
}
public void RemoveAt(int index)
{
lock(this)
{
list.RemoveAt(index);
}
}
bool IList.IsFixedSize
{
get
{
return false;
}
}
bool IList.IsReadOnly
{
get
{
return false;
}
}
Object IList.this[int index]
{
get
{
lock(this)
{
return list[index];
}
}
set
{
lock(this)
{
list[index] =
(TraceListener)value;
}
}
}
// Implement the IEnumerable interface.
public IEnumerator GetEnumerator()
{
lock(this)
{
// Clone the list and enumerate that so
that modifications
// to the trace listener list are not
reflected in the
// enumeration elements, as per the
specification.
TraceListener[] listeners = new
TraceListener [list.Count];
list.CopyTo(listeners, 0);
return listeners.GetEnumerator();
}
}
// Clone the global trace settings onto a new listener.
private static void CloneSettings(TraceListener listener)
{
listener.IndentLevel = Trace.IndentLevel;
listener.IndentSize = Trace.IndentSize;
}
// Get or set a particular element in this collection.
public TraceListener this[int index]
{
get
{
lock(this)
{
return
(TraceListener)(list[index]);
}
}
set
{
CloneSettings(value);
lock(this)
{
list[index] = value;
}
}
}
// Get the trace listener with a specific name.
public TraceListener this[String name]
{
get
{
lock(this)
{
foreach(TraceListener listener
in list)
{
if(listener.Name ==
name)
{
return listener;
}
}
return null;
}
}
}
// Add a trace listener to this collection.
public void Add(TraceListener listener)
{
CloneSettings(listener);
lock(this)
{
list.Add(listener);
}
}
// Add a range of trace listeners to this collection.
public void AddRange(TraceListener[] value)
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
foreach(TraceListener listener in value)
{
Add(listener);
}
}
public void AddRange(TraceListenerCollection value)
{
if(value == null)
{
throw new
ArgumentNullException("value");
}
foreach(TraceListener listener in value)
{
Add(listener);
}
}
// Determine if the list contains a specific listener.
public bool Contains(TraceListener listener)
{
lock(this)
{
return list.Contains(listener);
}
}
// Copy the contents of this collection to an array.
public void CopyTo(TraceListener[] listeners, int index)
{
lock(this)
{
list.CopyTo(listeners, index);
}
}
// Get the index of a specific listener.
public int IndexOf(TraceListener listener)
{
lock(this)
{
return list.IndexOf(listener);
}
}
// Remove a specific trace listener.
public void Remove(TraceListener listener)
{
lock(this)
{
list.Remove(listener);
}
}
public void Remove(String name)
{
lock(this)
{
int posn = 0;
foreach(TraceListener listener in list)
{
if(listener.Name == name)
{
list.RemoveAt(posn);
break;
}
++posn;
}
}
}
}; // class TraceListenerCollection
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
--- NEW FILE ---
/*
* TraceSwitch.cs - Implementation of the
* "System.Diagnostics.TraceSwitch" 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 !ECMA_COMPAT
public class TraceSwitch : Switch
{
// Constructor.
public TraceSwitch(String displayName, String description)
: base(displayName, description) {}
// Get or set the trace level.
public TraceLevel Level
{
get
{
return (TraceLevel)SwitchSetting;
}
set
{
if(((int)value) <
((int)(TraceLevel.Off)) ||
((int)value) >
((int)(TraceLevel.Verbose)))
{
throw new
ArgumentException(S._("Arg_TraceLevel"));
}
SwitchSetting = (int)value;
}
}
// Determine if the level is one of the special values.
public bool TraceError
{
get
{
return (Level == TraceLevel.Error);
}
}
public bool TraceInfo
{
get
{
return (Level == TraceLevel.Info);
}
}
public bool TraceVerbose
{
get
{
return (Level == TraceLevel.Verbose);
}
}
public bool TraceWarning
{
get
{
return (Level == TraceLevel.Warning);
}
}
// Notify the subclass of a switch setting change.
protected override void OnSwitchSettingChanged()
{
// Validate values changed through
"Switch.SwitchSetting".
int setting = SwitchSetting;
if(setting < ((int)(TraceLevel.Off)) ||
setting > ((int)(TraceLevel.Verbose)))
{
Trace.WriteLine(String.Format(S._("ArgRange_SwitchValue"),
setting, DisplayName));
SwitchSetting = (int)(TraceLevel.Off);
}
}
}; // class TraceSwitch
#endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
Index: Debug.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/Debug.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Debug.cs 12 Jan 2003 06:47:02 -0000 1.2
--- Debug.cs 11 Apr 2003 07:52:38 -0000 1.3
***************
*** 1,9 ****
/*
! * Debug.cs - Implementation of "System.Diagnostics.Debug"
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
! * Copyright (C) 2002 FSF.
! *
! * Authors : Autogenerated using csdoc2stub
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * Debug.cs - Implementation of the
! * "System.Diagnostics.Debug" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 25,327 ****
{
! using System;
#define DEBUG
public sealed class Debug
{
! // Internal state.
! private static bool autoFlush = true;
! private static int indentLevel = 0;
! private static int indentSize = 4;
!
! // Cannot construct instances of this class.
private Debug() {}
! // Assert a condition, exiting the application if it is false.
! [Conditional("DEBUG")]
! public static void Assert(bool condition)
{
! if(!condition)
{
! Fail(String.Empty);
}
}
! [Conditional("DEBUG")]
! public static void Assert(bool condition, String message)
{
! if(!condition)
{
! Fail(message);
}
}
! [Conditional("DEBUG")]
! public static void Assert
! (bool condition, String message, String
detailMessage)
{
! if(!condition)
{
! Fail(message, detailMessage);
}
}
! // Close the trace output stream.
[Conditional("DEBUG")]
public static void Close()
{
! // Nothing to do here.
}
! // Report a debugging failure and exit the application.
[Conditional("DEBUG")]
public static void Fail(String message)
{
! Fail(message, String.Empty);
}
[Conditional("DEBUG")]
public static void Fail(String message, String detailMessage)
{
! // Print the failure message details.
! if(message != null && message != String.Empty)
! {
! WriteLine(message);
! }
! if(detailMessage != null && detailMessage !=
String.Empty)
! {
! WriteLine(detailMessage);
! }
!
! // Print the stack trace for the failure.
! Write((new StackTrace()).ToString());
! Flush();
!
! // Abort the application.
! Environment.Exit(1);
}
! // Flush the trace output stream.
[Conditional("DEBUG")]
public static void Flush()
{
! Console.Error.Flush();
}
! // Go in one indent level within the trace output stream.
[Conditional("DEBUG")]
public static void Indent()
{
! IndentLevel += 1;
}
! // Go out one indent level within the trace output stream.
[Conditional("DEBUG")]
public static void Unindent()
{
! IndentLevel -= 1;
}
! // Write data to the trace output stream.
[Conditional("DEBUG")]
public static void Write(Object value)
{
! if(value != null)
! {
! Write(value.ToString());
! }
}
- [TODO]
[Conditional("DEBUG")]
public static void Write(String message)
{
! Console.Error.Write(message);
}
[Conditional("DEBUG")]
public static void Write(Object value, String category)
{
! if(category == null)
! {
! Write(value);
! }
! else
! {
! Write((value != null ? value.ToString()
: String.Empty),
! category);
! }
}
[Conditional("DEBUG")]
public static void Write(String message, String category)
{
! if(category == null)
! {
! Write(message);
! }
! else
! {
! Write(category + ": " +
! (message != null ? message :
String.Empty));
! }
}
! // Write a debugging message if a condition is true.
[Conditional("DEBUG")]
public static void WriteIf(bool condition, Object value)
{
! if(condition)
! {
! Write(value);
! }
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, String message)
{
! if(condition)
! {
! Write(message);
! }
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, Object value, String
category)
{
! if(condition)
! {
! Write(value, category);
! }
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, String message, String
category)
{
! if(condition)
! {
! Write(message, category);
! }
}
! // Write a message to the debug output stream followed by newline.
[Conditional("DEBUG")]
public static void WriteLine(Object value)
{
! if(value != null)
! {
! WriteLine(value.ToString());
! }
}
- [TODO]
[Conditional("DEBUG")]
public static void WriteLine(String message)
{
! Console.Error.WriteLine(message);
}
[Conditional("DEBUG")]
public static void WriteLine(Object value, String category)
{
! if(category == null)
! {
! WriteLine(value);
! }
! else
! {
! WriteLine((value != null ?
!
value.ToString() : String.Empty),
! category);
! }
}
[Conditional("DEBUG")]
public static void WriteLine(String message, String category)
{
! if(category == null)
! {
! WriteLine(message);
! }
! else
! {
! WriteLine(category + ": " +
! (message != null ?
message : String.Empty));
! }
}
! // Write a debugging message if a condition is true, followed by
newline.
[Conditional("DEBUG")]
public static void WriteLineIf(bool condition, Object value)
{
! if(condition)
! {
! WriteLine(value);
! }
}
[Conditional("DEBUG")]
public static void WriteLineIf(bool condition, String message)
{
! if(condition)
! {
! WriteLine(message);
! }
}
[Conditional("DEBUG")]
public static void WriteLineIf
! (bool condition, Object value, String
category)
{
! if(condition)
! {
! WriteLine(value, category);
! }
}
[Conditional("DEBUG")]
public static void WriteLineIf
! (bool condition, String message, String
category)
! {
! if(condition)
! {
! WriteLine(message, category);
! }
! }
!
! // Get or set the message auto-flush state.
! public static bool AutoFlush
! {
! get
! {
! return autoFlush;
! }
! set
! {
! autoFlush = value;
! }
! }
!
! // Change the indent level for output messages.
! public static int IndentLevel
! {
! get
! {
! return indentLevel;
! }
! set
! {
! if(value < 0)
! {
! value = 0;
! }
! indentLevel = value;
! }
! }
!
! // Set the size of output message indenting.
! public static int IndentSize
{
! get
! {
! return indentSize;
! }
! set
! {
! if(value < 0)
! {
! value = 0;
! }
! indentSize = value;
! }
}
}; // class Debug
}; // namespace System.Diagnostics
--- 23,229 ----
{
! #if !ECMA_COMPAT
#define DEBUG
+ #define TRACE
public sealed class Debug
{
! // This class cannot be instantiated.
private Debug() {}
! // Global trace properties.
! public static bool AutoFlush
{
! get
! {
! return Trace.AutoFlush;
! }
! set
{
! Trace.AutoFlush = value;
}
}
! public static int IndentLevel
! {
! get
! {
! return Trace.IndentLevel;
! }
! set
! {
! Trace.IndentLevel = value;
! }
! }
! public static int IndentSize
{
! get
{
! return Trace.IndentSize;
! }
! set
! {
! Trace.IndentSize = value;
}
}
! public static TraceListenerCollection Listeners
{
! get
{
! return Trace.Listeners;
}
}
! // Assert on a particular condition.
! [Conditional("DEBUG")]
! public static void Assert(bool condition)
! {
! Trace.Assert(condition);
! }
! [Conditional("DEBUG")]
! public static void Assert(bool condition, String message)
! {
! Trace.Assert(condition, message);
! }
! [Conditional("DEBUG")]
! public static void Assert(bool condition, String message,
! String detailMessage)
! {
! Trace.Assert(condition, message, detailMessage);
! }
!
! // Flush and close all listeners.
[Conditional("DEBUG")]
public static void Close()
{
! Trace.Close();
}
! // Record that some condition has failed.
[Conditional("DEBUG")]
public static void Fail(String message)
{
! Trace.Fail(message);
}
[Conditional("DEBUG")]
public static void Fail(String message, String detailMessage)
{
! Trace.Fail(message, detailMessage);
}
! // Flush all trace listeners.
[Conditional("DEBUG")]
public static void Flush()
{
! Trace.Flush();
}
! // Increase the indent level by one.
[Conditional("DEBUG")]
public static void Indent()
{
! Trace.Indent();
}
! // Decrease the indent level by one.
[Conditional("DEBUG")]
public static void Unindent()
{
! Trace.Unindent();
}
! // Write a message to all trace listeners.
[Conditional("DEBUG")]
public static void Write(Object value)
{
! Trace.Write(value);
}
[Conditional("DEBUG")]
public static void Write(String message)
{
! Trace.Write(message);
}
[Conditional("DEBUG")]
public static void Write(Object value, String category)
{
! Trace.Write(value, category);
}
[Conditional("DEBUG")]
public static void Write(String message, String category)
{
! Trace.Write(message, category);
}
! // Write a message to all trace listeners if a condition is true.
[Conditional("DEBUG")]
public static void WriteIf(bool condition, Object value)
{
! Trace.WriteIf(condition, value);
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, String message)
{
! Trace.WriteIf(condition, message);
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, Object value, String
category)
{
! Trace.WriteIf(condition, value, category);
}
[Conditional("DEBUG")]
public static void WriteIf(bool condition, String message, String
category)
{
! Trace.WriteIf(condition, message, category);
}
! // Write a message to all trace listeners.
[Conditional("DEBUG")]
public static void WriteLine(Object value)
{
! Trace.WriteLine(value);
}
[Conditional("DEBUG")]
public static void WriteLine(String message)
{
! Trace.WriteLine(message);
}
[Conditional("DEBUG")]
public static void WriteLine(Object value, String category)
{
! Trace.WriteLine(value, category);
}
[Conditional("DEBUG")]
public static void WriteLine(String message, String category)
{
! Trace.WriteLine(message, category);
}
! // Write a message to all trace listeners if a condition is true.
[Conditional("DEBUG")]
public static void WriteLineIf(bool condition, Object value)
{
! Trace.WriteLineIf(condition, value);
}
[Conditional("DEBUG")]
public static void WriteLineIf(bool condition, String message)
{
! Trace.WriteLineIf(condition, message);
}
[Conditional("DEBUG")]
public static void WriteLineIf
! (bool condition, Object value, String category)
{
! Trace.WriteLineIf(condition, value, category);
}
[Conditional("DEBUG")]
public static void WriteLineIf
! (bool condition, String message, String
category)
{
! Trace.WriteLineIf(condition, message, category);
}
}; // class Debug
+
+ #endif // !ECMA_COMPAT
}; // namespace System.Diagnostics
Index: ProcessWindowStyle.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/ProcessWindowStyle.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ProcessWindowStyle.cs 10 Jan 2003 23:33:31 -0000 1.2
--- ProcessWindowStyle.cs 11 Apr 2003 07:52:38 -0000 1.3
***************
*** 1,9 ****
/*
! * ProcessWindowStyle.cs - Implementation of
! *
"System.Diagnostics.ProcessWindowStyle" enum
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
! *
! * contributed by Gopal.V
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * ProcessWindowStyle.cs - Implementation of the
! * "System.Diagnostics.ProcessWindowStyle" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 22,35 ****
*/
- using System;
-
namespace System.Diagnostics
{
! public enum ProcessWindowStyle
! {
! Normal=0x00,
! Hidden=0x01,
! Minimized=0x02,
! Maximized=0x03,
! }
! }//namespace
--- 20,39 ----
*/
namespace System.Diagnostics
{
!
! #if !ECMA_COMPAT
!
! [Serializable]
! public enum ProcessWindowStyle
! {
! Normal = 0,
! Hidden = 1,
! Minimized = 2,
! Maximized = 3
!
! }; // enum ProcessWindowStyle
!
! #endif // !ECMA_COMPAT
!
! }; // namespace System.Diagnostics
Index: Trace.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/Trace.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Trace.cs 4 Jan 2003 17:02:59 -0000 1.1
--- Trace.cs 11 Apr 2003 07:52:38 -0000 1.2
***************
*** 1,8 ****
/*
! * Trace.cs - Implementation of "System.Diagnostics.Trace"
*
! * Copyright (C) 2002 Southern Storm Software, Pty Ltd.
! *
! * Contributed by Gopal.V
*
* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
/*
! * Trace.cs - Implementation of the
! * "System.Diagnostics.Trace" class.
*
! * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
***************
*** 21,232 ****
*/
- using System;
-
namespace System.Diagnostics
{
! public sealed class Trace
! {
! [TODO]
! public static void Assert(bool condition)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Assert(bool condition, String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Assert(bool condition, String message,
String detailMessage)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Close()
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Fail(String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Fail(String message, String detailMessage)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Flush()
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Indent()
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Unindent()
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Write(Object value)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Write(String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Write(Object value, String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void Write(String message, String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteIf(bool condition, Object value)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteIf(bool condition, String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteIf(bool condition, Object value, String
category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteIf(bool condition, String message,
String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLine(Object value)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLine(String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLine(Object value, String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLine(String message, String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLineIf(bool condition, Object value)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLineIf(bool condition, String message)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLineIf(bool condition, Object value,
String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static void WriteLineIf(bool condition, String message,
String category)
! {
! /*TODO: Implement this */
! }
!
! [TODO]
! public static bool AutoFlush
! {
! get
! {
! return false;
! /*TODO: Implement this */
! }
! set
! {
! /*TODO: Implement this */
! }
! }
!
! [TODO]
! public static int IndentLevel
! {
! get
! {
! return 0;
! /*TODO: Implement this */
! }
! set
! {
! /*TODO: Implement this */
! }
! }
!
! [TODO]
! public static int IndentSize
! {
! get
! {
! return 4;
! /*TODO: Implement this */
! }
! set
! {
! /*TODO: Implement this */
! }
! }
! #if false
! [TODO]
! public static TraceListenerCollection Listeners
! {
! get
{
! /*TODO: Implement this */
}
! }
! #endif
! }
! }//namespace
--- 20,378 ----
*/
namespace System.Diagnostics
{
!
! #if !ECMA_COMPAT
!
! #define TRACE
!
! public sealed class Trace
! {
! // Internal state.
! private static bool autoFlush;
! private static int indentLevel;
! private static int indentSize = 4;
! private static TraceListenerCollection listeners;
!
! // This class cannot be instantiated.
! private Trace() {}
!
! // Global trace properties.
! public static bool AutoFlush
! {
! get
! {
! lock(typeof(Trace))
! {
! return autoFlush;
! }
! }
! set
! {
! lock(typeof(Trace))
! {
! autoFlush = value;
! }
! }
! }
! public static int IndentLevel
! {
! get
! {
! lock(typeof(Trace))
! {
! return indentLevel;
! }
! }
! set
! {
! lock(typeof(Trace))
! {
! if(value < 0)
! {
! value = 0;
! }
! indentLevel = value;
! foreach(TraceListener listener
in Listeners)
! {
! listener.IndentLevel =
value;
! }
! }
! }
! }
! public static int IndentSize
! {
! get
! {
! lock(typeof(Trace))
! {
! return indentSize;
! }
! }
! set
! {
! lock(typeof(Trace))
! {
! if(value < 0)
! {
! value = 0;
! }
! indentSize = value;
! foreach(TraceListener listener
in Listeners)
! {
! listener.IndentSize =
value;
! }
! }
! }
! }
! public static TraceListenerCollection Listeners
! {
! get
! {
! lock(typeof(Trace))
! {
! if(listeners == null)
! {
! listeners = new
TraceListenerCollection();
! listeners.Add(new
DefaultTraceListener());
! }
! return listeners;
! }
! }
! }
!
! // Assert on a particular condition.
! [Conditional("TRACE")]
! public static void Assert(bool condition)
! {
! if(!condition)
! {
! Fail(String.Empty, null);
! }
! }
! [Conditional("TRACE")]
! public static void Assert(bool condition, String message)
! {
! if(!condition)
! {
! Fail(message, null);
! }
! }
! [Conditional("TRACE")]
! public static void Assert(bool condition, String message,
! String detailMessage)
! {
! if(!condition)
! {
! Fail(message, detailMessage);
! }
! }
!
! // Flush and close all listeners.
! [Conditional("TRACE")]
! public static void Close()
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Close();
! }
! }
!
! // Record that some condition has failed.
! [Conditional("TRACE")]
! public static void Fail(String message)
{
! Fail(message, null);
}
! [Conditional("TRACE")]
! public static void Fail(String message, String detailMessage)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Fail(message, detailMessage);
! }
! }
!
! // Flush all trace listeners.
! [Conditional("TRACE")]
! public static void Flush()
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Flush();
! }
! }
!
! // Increase the indent level by one.
! [Conditional("TRACE")]
! public static void Indent()
! {
! IndentLevel = IndentLevel + 1;
! }
!
! // Decrease the indent level by one.
! [Conditional("TRACE")]
! public static void Unindent()
! {
! int level = IndentLevel - 1;
! if(level >= 0)
! {
! IndentLevel = level;
! }
! }
!
! // Write a message to all trace listeners.
! [Conditional("TRACE")]
! public static void Write(Object value)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Write(value);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void Write(String message)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Write(message);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void Write(Object value, String category)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Write(value, category);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void Write(String message, String category)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.Write(message, category);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
!
! // Write a message to all trace listeners if a condition is true.
! [Conditional("TRACE")]
! public static void WriteIf(bool condition, Object value)
! {
! if(condition)
! {
! Write(value);
! }
! }
! [Conditional("TRACE")]
! public static void WriteIf(bool condition, String message)
! {
! if(condition)
! {
! Write(message);
! }
! }
! [Conditional("TRACE")]
! public static void WriteIf(bool condition, Object value, String
category)
! {
! if(condition)
! {
! Write(value, category);
! }
! }
! [Conditional("TRACE")]
! public static void WriteIf(bool condition, String message, String
category)
! {
! if(condition)
! {
! Write(message, category);
! }
! }
!
! // Write a message to all trace listeners.
! [Conditional("TRACE")]
! public static void WriteLine(Object value)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.WriteLine(value);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void WriteLine(String message)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.WriteLine(message);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void WriteLine(Object value, String category)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.WriteLine(value, category);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
! [Conditional("TRACE")]
! public static void WriteLine(String message, String category)
! {
! foreach(TraceListener listener in Listeners)
! {
! listener.WriteLine(message, category);
! if(AutoFlush)
! {
! listener.Flush();
! }
! }
! }
!
! // Write a message to all trace listeners if a condition is true.
! [Conditional("TRACE")]
! public static void WriteLineIf(bool condition, Object value)
! {
! if(condition)
! {
! WriteLine(value);
! }
! }
! [Conditional("TRACE")]
! public static void WriteLineIf(bool condition, String message)
! {
! if(condition)
! {
! WriteLine(message);
! }
! }
! [Conditional("TRACE")]
! public static void WriteLineIf
! (bool condition, Object value, String category)
! {
! if(condition)
! {
! WriteLine(value, category);
! }
! }
! [Conditional("TRACE")]
! public static void WriteLineIf
! (bool condition, String message, String
category)
! {
! if(condition)
! {
! WriteLine(message, category);
! }
! }
!
! }; // class Trace
!
! #endif // !ECMA_COMPAT
! }; // namespace System.Diagnostics
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics BooleanSwitch.cs,NONE,1.1 CounterCreationData.cs,NONE,1.1 CounterCreationDataCollection.cs,NONE,1.1 CounterSample.cs,NONE,1.1 CounterSampleCalculator.cs,NONE,1.1 DefaultTraceListener.cs,NONE,1.1 EntryWrittenEventArgs.cs,NONE,1.1 EntryWrittenEventHandler.cs,NONE,1.1 EventLog.cs,NONE,1.1 EventLogEntry.cs,NONE,1.1 EventLogEntryCollection.cs,NONE,1.1 EventLogEntryType.cs,NONE,1.1 EventLogInstaller.cs,NONE,1.1 EventLogPermissionAccess.cs,NONE,1.1 FileVersionInfo.cs,NONE,1.1 InstanceData.cs,NONE,1.1 InstanceDataCollection.cs,NONE,1.1 InstanceDataCollectionCollection.cs,NONE,1.1 Makefile,NONE,1.1 MonitoringDescriptionAttribute.cs,NONE,1.1PerformanceCounter.cs,NONE,1.1 PerformanceCounterCategory.cs,NONE,1.1 PerformanceCounterPermissionAccess.cs,NONE,1.1 PerformanceCounterType.cs,NONE,1.1 ProcessPriorityClass.cs,NONE,1.1 Switch.cs,NONE,1.1 TextWriterTraceListener.cs,NONE,1.1 ThreadPriorityLevel.cs,NONE,1.1 ThreadState.cs,NONE,1.1 ThreadWaitReason.cs,NONE,1.1 TraceLevel.cs,NONE,1.1 TraceListener.cs,NONE,1.1 TraceListenerCollection.cs,NONE,1.1 TraceSwitch.cs,NONE,1.1 Debug.cs,1.2,1.3 ProcessWindowStyle.cs,1.2,1.3 Trace.cs,1.1,1.2,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/resources/en_US/System Arg.txt,1.13,1.14 Invalid.txt,1.4,1.5
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System System.build,1.14,1.15
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/resources/en_US/System Arg.txt,1.13,1.14 Invalid.txt,1.4,1.5
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System System.build,1.14,1.15
- Index(es):