C# Class GSF.Console.Command

Defines methods related to command line operations
Show file Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
Execute ( string fileName, string arguments = null, int timeout = Timeout.Infinite ) : GSF.Console.CommandResponse

Executes a command line operation and returns its standard output and exit code or throws an exception with the standard error.

Execute ( string fileName, string arguments, string &standardOutput, string &standardError, bool &processCompleted, int &exitCode, int timeout ) : bool

Executes a command line operation and returns true if there was no standard error reported.

Execute ( string fileName, string arguments, string &standardOutput, string &standardError, int &exitCode ) : bool

Executes a command line operation and returns true if there was no standard error reported.

This function waits indefinitely for the command line operation to complete.

ShellDecode ( this parameter ) : string

Decodes a command line parameter previously encoded by ShellEncode.

ShellEncode ( this parameter ) : string

Shell encodes a command line parameter by converting "\" to "\\".

Method Details

Execute() public static method

Executes a command line operation and returns its standard output and exit code or throws an exception with the standard error.
/// Exception occurs when executed command process reports standard error output or process times-out. ///
public static Execute ( string fileName, string arguments = null, int timeout = Timeout.Infinite ) : GSF.Console.CommandResponse
fileName string Command line file name to execute.
arguments string Command line arguments to use, if any.
timeout int Timeout, in milliseconds, to wait for command line operation to complete.
return GSF.Console.CommandResponse

Execute() public static method

Executes a command line operation and returns true if there was no standard error reported.
public static Execute ( string fileName, string arguments, string &standardOutput, string &standardError, bool &processCompleted, int &exitCode, int timeout ) : bool
fileName string Command line file name to execute.
arguments string Command line arguments to use, if any.
standardOutput string Any standard output reported by the command line operation.
standardError string Any standard error reported by the command line operation.
processCompleted bool Flag that determines if process completed or timed-out. This is only relevant if is not -1.
exitCode int Exit code of the process, assuming process successfully completed.
timeout int Timeout, in milliseconds, to wait for command line operation to complete. Set to , i.e., -1, for infinite wait.
return bool

Execute() public static method

Executes a command line operation and returns true if there was no standard error reported.
This function waits indefinitely for the command line operation to complete.
public static Execute ( string fileName, string arguments, string &standardOutput, string &standardError, int &exitCode ) : bool
fileName string Command line file name to execute.
arguments string Command line arguments to use, if any.
standardOutput string Any standard output reported by the command line operation.
standardError string Any standard error reported by the command line operation.
exitCode int Exit code of the process, assuming process successfully completed.
return bool

ShellDecode() public static method

Decodes a command line parameter previously encoded by ShellEncode.
public static ShellDecode ( this parameter ) : string
parameter this Parameter to decode.
return string

ShellEncode() public static method

Shell encodes a command line parameter by converting "\" to "\\".
public static ShellEncode ( this parameter ) : string
parameter this Parameter to shell encode.
return string