Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

VRage.Game.ModAPI.Ingame.Utilities.MyCommandLine

Morten Aune Lyrstad edited this page Apr 16, 2022 · 42 revisions

IndexNamespace Index

MyCommandLine Class

public class MyCommandLine

A utility class to parse arguments from a command line string. Switches are defined with hyphen (-switch). Quotes can be placed around an argument to parse verbatim, but inner quotes will be copied verbatim. For example, "one"two" will result in the string one"two.

Namespace: VRage.Game.ModAPI.Ingame.Utilities
Assembly: VRage.Game.dll

Properties

Member Description
int ArgumentCount { get; } Returns the number of non-switch arguments
ItemCollection Items { get; } Contains all items, both arguments and switches
SwitchCollection Switches { get; } Contains a list of all detected switches

Constructors

Member Description
MyCommandLine()

Methods

Member Description
string Argument(int) Returns the argument at the given index. Switches are not counted.
void Clear() Clears all arguments
bool Switch(string) Determines whether the given switch is set. Switches are specified without their prefixed hyphen.
string Switch(string, int) Gets an argument of a switch. For example, usingSwitch("key", 0)on the command linesomeOtherArgument -key valuewill returnvalue.
bool TryParse(string) Attempts to parse the given string as a command line
Clone this wiki locally