C# Class Crisis.CommandLine.OptionStyleManager

Utility class for manipulating OptionStyles.
Mostra file Open project: teeknofil/Crisis-Wordlist-Generator Class Usage Examples

Public Methods

Method Description
GetPrefix ( OptionStyles optionStyle, string optionName ) : string

Gets the switch character used to specify an option of the specified style on the command line.

If optionStyle includes several option styles, the switch for the most specific one representing a single option style prefix is returned. The switches for the corresponding styles are as follows (in order from most specific to least):

OptionStyle Prefix All + Plus + Group - ShortUnix - File @ LongUnix -- Windows / (Items in italics does not represent a single unique prefix)

IsAllEnabled ( OptionStyles optionStyle, OptionStyles flags ) : bool

Determines whether all of the specified flags are enabled in the specified optionStyle.

IsAnyEnabled ( OptionStyles optionStyle, OptionStyles flags ) : bool

Determines whether any of the specified flags are enabled in the specified optionStyle.

IsValid ( OptionStyles optionStyle ) : bool

Determines whether the specified option style is valid.

An option style is invalid if the OptionStyles.ShortUnix flag is not enabled, but the OptionStyles.Group or OptionStyles.Plus is. This normally doesn't occur if you only use the binary or to combine flags however, since the values of the group and plus options also include the short unix style.

PrefixOptionForDescription ( OptionStyles optionStyle, string optionName ) : string

Prefixes the option name with the prefix(es) with which it should be used.

This method always prefers prefixing options with unix style to windows style prefixes if both are enabled. If OptionStyles.Plus is enabled, the option will be prefixed with "[+|-]" to indicate that either prefix may be used.

Method Details

GetPrefix() public static method

Gets the switch character used to specify an option of the specified style on the command line.

If optionStyle includes several option styles, the switch for the most specific one representing a single option style prefix is returned. The switches for the corresponding styles are as follows (in order from most specific to least):

OptionStyle Prefix All + Plus + Group - ShortUnix - File @ LongUnix -- Windows / (Items in italics does not represent a single unique prefix)

public static GetPrefix ( OptionStyles optionStyle, string optionName ) : string
optionStyle OptionStyles The option style.
optionName string The name of the option.
return string

IsAllEnabled() public static method

Determines whether all of the specified flags are enabled in the specified optionStyle.
public static IsAllEnabled ( OptionStyles optionStyle, OptionStyles flags ) : bool
optionStyle OptionStyles The option style.
flags OptionStyles The flags.
return bool

IsAnyEnabled() public static method

Determines whether any of the specified flags are enabled in the specified optionStyle.
public static IsAnyEnabled ( OptionStyles optionStyle, OptionStyles flags ) : bool
optionStyle OptionStyles The option style.
flags OptionStyles The flags.
return bool

IsValid() public static method

Determines whether the specified option style is valid.
An option style is invalid if the OptionStyles.ShortUnix flag is not enabled, but the OptionStyles.Group or OptionStyles.Plus is. This normally doesn't occur if you only use the binary or to combine flags however, since the values of the group and plus options also include the short unix style.
public static IsValid ( OptionStyles optionStyle ) : bool
optionStyle OptionStyles The option style.
return bool

PrefixOptionForDescription() public static method

Prefixes the option name with the prefix(es) with which it should be used.
This method always prefers prefixing options with unix style to windows style prefixes if both are enabled. If OptionStyles.Plus is enabled, the option will be prefixed with "[+|-]" to indicate that either prefix may be used.
public static PrefixOptionForDescription ( OptionStyles optionStyle, string optionName ) : string
optionStyle OptionStyles The option style.
optionName string Name of the option.
return string