C# Class Microsoft.Build.Utilities.CommandLineBuilder

Datei anzeigen Open project: Maximus5/conemu-inside Class Usage Examples

Public Properties

Property Type Description
License string

Private Properties

Property Type Description
AppendFileNameWithQuoting void
AppendQuotedTextToBuffer void
AppendSpaceIfNotEmpty void
AppendTextWithQuoting void
IsQuotingRequired bool
VerifyThrowNoEmbeddedDoubleQuotes void

Public Methods

Method Description
AppendFileNameIfNotNull ( string fileName ) : void

Appends a file name quoting it if necessary. This method appends a space to the command line (if it's not currently empty) before the file name.

AppendFileNamesIfNotNull ( string fileNames, string delimiter ) : void

Appends array of file name strings, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.

AppendSwitch ( string switchName ) : void

Appends a command-line switch that has no separate value, without any quoting. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchIfNotNull ( string switchName, string parameter ) : void

Appends a command-line switch that takes a single string parameter, quoting the parameter if necessary. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchIfNotNull ( string switchName, string parameters, string delimiter ) : void

Appends a command-line switch that takes a string[] parameter, and add double-quotes around the individual filenames if necessary. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull ( string switchName, string parameter ) : void

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.

AppendSwitchUnquotedIfNotNull ( string switchName, string parameters, string delimiter ) : void

Appends a command-line switch that takes a string[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.

AppendTextUnquoted ( string textToAppend ) : void

Appends a string. No quotes are added. This method does not append a space to the command line before executing.

In the future, this function may fixup 'textToAppend' to handle literal embedded quotes.

CommandLineBuilder ( ) : System

Default constructor

CommandLineBuilder ( bool quoteHyphensOnCommandLine ) : System

Default constructor

ToString ( ) : string

Return the command-line as a string.

Private Methods

Method Description
AppendFileNameWithQuoting ( string fileName ) : void

Appends a file name. Quotes are added if they are needed. If the first character of the file name is a dash, ".\" is prepended to avoid confusing the file name with a switch This method does not append a space to the command line before executing.

In the future, this function may fixup 'text' to handle literal embedded quotes.

AppendQuotedTextToBuffer ( StringBuilder buffer, string unquotedTextToAppend ) : void

Appends given text to the buffer after first quoting the text if necessary.

AppendSpaceIfNotEmpty ( ) : void

Add a space to the specified string if and only if it's not empty.

This is a pretty obscure method and so it's only available to inherited classes.

AppendTextWithQuoting ( string textToAppend ) : void

Appends a string. Quotes are added if they are needed. This method does not append a space to the command line before executing.

Escapes any double quotes in the string.

IsQuotingRequired ( string parameter ) : bool

Checks the given switch parameter to see if it must/can be quoted.

VerifyThrowNoEmbeddedDoubleQuotes ( string switchName, string parameter ) : void

Throws if the parameter has a double-quote in it. This is used to prevent parameter injection. It's virtual so that tools can override this method if they want to have quotes escaped in filenames

Method Details

AppendFileNameIfNotNull() public method

Appends a file name quoting it if necessary. This method appends a space to the command line (if it's not currently empty) before the file name.
public AppendFileNameIfNotNull ( string fileName ) : void
fileName string File name to append, if it's null this method has no effect
return void

AppendFileNamesIfNotNull() public method

Appends array of file name strings, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.
public AppendFileNamesIfNotNull ( string fileNames, string delimiter ) : void
fileNames string File names to append, if it's null this method has no effect
delimiter string The delimiter between file names
return void

AppendSwitch() public method

Appends a command-line switch that has no separate value, without any quoting. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitch ( string switchName ) : void
switchName string The switch to append to the command line, may not be null
return void

AppendSwitchIfNotNull() public method

Appends a command-line switch that takes a single string parameter, quoting the parameter if necessary. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitchIfNotNull ( string switchName, string parameter ) : void
switchName string The switch to append to the command line, may not be null
parameter string Switch parameter to append, quoted if necessary. If null, this method has no effect.
return void

AppendSwitchIfNotNull() public method

Appends a command-line switch that takes a string[] parameter, and add double-quotes around the individual filenames if necessary. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitchIfNotNull ( string switchName, string parameters, string delimiter ) : void
switchName string The switch to append to the command line, may not be null
parameters string Switch parameters to append, quoted if necessary. If null, this method has no effect.
delimiter string Delimiter to put between individual parameters, may not be null (may be empty)
return void

AppendSwitchUnquotedIfNotNull() public method

Appends the literal parameter without trying to quote. This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitchUnquotedIfNotNull ( string switchName, string parameter ) : void
switchName string The switch to append to the command line, may not be null
parameter string Switch parameter to append, not quoted. If null, this method has no effect.
return void

AppendSwitchUnquotedIfNotNull() public method

Appends a command-line switch that takes a string[] parameter, not quoting the individual parameters This method appends a space to the command line (if it's not currently empty) before the switch.
public AppendSwitchUnquotedIfNotNull ( string switchName, string parameters, string delimiter ) : void
switchName string The switch to append to the command line, may not be null
parameters string Switch parameters to append, not quoted. If null, this method has no effect.
delimiter string Delimiter to put between individual parameters, may not be null (may be empty)
return void

AppendTextUnquoted() public method

Appends a string. No quotes are added. This method does not append a space to the command line before executing.
In the future, this function may fixup 'textToAppend' to handle literal embedded quotes.
public AppendTextUnquoted ( string textToAppend ) : void
textToAppend string The string to append
return void

CommandLineBuilder() public method

Default constructor
public CommandLineBuilder ( ) : System
return System

CommandLineBuilder() public method

Default constructor
public CommandLineBuilder ( bool quoteHyphensOnCommandLine ) : System
quoteHyphensOnCommandLine bool
return System

ToString() public method

Return the command-line as a string.
public ToString ( ) : string
return string

Property Details

License public_oe static_oe property

public static string License
return string