Search Results for

    Show / Hide Table of Contents

    Class Parser

    Implementation of a command-line parsing class. Is capable of having switches registered with it directly or can examine a registered class for any properties with the appropriate attributes appended to them.

    Inheritance
    System.Object
    Parser
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: ImageVault.Common.Lib.Configuration.CommandLine
    Assembly: ImageVault.Common.dll
    Syntax
    public class Parser
    Remarks

    Author: Ray Hayes, http://www.codeproject.com/KB/recipes/commandlineparser.aspx

    Constructors

    Parser(String)

    Initializes a new instance of the Parser class.

    Declaration
    public Parser(string commandLine)
    Parameters
    Type Name Description
    System.String commandLine

    Parser(String, Object)

    Initializes a new instance of the Parser class.

    Declaration
    public Parser(string commandLine, object classForAutoAttributes)
    Parameters
    Type Name Description
    System.String commandLine
    System.Object classForAutoAttributes

    Properties

    ApplicationName

    Gets the ApplicationName of the Parser

    Declaration
    public string ApplicationName { get; }
    Property Value
    Type Description
    System.String

    Item[String]

    Gets the System.Object item identified by the given arguments of the Parser

    Declaration
    public object this[string name] { get; }
    Parameters
    Type Name Description
    System.String name
    Property Value
    Type Description
    System.Object

    Parameters

    Gets the Parameters of the Parser

    Declaration
    public string[] Parameters { get; }
    Property Value
    Type Description
    System.String[]

    Switches

    Gets the Switches of the Parser

    Declaration
    public Parser.SwitchInfo[] Switches { get; }
    Property Value
    Type Description
    Parser.SwitchInfo[]

    UnhandledSwitches

    This function returns a list of the unhandled switches that the parser has seen, but not processed.

    Declaration
    public string[] UnhandledSwitches { get; }
    Property Value
    Type Description
    System.String[]

    Methods

    AddSwitch(String, String)

    Declaration
    public void AddSwitch(string name, string description)
    Parameters
    Type Name Description
    System.String name
    System.String description

    AddSwitch(String[], String)

    Declaration
    public void AddSwitch(string[] names, string description)
    Parameters
    Type Name Description
    System.String[] names
    System.String description

    InternalValue(String)

    Declaration
    public object InternalValue(string name)
    Parameters
    Type Name Description
    System.String name
    Returns
    Type Description
    System.Object

    Parse()

    Declaration
    public bool Parse()
    Returns
    Type Description
    System.Boolean

    ToString()

    Returns a System.String that represents the current Parser.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents the current Parser.

    Overrides
    System.Object.ToString()

    Extension Methods

    EnumExtensions.GetNames<TEnum>(TEnum)
    In This Article
    Back to top (c) Meriworks 2002-2022