C# Class Crabwise.CommandWrap.Command

Provides an abstract representation of a command prompt command.
Afficher le fichier Open project: CrabwiseStudios/CommandWrap Class Usage Examples

Méthodes publiques

Méthode Description
CancelAsync ( ) : void

Cancels the running command. Throws an exception if called on a command that is not executing.

CloseStandardInput ( ) : void

Closes the standard input to this command.

Execute ( ) : int

Executes this command with the default CommandStartInfo for this Command.

The default CommandStartInfo options can be set by deriving from this class and then overriding the Command.DefaultCommandStartInfo property.

Execute ( CommandStartInfo startInfo ) : int

Uses a CommandStartInfo object to execute this command.

ExecuteAsync ( ) : void

Executes the command with default starting parameters.

ExecuteAsync ( CommandStartInfo startInfo ) : void

Executes the command with custom starting parameters.

GetSyntax ( ) : string

Gets the command prompt String representation for this Command.

WaitForExit ( ) : void
WriteLineToStandardIn ( string input ) : void

Writes a System.String followed by a newline to the standard input of this command.

This method can only be used after Command.Execute() has been called.

WriteToStandardIn ( ICollection input ) : void

Writes a collection of strings to the standard input of this command.

This method can only be used after Command.Execute() has been called.

WriteToStandardIn ( string input ) : void

Writes a System.String to the standard input of this command.

This method can only be used after Command.Execute() has been called.

Méthodes protégées

Méthode Description
OnCommandStarting ( CommandStartingEventArgs e ) : void
OnErrorOutputWritten ( string outputLine ) : void
OnExecuteCompleted ( ) : void

Called when the command has finished running.

OnStandardOutputWritten ( string outputLine ) : void

Private Methods

Méthode Description
CleanupProcess ( ) : int

Handles all the finishing tasks within the command.

GetCommandSyntaxAttribute ( ) : CommandSyntaxAttribute

Gets the CommandSyntaxAttribute that adorns this command.

This method throws a SyntaxException if it cannot find a CommandSyntaxAttribute. This is generally wanted behavior since all classes implementing Command are required to have this attribute.

ProcessExited ( object sender, EventArgs e ) : void
StartProcess ( CommandStartInfo startInfo ) : void

Starts the process with customized starting information

Method Details

CancelAsync() public méthode

Cancels the running command. Throws an exception if called on a command that is not executing.
public CancelAsync ( ) : void
Résultat void

CloseStandardInput() public méthode

Closes the standard input to this command.
public CloseStandardInput ( ) : void
Résultat void

Execute() public méthode

Executes this command with the default CommandStartInfo for this Command.
The default CommandStartInfo options can be set by deriving from this class and then overriding the Command.DefaultCommandStartInfo property.
public Execute ( ) : int
Résultat int

Execute() public méthode

Uses a CommandStartInfo object to execute this command.
public Execute ( CommandStartInfo startInfo ) : int
startInfo CommandStartInfo Specifies how to execute this command.
Résultat int

ExecuteAsync() public méthode

Executes the command with default starting parameters.
public ExecuteAsync ( ) : void
Résultat void

ExecuteAsync() public méthode

Executes the command with custom starting parameters.
public ExecuteAsync ( CommandStartInfo startInfo ) : void
startInfo CommandStartInfo The CommandStartInfo object that defines how the command should start
Résultat void

GetSyntax() public méthode

Gets the command prompt String representation for this Command.
public GetSyntax ( ) : string
Résultat string

OnCommandStarting() protected méthode

protected OnCommandStarting ( CommandStartingEventArgs e ) : void
e CommandStartingEventArgs
Résultat void

OnErrorOutputWritten() protected méthode

protected OnErrorOutputWritten ( string outputLine ) : void
outputLine string
Résultat void

OnExecuteCompleted() protected méthode

Called when the command has finished running.
protected OnExecuteCompleted ( ) : void
Résultat void

OnStandardOutputWritten() protected méthode

protected OnStandardOutputWritten ( string outputLine ) : void
outputLine string
Résultat void

WaitForExit() public méthode

public WaitForExit ( ) : void
Résultat void

WriteLineToStandardIn() public méthode

Writes a System.String followed by a newline to the standard input of this command.
This method can only be used after Command.Execute() has been called.
public WriteLineToStandardIn ( string input ) : void
input string to write.
Résultat void

WriteToStandardIn() public méthode

Writes a collection of strings to the standard input of this command.
This method can only be used after Command.Execute() has been called.
public WriteToStandardIn ( ICollection input ) : void
input ICollection of strings to write.
Résultat void

WriteToStandardIn() public méthode

Writes a System.String to the standard input of this command.
This method can only be used after Command.Execute() has been called.
public WriteToStandardIn ( string input ) : void
input string to write.
Résultat void