Show / Hide Table of Contents

Class CommandLine

Class for getting arguments from command line. Arguments are not case sensitive.

Excpected syntax of parameters:

  • -arg
  • -arg="value"
  • -arg.subarg="value"
Inheritance
System.Object
CommandLine
Namespace: Eco.Shared.Utils
Assembly: Eco.Shared.dll
Syntax
public static class CommandLine : Object

Methods

FeedFromCommandLine(Object)

Basic deserialization of data passed by command line. Can be partial defined (only particular properties).

Declaration
public static bool FeedFromCommandLine(this object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

GetValueArg(String)

Gets the value for a given argument is set, null otherwise. Not case sensitive.

Declaration
public static string GetValueArg(string argName)
Parameters
Type Name Description
System.String argName
Returns
Type Description
System.String

GetValuelessArg(String)

Gets whether an argument is set or not. Not case sensitive.

Declaration
public static bool GetValuelessArg(string argName)
Parameters
Type Name Description
System.String argName
Returns
Type Description
System.Boolean

SetCmdLine(String)

Sets command line from unparsed commandLine string.

Declaration
public static void SetCmdLine(string commandLine)
Parameters
Type Name Description
System.String commandLine

SetCmdLine(String[])

Declaration
public static void SetCmdLine(string[] args)
Parameters
Type Name Description
System.String[] args

ToCommandLineArgs(Object, Func<Object, Boolean>)

Basic serialization of properties of object, so they can be parsed by FeedFromCommandLine function.

Declaration
public static string ToCommandLineArgs(this object obj, Func<object, bool> filter = null)
Parameters
Type Name Description
System.Object obj
System.Func<System.Object, System.Boolean> filter
Returns
Type Description
System.String
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾