diff options
author | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-05 19:59:37 +0400 |
---|---|---|
committer | Andreas N <andreas@mono-cvs.ximian.com> | 2003-07-05 19:59:37 +0400 |
commit | e5a860bb93dde764119fc9d6d4157a0d113ca1e9 (patch) | |
tree | c4454d6e01ba050220db483eb2d4f8ee47821d65 /mcs/class/System/System.Diagnostics | |
parent | 05f220be4db886bb777de8f3bed4026105a09b61 (diff) |
2003-07-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* CounterCreationData.cs: Added missing attributes
* CounterSample.cs: Implemented missing rest, fixed signature
* CounterSampleCalculator.cs: Added private constructor, redirected function
* Process.cs: Added attributes, added event mechanism
* ProcessModule.cs: Added missing attributes
* ProcessModuleCollection.cs: Redone using the already inherited-from ArrayList. Simplifies this a LOT
* ProcessStartInfo.cs: Added missing attributes, moved internal fields to the begining of the file, restyling
* ProcessThread.cs: Added missing attributes, added pseudo constructor
* ProcessThreadCollection.cs: Implemented
* PerformanceCounterPermission.cs: Fixed typo in class name
* PerformanceCounterPermissionAccess.cs: Added attributes, fixed wrong member
svn path=/trunk/mcs/; revision=15958
Diffstat (limited to 'mcs/class/System/System.Diagnostics')
12 files changed, 389 insertions, 153 deletions
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog index 764b604afa1..4510bb84903 100644 --- a/mcs/class/System/System.Diagnostics/ChangeLog +++ b/mcs/class/System/System.Diagnostics/ChangeLog @@ -1,3 +1,17 @@ +2003-07-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * CounterCreationData.cs: Added missing attributes + * CounterSample.cs: Implemented missing rest, fixed signature + * CounterSampleCalculator.cs: Added private constructor, redirected function + * Process.cs: Added attributes, added event mechanism + * ProcessModule.cs: Added missing attributes + * ProcessModuleCollection.cs: Redone using the already inherited-from ArrayList. Simplifies this a LOT + * ProcessStartInfo.cs: Added missing attributes, moved internal fields to the begining of the file, restyling + * ProcessThread.cs: Added missing attributes, added pseudo constructor + * ProcessThreadCollection.cs: Implemented + * PerformanceCounterPermission.cs: Fixed typo in class name + * PerformanceCounterPermissionAccess.cs: Added attributes, fixed wrong member + 2003-03-19 Dick Porter <dick@ximian.com> * Process.cs: Implement HasExited, fixes bug 39267 diff --git a/mcs/class/System/System.Diagnostics/CounterCreationData.cs b/mcs/class/System/System.Diagnostics/CounterCreationData.cs index d814e012fea..e132531f172 100644 --- a/mcs/class/System/System.Diagnostics/CounterCreationData.cs +++ b/mcs/class/System/System.Diagnostics/CounterCreationData.cs @@ -3,17 +3,26 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; -using System.Diagnostics; +using System.ComponentModel; namespace System.Diagnostics { [Serializable] - public class CounterCreationData { + #if (NET_1_0) + [TypeConverter ("System.Diagnostics.Design.CounterCreationDataConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [TypeConverter ("System.Diagnostics.Design.CounterCreationDataConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + public class CounterCreationData + { private string help; private string name; @@ -32,17 +41,30 @@ namespace System.Diagnostics { type = counterType; } + [DefaultValue ("")] + [MonitoringDescription ("Description of this counter.")] public string CounterHelp { get {return help;} set {help = value;} } - public string CounterName { + [DefaultValue ("")] + [MonitoringDescription ("Name of this counter.")] + #if (NET_1_0) + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + public string CounterName + { get {return name;} set {name = value;} } // may throw InvalidEnumArgumentException + [DefaultValue (typeof (PerformanceCounterType), "NumberOfItems32")] + [MonitoringDescription ("Type of this counter.")] public PerformanceCounterType CounterType { get {return type;} set {type = value;} diff --git a/mcs/class/System/System.Diagnostics/CounterSample.cs b/mcs/class/System/System.Diagnostics/CounterSample.cs index cf260861f71..4098234786a 100644 --- a/mcs/class/System/System.Diagnostics/CounterSample.cs +++ b/mcs/class/System/System.Diagnostics/CounterSample.cs @@ -3,14 +3,12 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // -using System; -using System.Collections; -using System.Diagnostics; - namespace System.Diagnostics { public struct CounterSample { @@ -24,7 +22,7 @@ namespace System.Diagnostics { private long counterTimeStamp; private PerformanceCounterType counterType; - CounterSample (long rawValue, + public CounterSample (long rawValue, long baseValue, long counterFrequency, long systemFrequency, @@ -37,7 +35,7 @@ namespace System.Diagnostics { { } - CounterSample (long rawValue, + public CounterSample (long rawValue, long baseValue, long counterFrequency, long systemFrequency, @@ -93,18 +91,16 @@ namespace System.Diagnostics { get {return timeStamp100nSec;} } -// [MonoTODO("What's the algorithm?")] -// public static float Calculate (CounterSample counterSample) -// { -// throw new NotSupportedException (); -// } -// -// [MonoTODO("What's the algorithm?")] -// public static float Calculate (CounterSample counterSample, -// CounterSample nextCounterSample) -// { -// throw new NotSupportedException (); -// } + public static float Calculate (CounterSample counterSample) + { + return CounterSampleCalculator.ComputeCounterValue (counterSample); + } + + public static float Calculate (CounterSample counterSample, + CounterSample nextCounterSample) + { + return CounterSampleCalculator.ComputeCounterValue (counterSample, nextCounterSample); + } } } diff --git a/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs b/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs index 81e684444ac..16e88e030a1 100644 --- a/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs +++ b/mcs/class/System/System.Diagnostics/CounterSampleCalculator.cs @@ -3,30 +3,33 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; -using System.Collections; -using System.Diagnostics; namespace System.Diagnostics { public sealed class CounterSampleCalculator { -// [MonoTODO("What's the algorithm?")] -// public static float ComputeCounterValue (CounterSample newSample) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO("What's the algorithm?")] -// public static float ComputeCounterValue (CounterSample oldSample, -// CounterSample newSample) -// { -// throw new NotImplementedException (); -// } + private CounterSampleCalculator () + { + } + + public static float ComputeCounterValue (CounterSample newSample) + { + return ComputeCounterValue (CounterSample.Empty, newSample); + } + + [MonoTODO("What's the algorithm?")] + public static float ComputeCounterValue (CounterSample oldSample, + CounterSample newSample) + { + throw new NotImplementedException (); + } } } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs index b06d637e2fa..d858df63345 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermission.cs @@ -1,5 +1,5 @@ // -// System.Diagnostics.PerformaceCounterPermission.cs +// System.Diagnostics.PerformanceCounterPermission.cs // // Authors: // Jonathan Pryor (jonpryor@vt.edu) @@ -13,7 +13,7 @@ using System.Security.Permissions; namespace System.Diagnostics { - public class PerformaceCounterPermission : ResourcePermissionBase { + public class PerformanceCounterPermission : ResourcePermissionBase { // public PerformaceCounterPermission () // { diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs index 127bcd5f4f1..32fe87999a9 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterPermissionAccess.cs @@ -3,8 +3,10 @@ // // Authors: // Jonathan Pryor (jonpryor@vt.edu) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 +// (C) 2003 Andreas Nahr // using System; @@ -12,8 +14,9 @@ using System.Diagnostics; namespace System.Diagnostics { + [Flags ()] public enum PerformanceCounterPermissionAccess { - Administrator=0x0E, + Administer=0x0E, Browse=0x02, Instrument=0x06, None=0x00 diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs index 2e2bb4843a7..5084af506a4 100755 --- a/mcs/class/System/System.Diagnostics/Process.cs +++ b/mcs/class/System/System.Diagnostics/Process.cs @@ -3,21 +3,33 @@ // // Authors: // Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. +// (C) 2003 Andreas Nahr // using System; using System.IO; using System.ComponentModel; +using System.ComponentModel.Design; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Collections; namespace System.Diagnostics { - public class Process : Component { + [DefaultEvent ("Exited"), DefaultProperty ("StartInfo"), DesignerCategory ("Component")] + #if (NET_1_0) + [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + #if (NET_1_1) + [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + public class Process : Component + { [StructLayout(LayoutKind.Sequential)] - private struct ProcInfo { + private struct ProcInfo + { public IntPtr process_handle; public IntPtr thread_handle; public int pid; @@ -38,6 +50,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Base process priority.")] public int BasePriority { get { return(0); @@ -45,6 +59,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DefaultValue (false), Browsable (false)] + [MonitoringDescription ("Check for exiting of the process to raise the apropriate event.")] public bool EnableRaisingEvents { get { return(false); @@ -56,6 +72,8 @@ namespace System.Diagnostics { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static int ExitCode_internal(IntPtr handle); + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The exit code of the process.")] public int ExitCode { get { return(ExitCode_internal(process_handle)); @@ -68,12 +86,16 @@ namespace System.Diagnostics { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static long ExitTime_internal(IntPtr handle); + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The exit time of the process.")] public DateTime ExitTime { get { return(DateTime.FromFileTime(ExitTime_internal(process_handle))); } } + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("Handle for this process.")] public IntPtr Handle { get { return(process_handle); @@ -81,12 +103,16 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Handles for this process.")] public int HandleCount { get { return(0); } } + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("Determines if the process is still running.")] public bool HasExited { get { int exitcode=ExitCode; @@ -100,6 +126,8 @@ namespace System.Diagnostics { } } + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Process identifier.")] public int Id { get { return(pid); @@ -107,12 +135,16 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The name of the computer running the process.")] public string MachineName { get { return("localhost"); } } + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The main module of the process.")] public ProcessModule MainModule { get { return(this.Modules[0]); @@ -120,6 +152,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The handle of the main window of the process.")] public IntPtr MainWindowHandle { get { return((IntPtr)0); @@ -127,6 +161,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The title of the main window of the process.")] public string MainWindowTitle { get { return("null"); @@ -139,6 +175,8 @@ namespace System.Diagnostics { private extern static bool SetWorkingSet_internal(IntPtr handle, int min, int max, bool use_min); /* LAMESPEC: why is this an IntPtr not a plain int? */ + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The maximum working set for this process.")] public IntPtr MaxWorkingSet { get { if(HasExited) { @@ -166,6 +204,8 @@ namespace System.Diagnostics { } } + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The minimum working set for this process.")] public IntPtr MinWorkingSet { get { if(HasExited) { @@ -201,6 +241,8 @@ namespace System.Diagnostics { private ProcessModuleCollection module_collection; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The modules that are loaded as part of this process.")] public ProcessModuleCollection Modules { get { if(module_collection==null) { @@ -212,6 +254,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The number of bytes that are not pageable.")] public int NonpagedSystemMemorySize { get { return(0); @@ -219,6 +263,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The number of bytes that are paged.")] public int PagedMemorySize { get { return(0); @@ -226,6 +272,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The amount of paged system memory in bytes.")] public int PagedSystemMemorySize { get { return(0); @@ -233,6 +281,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The maximum amount of paged memory used by this process.")] public int PeakPagedMemorySize { get { return(0); @@ -240,6 +290,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The maximum amount of virtual memory used by this process.")] public int PeakVirtualMemorySize { get { return(0); @@ -247,6 +299,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The maximum amount of system memory used by this process.")] public int PeakWorkingSet { get { return(0); @@ -254,6 +308,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Process will be of higher priority while it is actively used.")] public bool PriorityBoostEnabled { get { return(false); @@ -263,6 +319,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The relative process priority.")] public ProcessPriorityClass PriorityClass { get { return(ProcessPriorityClass.Normal); @@ -272,6 +330,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The amount of memory exclusively used by this process.")] public int PrivateMemorySize { get { return(0); @@ -279,6 +339,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The amount of processing time spent is the OS core for this process.")] public TimeSpan PrivilegedProcessorTime { get { return(new TimeSpan(0)); @@ -290,6 +352,8 @@ namespace System.Diagnostics { private string process_name=null; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The name of this process.")] public string ProcessName { get { if(process_name==null) { @@ -320,6 +384,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Allowed processor that can be used by this process.")] public IntPtr ProcessorAffinity { get { return((IntPtr)0); @@ -329,6 +395,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("Is this process responsive.")] public bool Responding { get { return(false); @@ -337,6 +405,8 @@ namespace System.Diagnostics { private StreamReader error_stream=null; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The standard error stream of this process.")] public StreamReader StandardError { get { return(error_stream); @@ -345,6 +415,8 @@ namespace System.Diagnostics { private StreamWriter input_stream=null; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The standard input stream of this process.")] public StreamWriter StandardInput { get { return(input_stream); @@ -353,6 +425,8 @@ namespace System.Diagnostics { private StreamReader output_stream=null; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The standard output stream of this process.")] public StreamReader StandardOutput { get { return(output_stream); @@ -361,6 +435,8 @@ namespace System.Diagnostics { private ProcessStartInfo start_info=null; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("Information for the start of this process.")] public ProcessStartInfo StartInfo { get { if(start_info==null) { @@ -384,6 +460,8 @@ namespace System.Diagnostics { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static long StartTime_internal(IntPtr handle); + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The time this process started.")] public DateTime StartTime { get { return(DateTime.FromFileTime(StartTime_internal(process_handle))); @@ -391,6 +469,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The object that is used to synchronize event handler calls for this process.")] public ISynchronizeInvoke SynchronizingObject { get { return(null); @@ -400,6 +480,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + [MonitoringDescription ("The number of threads of this process.")] public ProcessThreadCollection Threads { get { return(null); @@ -407,6 +489,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The total CPU time spent for this process.")] public TimeSpan TotalProcessorTime { get { return(new TimeSpan(0)); @@ -414,6 +498,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The CPU time spent for this process in user mode.")] public TimeSpan UserProcessorTime { get { return(new TimeSpan(0)); @@ -421,6 +507,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The amount of virtual memory currently used for this process.")] public int VirtualMemorySize { get { return(0); @@ -428,6 +516,8 @@ namespace System.Diagnostics { } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [MonitoringDescription ("The amount of physical memory currently used for this process.")] public int WorkingSet { get { return(0); @@ -691,7 +781,8 @@ namespace System.Diagnostics { return(false); } - [MonoTODO] + [Category ()] + [MonitoringDescription ("Raised when this process exits.")] public event EventHandler Exited; // Closes the system process handle @@ -723,8 +814,10 @@ namespace System.Diagnostics { base.Dispose (disposing); } - [MonoTODO] - protected void OnExited() { + protected void OnExited() + { + if (Exited != null) + Exited (this, EventArgs.Empty); } } } diff --git a/mcs/class/System/System.Diagnostics/ProcessModule.cs b/mcs/class/System/System.Diagnostics/ProcessModule.cs index a2b17a43f16..c31259ffda6 100755 --- a/mcs/class/System/System.Diagnostics/ProcessModule.cs +++ b/mcs/class/System/System.Diagnostics/ProcessModule.cs @@ -3,15 +3,27 @@ // // Authors: // Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. +// (C) 2003 Andreas Nahr // using System; using System.ComponentModel; +using System.ComponentModel.Design; -namespace System.Diagnostics { - public class ProcessModule : Component { +namespace System.Diagnostics +{ + [DesignerCategory ("Component")] + #if (NET_1_0) + [Designer ("System.Diagnostics.Design.ProcessModuleDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + #if (NET_1_1) + [Designer ("System.Diagnostics.Design.ProcessModuleDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + public class ProcessModule : Component + { private IntPtr baseaddr; private IntPtr entryaddr; private string filename; @@ -29,38 +41,44 @@ namespace System.Diagnostics { this.version_info=version_info; this.memory_size=memory_size; this.modulename=modulename; - } + } + [MonitoringDescription ("The base memory address of this module")] public IntPtr BaseAddress { get { return(baseaddr); } } + [MonitoringDescription ("The base memory address of the entry point of this module")] public IntPtr EntryPointAddress { get { return(entryaddr); } } + [MonitoringDescription ("The file name of this module")] public string FileName { get { return(filename); } } + [Browsable (false)] public FileVersionInfo FileVersionInfo { get { return(version_info); } } + [MonitoringDescription ("The memory needed by this module")] public int ModuleMemorySize { get { return(memory_size); } } + [MonitoringDescription ("The name of this module")] public string ModuleName { get { return(modulename); diff --git a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs index c9ebdcefd5a..14ebe2f71d2 100755 --- a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs +++ b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs @@ -2,56 +2,47 @@ // System.Diagnostics.ProcessModuleCollection.cs // // Authors: -// Dick Porter (dick@ximian.com) +// Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. http://www.ximian.com // using System.Collections; -namespace System.Diagnostics { - public class ProcessModuleCollection : ReadOnlyCollectionBase { - private ProcessModule[] modules; +namespace System.Diagnostics +{ + public class ProcessModuleCollection : ReadOnlyCollectionBase + { - [MonoTODO] - protected ProcessModuleCollection() { + protected ProcessModuleCollection() + { } - public ProcessModuleCollection(ProcessModule[] processModules) { - modules=processModules; + public ProcessModuleCollection(ProcessModule[] processModules) + { + InnerList.AddRange (processModules); } public ProcessModule this[int index] { get { - return(modules[index]); + return (ProcessModule)InnerList[index]; } } - public bool Contains(ProcessModule module) { - foreach(ProcessModule test in modules) { - if(module==test) { - return(true); - } - } - - return(false); + public bool Contains(ProcessModule module) + { + return InnerList.Contains (module); } - [MonoTODO] - public void CopyTo(ProcessModule[] array, int index) { + public void CopyTo(ProcessModule[] array, int index) + { + InnerList.CopyTo (array, index); } - public int IndexOf(ProcessModule module) { - int i; - - for(i=0; i<modules.Length; i++) { - if(modules[i]==module) { - return(i); - } - } - - // FIXME! - return(0); + public int IndexOf(ProcessModule module) + { + return InnerList.IndexOf (module); } } } diff --git a/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs index b519442bf9f..5c3a5d01baf 100755 --- a/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs +++ b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs @@ -2,169 +2,228 @@ // System.Diagnostics.ProcessStartInfo.cs // // Authors: -// Dick Porter (dick@ximian.com) +// Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. http://www.ximian.com // +using System.ComponentModel; using System.Collections.Specialized; -namespace System.Diagnostics { - public sealed class ProcessStartInfo { - public ProcessStartInfo() { - } - - public ProcessStartInfo(string filename) { - this.filename=filename; - } - - public ProcessStartInfo(string filename, string arguments) { - this.filename=filename; - this.arguments=arguments; - } - - private string arguments=""; - +namespace System.Diagnostics +{ + [TypeConverter (typeof (ExpandableObjectConverter))] + public sealed class ProcessStartInfo + { + + private string arguments = ""; + private bool create_no_window = false; + private bool error_dialog = false; + private IntPtr error_dialog_parent_handle = (IntPtr)0; + private string filename = ""; + private bool redirect_standard_error = false; + private bool redirect_standard_input = false; + private bool redirect_standard_output = false; + private bool use_shell_execute = true; + private string verb = ""; + private ProcessWindowStyle window_style = ProcessWindowStyle.Normal; + private string working_directory = ""; + + public ProcessStartInfo() + { + } + + public ProcessStartInfo(string filename) + { + this.filename = filename; + } + + public ProcessStartInfo(string filename, string arguments) + { + this.filename = filename; + this.arguments = arguments; + } + + [RecommendedAsConfigurable (true), DefaultValue ("")] + #if (NET_1_0) + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + [MonitoringDescription ("Command line agruments for this process.")] public string Arguments { get { return(arguments); } set { - arguments=value; + arguments = value; } } - - private bool create_no_window=false; + [DefaultValue (false)] + [MonitoringDescription ("Start this process with a new window.")] public bool CreateNoWindow { get { return(create_no_window); } set { - create_no_window=value; + create_no_window = value; } } [MonoTODO("Need to read the env block somehow")] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content), DefaultValue (null)] + #if (NET_1_0) + [Editor ("System.Diagnostics.Design.StringDictionaryEditor, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [Editor ("System.Diagnostics.Design.StringDictionaryEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + [MonitoringDescription ("Environment variables used for this process.")] public StringDictionary EnvironmentVariables { get { throw new NotImplementedException(); } } - private bool error_dialog=false; + [DefaultValue (false)] + [MonitoringDescription ("Thread shows dialogboxes for errors.")] public bool ErrorDialog { get { return(error_dialog); } set { - error_dialog=value; + error_dialog = value; } } - - private IntPtr error_dialog_parent_handle=(IntPtr)0; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] public IntPtr ErrorDialogParentHandle { get { return(error_dialog_parent_handle); } set { - error_dialog_parent_handle=value; + error_dialog_parent_handle = value; } } - - private string filename=""; + [RecommendedAsConfigurable (true), DefaultValue ("")] + #if (NET_1_0) + [Editor ("System.Diagnostics.Design.StartFileNameEditor, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [Editor ("System.Diagnostics.Design.StartFileNameEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + [MonitoringDescription ("The name of the resource to start this process.")] public string FileName { get { return(filename); } set { - filename=value; + filename = value; } } - - private bool redirect_standard_error=false; + [DefaultValue (false)] + [MonitoringDescription ("Errors of this process are redirected.")] public bool RedirectStandardError { get { return(redirect_standard_error); } set { - redirect_standard_error=value; + redirect_standard_error = value; } } - - private bool redirect_standard_input=false; + [DefaultValue (false)] + [MonitoringDescription ("Standard input of this process is redirected.")] public bool RedirectStandardInput { get { return(redirect_standard_input); } set { - redirect_standard_input=value; + redirect_standard_input = value; } } - - private bool redirect_standard_output=false; + [DefaultValue (false)] + [MonitoringDescription ("Standart output of this process is redirected.")] public bool RedirectStandardOutput { get { return(redirect_standard_output); } set { - redirect_standard_output=value; + redirect_standard_output = value; } } - - private bool use_shell_execute=true; + [DefaultValue (true)] + [MonitoringDescription ("Use the shell to start this process.")] public bool UseShellExecute { get { return(use_shell_execute); } set { - use_shell_execute=value; + use_shell_execute = value; } } - - private string verb=""; + [RecommendedAsConfigurable (true), DefaultValue ("")] + #if (NET_1_0) + [TypeConverter ("System.Diagnostics.Design.VerbConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [TypeConverter ("System.Diagnostics.Design.VerbConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + [MonitoringDescription ("The verb to apply to a used document.")] public string Verb { get { return(verb); } set { - verb=value; + verb = value; } } [MonoTODO] + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] public string[] Verbs { get { return(null); } } - - private ProcessWindowStyle window_style=ProcessWindowStyle.Normal; + [DefaultValue (typeof (ProcessWindowStyle), "Normal")] + [MonitoringDescription ("The window style used to start this process.")] public ProcessWindowStyle WindowStyle { get { return(window_style); } set { - window_style=value; + window_style = value; } } - - private string working_directory=""; + [RecommendedAsConfigurable (true), DefaultValue ("")] + #if (NET_1_0) + [Editor ("System.Diagnostics.Design.WorkingDirectoryEditor, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + #if (NET_1_1) + [Editor ("System.Diagnostics.Design.WorkingDirectoryEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [TypeConverter ("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + #endif + [MonitoringDescription ("The initial directory for this process.")] public string WorkingDirectory { get { return(working_directory); } set { - working_directory=value; + working_directory = value; } } } diff --git a/mcs/class/System/System.Diagnostics/ProcessThread.cs b/mcs/class/System/System.Diagnostics/ProcessThread.cs index bbc6d56eb97..024d5b7a537 100755 --- a/mcs/class/System/System.Diagnostics/ProcessThread.cs +++ b/mcs/class/System/System.Diagnostics/ProcessThread.cs @@ -2,16 +2,34 @@ // System.Diagnostics.ProcessThread.cs // // Authors: -// Dick Porter (dick@ximian.com) +// Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. http://www.ximian.com // using System.ComponentModel; +using System.ComponentModel.Design; + +namespace System.Diagnostics +{ + [DesignerCategory ("Component")] + #if (NET_1_0) + [Designer ("System.Diagnostics.Design.ProcessThreadDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + #if (NET_1_1) + [Designer ("System.Diagnostics.Design.ProcessThreadDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))] + #endif + public class ProcessThread : Component + { + + [MonoTODO ("Parse parameters")] + internal ProcessThread() + { + } -namespace System.Diagnostics { - public class ProcessThread : Component { [MonoTODO] + [MonitoringDescription ("The base priority of this thread.")] public int BasePriority { get { return(0); @@ -19,6 +37,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The current priority of this thread.")] public int CurrentPriority { get { return(0); @@ -26,6 +45,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The ID of this thread.")] public int Id { get { return(0); @@ -33,12 +53,14 @@ namespace System.Diagnostics { } [MonoTODO] + [Browsable (false)] int IdealProcessor { set { } } [MonoTODO] + [MonitoringDescription ("Thread gets a priority boot when interactively used by a user.")] public bool PriorityBoostEnabled { get { return(false); @@ -48,6 +70,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The priority level of this thread.")] public ThreadPriorityLevel PriorityLevel { get { return(ThreadPriorityLevel.Idle); @@ -57,6 +80,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The amount of CPU time used in privileged mode.")] public TimeSpan PrivilegedProcessorTime { get { return(new TimeSpan(0)); @@ -64,12 +88,14 @@ namespace System.Diagnostics { } [MonoTODO] + [Browsable (false)] IntPtr ProcessorAffinity { set { } } [MonoTODO] + [MonitoringDescription ("The start address in memory of this thread.")] public IntPtr StartAddress { get { return((IntPtr)0); @@ -77,6 +103,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The time this thread was started.")] public DateTime StartTime { get { return(new DateTime(0)); @@ -84,6 +111,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The current state of this thread.")] public ThreadState ThreadState { get { return(ThreadState.Initialized); @@ -91,6 +119,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The total amount of CPU time used.")] public TimeSpan TotalProcessorTime { get { return(new TimeSpan(0)); @@ -98,6 +127,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The amount of CPU time used in user mode.")] public TimeSpan UserProcessorTime { get { return(new TimeSpan(0)); @@ -105,6 +135,7 @@ namespace System.Diagnostics { } [MonoTODO] + [MonitoringDescription ("The reason why this thread is waiting.")] public ThreadWaitReason WaitReason { get { return(ThreadWaitReason.Executive); diff --git a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs index 4efbcd21bb0..7d77e9e597f 100755 --- a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs +++ b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs @@ -2,55 +2,61 @@ // System.Diagnostics.ProcessThreadCollection.cs // // Authors: -// Dick Porter (dick@ximian.com) +// Dick Porter (dick@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) // // (C) 2002 Ximian, Inc. http://www.ximian.com // using System.Collections; -namespace System.Diagnostics { - public class ProcessThreadCollection : ReadOnlyCollectionBase { - [MonoTODO] - protected ProcessThreadCollection() { +namespace System.Diagnostics +{ + public class ProcessThreadCollection : ReadOnlyCollectionBase + { + protected ProcessThreadCollection() + { } - [MonoTODO] - public ProcessThreadCollection(ProcessThread[] processThreads) { + public ProcessThreadCollection(ProcessThread[] processThreads) + { + InnerList.AddRange (processThreads); } - [MonoTODO] public ProcessThread this[int index] { get { - return(null); + return (ProcessThread)InnerList[index]; } } - [MonoTODO] - public int Add(ProcessThread thread) { - return(0); + public int Add(ProcessThread thread) + { + return InnerList.Add (thread); } - [MonoTODO] - public bool Contains(ProcessThread thread) { - return(false); + public bool Contains(ProcessThread thread) + { + return InnerList.Contains (thread); } - [MonoTODO] - public void CopyTo(ProcessThread[] array, int index) { + public void CopyTo(ProcessThread[] array, int index) + { + InnerList.CopyTo (array, index); } - [MonoTODO] - public int IndexOf(ProcessThread thread) { - return(0); + public int IndexOf(ProcessThread thread) + { + return InnerList.IndexOf (thread); } - [MonoTODO] - public void Insert(int index, ProcessThread thread) { + public void Insert(int index, ProcessThread thread) + { + InnerList.Insert (index, thread); } - [MonoTODO] - public void Remove(ProcessThread thread) { + public void Remove(ProcessThread thread) + { + InnerList.Remove (thread); } } } |