Show / Hide Table of Contents

Class CommandAttributeUtility

Utility methods for accessing command attribute information on the types in an assembly.

Inheritance
object
CommandAttributeUtility
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.CommandsFramework
Assembly: Benday.CommandsFramework.dll
Syntax
public class CommandAttributeUtility

Constructors

| Edit this page View Source

CommandAttributeUtility(ICommandProgramOptions)

Declaration
public CommandAttributeUtility(ICommandProgramOptions options)
Parameters
Type Name Description
ICommandProgramOptions options

Methods

| Edit this page View Source

GetAllCommandUsages(Assembly)

Creates a list of command usages for all the commands in an assembly

Declaration
public List<CommandInfo> GetAllCommandUsages(Assembly asm)
Parameters
Type Name Description
Assembly asm

Assembly to check

Returns
Type Description
List<CommandInfo>

List of command usages

| Edit this page View Source

GetAvailableCommandAttributes(Assembly)

Get all the command attributes for all the command types in an assembly.

Declaration
public List<CommandAttribute> GetAvailableCommandAttributes(Assembly containingAssembly)
Parameters
Type Name Description
Assembly containingAssembly

Assembly to check

Returns
Type Description
List<CommandAttribute>

List of command attributes from this assembly.

Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

GetAvailableCommandNames(Assembly)

Get the list of command names in an assembly

Declaration
public List<string> GetAvailableCommandNames(Assembly containingAssembly)
Parameters
Type Name Description
Assembly containingAssembly

Assembly to examine

Returns
Type Description
List<string>

List of command names for all classes with a CommandAttribute in the assembly

Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

GetAvailableCommandType(Assembly, string)

Gets command type from an assembly by command name.

Declaration
public Type? GetAvailableCommandType(Assembly containingAssembly, string commandName)
Parameters
Type Name Description
Assembly containingAssembly

Assembly containing the commands

string commandName

Command name to find. This is typically args[0] from the command line.

Returns
Type Description
Type

Instance of System.Type for the matching command or null if not found.

Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

GetCommand(string[], Assembly)

Gets a populated instance of a command using arguments from the command line. This uses args[0] as the command name. The rest of the arguments are used as argument values to the command.

Declaration
public CommandBase? GetCommand(string[] args, Assembly containingAssembly)
Parameters
Type Name Description
string[] args

Command line arguments

Assembly containingAssembly

Assembly that contains the commands

Returns
Type Description
CommandBase

Populated command

Exceptions
Type Condition
ArgumentNullException
ArgumentException
MissingArgumentException
| Edit this page View Source

GetCommandAttributeForCommandName(Assembly, string)

Get a command argument for a command by command name.

Declaration
public CommandAttribute? GetCommandAttributeForCommandName(Assembly containingAssembly, string commandName)
Parameters
Type Name Description
Assembly containingAssembly

Assembly containing the commands

string commandName

Command name to find. This is typically args[0] from the command line.

Returns
Type Description
CommandAttribute

Command argument for the command or null if not found.

Exceptions
Type Condition
ArgumentNullException
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com