C# Класс ANHAdmin.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.
Наследование: AsyncOperation
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
SleepTime int
WorkingDirectory string
m_EDone bool
m_PDone bool
m_SDone bool

Открытые методы

Метод Описание
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.)

Защищенные методы

Метод Описание
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()

Описание методов

AddOutput() публичный Метод

public AddOutput ( string line ) : void
line string
Результат void

DoWork() защищенный Метод

/// 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
Результат void

ProcessCaller() публичный Метод

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.
Результат System

ReadStdErr() защищенный Метод

Handles reading of stdErr
protected ReadStdErr ( ) : void
Результат void

ReadStdOut() защищенный Метод

Handles reading of stdout and firing an event for every line read
protected ReadStdOut ( ) : void
Результат void

StartProcess() защищенный Метод

This method is generally called by DoWork() which is called by the base classs Start()
protected StartProcess ( ) : void
Результат void

Описание свойств

SleepTime публичное свойство

Amount of time to sleep on threads while waiting for the process to finish.
public int SleepTime
Результат int

WorkingDirectory публичное свойство

The WorkingDirectory (should be made into a property)
public string WorkingDirectory
Результат string

m_EDone публичное свойство

public bool m_EDone
Результат bool

m_PDone публичное свойство

public bool m_PDone
Результат bool

m_SDone публичное свойство

public bool m_SDone
Результат bool