C# Класс Microsoft.Build.Utilities.CommandLineBuilder

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
License string

Private Properties

Свойство Тип Описание
AppendFileNameWithQuoting void
AppendQuotedTextToBuffer void
AppendSpaceIfNotEmpty void
AppendTextWithQuoting void
IsQuotingRequired bool
VerifyThrowNoEmbeddedDoubleQuotes void

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

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

Приватные методы

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Default constructor
public CommandLineBuilder ( ) : System
Результат System

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

Default constructor
public CommandLineBuilder ( bool quoteHyphensOnCommandLine ) : System
quoteHyphensOnCommandLine bool
Результат System

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

Return the command-line as a string.
public ToString ( ) : string
Результат string

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

License публичное статическое свойство

public static string License
Результат string