C# Class SlavaGu.ConsoleAppLauncher.ConsoleApp

Inheritance: IConsoleApp
ファイルを表示 Open project: slavagu/ConsoleAppLauncher Class Usage Examples

Public Methods

Method Description
ConsoleApp ( string fileName, string cmdLine ) : System

ConsoleApp constructor

Dispose ( ) : void
Run ( string fileName, string cmdLine = null ) : System.Result

Run console app synchronously and capture all its output including standard error stream.

Run ( ) : void

Start the app.

Stop ( ConsoleSpecialKey closeKey = ConsoleSpecialKey.ControlC, int forceCloseMillisecondsTimeout = Timeout.Infinite ) : void

Stop the app.

WaitForExit ( int millisecondsTimeout = Timeout.Infinite ) : bool

Wait until the app exits.

Protected Methods

Method Description
Dispose ( bool disposing ) : void
OnConsoleOutput ( ConsoleOutputEventArgs e ) : void
OnExited ( EventArgs e ) : void

Private Methods

Method Description
CloseConsole ( ConsoleSpecialKey closeKey, int forceCloseMillisecondsTimeout ) : void
ConsoleCtrlHandler ( Win32 ctrlType ) : bool
DispatchProcessOutput ( ) : void
FreeProcessResources ( ) : void
HandleProcessExit ( ) : void
MonitoringHandler ( object obj ) : void
OnErrorLineReceived ( object sender, DataReceivedEventArgs e ) : void
OnOutputLineReceived ( object sender, DataReceivedEventArgs e ) : void
OnProcessExited ( object sender, EventArgs e ) : void
StartProcessAsync ( ) : void
ThrowIfDisposed ( ) : void

Method Details

ConsoleApp() public method

ConsoleApp constructor
public ConsoleApp ( string fileName, string cmdLine ) : System
fileName string File name or DOS command
cmdLine string Command-line arguments
return System

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

OnConsoleOutput() protected method

protected OnConsoleOutput ( ConsoleOutputEventArgs e ) : void
e ConsoleOutputEventArgs
return void

OnExited() protected method

protected OnExited ( EventArgs e ) : void
e System.EventArgs
return void

Run() public static method

Run console app synchronously and capture all its output including standard error stream.
public static Run ( string fileName, string cmdLine = null ) : System.Result
fileName string File name or DOS command
cmdLine string Command-line arguments
return System.Result

Run() public method

Start the app.
public Run ( ) : void
return void

Stop() public method

Stop the app.
public Stop ( ConsoleSpecialKey closeKey = ConsoleSpecialKey.ControlC, int forceCloseMillisecondsTimeout = Timeout.Infinite ) : void
closeKey ConsoleSpecialKey Special key to send to close the app [default=Ctrl-C]
forceCloseMillisecondsTimeout int Timeout to wait before closing the app forcefully [default=infinite]
return void

WaitForExit() public method

Wait until the app exits.
public WaitForExit ( int millisecondsTimeout = Timeout.Infinite ) : bool
millisecondsTimeout int Timeout to wait until the app is exited [default=infinite]
return bool