C# Class ProcessCallerLibrary.ProcessCaller

This class can launch a process (like a bat file, perl script, etc) and return all of the StdOut and StdErr to GUI app for display in textboxes, etc.
This class (c) 2003 Michael Mayer Use it as you like (public domain licensing). Please post any bugs / fixes to the page where you downloaded this code.
Inheritance: System.ComponentModel.AsyncOperation
Afficher le fichier Open project: swganhtools/anhtoolslibs Class Usage Examples

Méthodes publiques

Свойство Type Description
SleepTime int
m_EDone bool
m_PDone bool
m_SDone bool

Méthodes publiques

Méthode Description
AddOutput ( string line ) : void
ProcessCaller ( ISynchronizeInvoke isi ) : System

Initialises a ProcessCaller with an association to the supplied ISynchronizeInvoke. All events raised from this object will be delivered via this target. (This might be a Control object, so events would be delivered to that Control's UI thread.)

Méthodes protégées

Méthode Description
DoWork ( ) : void

/// Initialises a ProcessCaller without an association to an /// ISynchronizeInvoke. All events raised from this object /// will be delievered via the worker thread. ///

Launch a process, but do not return until the process has exited. That way we can kill the process if a cancel is requested.

ReadStdErr ( ) : void

Handles reading of stdErr

ReadStdOut ( ) : void

Handles reading of stdout and firing an event for every line read

StartProcess ( ) : void

This method is generally called by DoWork() which is called by the base classs Start()

Method Details

AddOutput() public méthode

public AddOutput ( string line ) : void
line string
Résultat void

DoWork() protected méthode

/// Initialises a ProcessCaller without an association to an /// ISynchronizeInvoke. All events raised from this object /// will be delievered via the worker thread. /// Launch a process, but do not return until the process has exited. That way we can kill the process if a cancel is requested.
protected DoWork ( ) : void
Résultat void

ProcessCaller() public méthode

Initialises a ProcessCaller with an association to the supplied ISynchronizeInvoke. All events raised from this object will be delivered via this target. (This might be a Control object, so events would be delivered to that Control's UI thread.)
public ProcessCaller ( ISynchronizeInvoke isi ) : System
isi ISynchronizeInvoke An object implementing the /// ISynchronizeInvoke interface. All events will be delivered /// through this target, ensuring that they are delivered to the /// correct thread.
Résultat System

ReadStdErr() protected méthode

Handles reading of stdErr
protected ReadStdErr ( ) : void
Résultat void

ReadStdOut() protected méthode

Handles reading of stdout and firing an event for every line read
protected ReadStdOut ( ) : void
Résultat void

StartProcess() protected méthode

This method is generally called by DoWork() which is called by the base classs Start()
protected StartProcess ( ) : void
Résultat void

Property Details

SleepTime public_oe property

Amount of time to sleep on threads while waiting for the process to finish.
public int SleepTime
Résultat int

m_EDone public_oe property

public bool m_EDone
Résultat bool

m_PDone public_oe property

public bool m_PDone
Résultat bool

m_SDone public_oe property

public bool m_SDone
Résultat bool