Class ConsoleArguments
Represents the environment command line arguments
Inherited Members
Namespace: PayrollEngine.Client
Assembly: PayrollEngine.Client.Core.dll
Syntax
public static class ConsoleArguments
Properties
Count
Get the command line arguments count
Declaration
public static int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
ParameterCount
Get the command line arguments count, excluding the implicit parameter at index 0
Declaration
public static int ParameterCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Contains(string)
Determines whether the specified argument exists
Declaration
public static bool Contains(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The argument |
Returns
| Type | Description |
|---|---|
| bool | True if the specified argument exists |
ContainsToggle(string)
Determines whether the specified argument exists
Declaration
public static bool ContainsToggle(string toggleValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | toggleValue | The toggle value |
Returns
| Type | Description |
|---|---|
| bool | True if the specified toggle exists |
Get(int, string, bool)
Gets the specified index, starting at 1
Declaration
public static string Get(int index, string name = null, bool allowToggle = false)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The argument index |
| string | name | The argument name (optional) |
| bool | allowToggle | Argument can be a toggle (optional) |
Returns
| Type | Description |
|---|---|
| string | The argument value |
GetEnumToggle<T>()
Gets an enum toggle is present: /toggle or -toggle
Declaration
public static T? GetEnumToggle<T>() where T : struct, Enum
Returns
| Type | Description |
|---|---|
| T? | The argument value |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type |
GetEnumToggle<T>(T)
Gets a toggle with fallback value
Declaration
public static T GetEnumToggle<T>(T defaultValue) where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | defaultValue | The default value |
Returns
| Type | Description |
|---|---|
| T | The argument value |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type |
GetEnum<T>(int, string)
Gets a mandatory enum argument
Declaration
public static T GetEnum<T>(int index, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The argument index |
| string | name | The argument name (optional) |
Returns
| Type | Description |
|---|---|
| T | The argument value |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type |
GetEnum<T>(int, T, string)
Gets an enum argument
Declaration
public static T GetEnum<T>(int index, T defaultValue, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The argument index |
| T | defaultValue | The default value |
| string | name | The argument name (optional) |
Returns
| Type | Description |
|---|---|
| T | The argument value |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type |
GetInt(int, int, string)
Gets an integer argument
Declaration
public static int GetInt(int index, int defaultValue, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The argument index |
| int | defaultValue | The default value |
| string | name | The argument name (optional) |
Returns
| Type | Description |
|---|---|
| int | The argument value |
GetInt(int, string)
Gets an integer argument
Declaration
public static int? GetInt(int index, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The argument index |
| string | name | The argument name (optional) |
Returns
| Type | Description |
|---|---|
| int? | The argument value |
GetMember(Type, int, string, bool)
Gets the specified index, starting at 1
Declaration
public static string GetMember(Type type, int index, string memberName = "", bool allowToggle = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The source type |
| int | index | The argument index |
| string | memberName | The caller name |
| bool | allowToggle | Argument can be a toggle |
Returns
| Type | Description |
|---|---|
| string | The argument value |
GetToggles()
Gets all toggle with fallback value
Declaration
public static IEnumerable<string> GetToggles()
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | The argument value |
IsToggleArgument(string)
Determines whether the specified argument is a toggle
Declaration
public static bool IsToggleArgument(string argument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | argument | The argument |
Returns
| Type | Description |
|---|---|
| bool | True if the specified argument exists |
IsValidOrder()
Determines whether the specified argument exists
Declaration
public static bool IsValidOrder()
Returns
| Type | Description |
|---|---|
| bool | True if the specified toggle exists |
TestMultipleToggles(IEnumerable<Type>)
Test for multiple toggles
Declaration
public static Type TestMultipleToggles(IEnumerable<Type> enumTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Type> | enumTypes | The supported enum types |
Returns
| Type | Description |
|---|---|
| Type | The failed type |
TestUnknownToggles(IEnumerable<Type>)
Test for unknown toggle arguments
Declaration
public static string TestUnknownToggles(IEnumerable<Type> enumTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Type> | enumTypes | The supported enum types |
Returns
| Type | Description |
|---|---|
| string | The unknown argument |