Class Code
A parsed representation of a generic G/M/T-code
Inherited Members
Namespace: DuetAPI.Commands
Assembly: DuetAPI.dll
Syntax
[RequiredPermissions(SbcPermissions.CommandExecution)]
public class Code : Command<Message?>
Constructors
Code()
Create an empty Code representation
Declaration
public Code()
Code(string)
Create a new Code instance and attempt to parse the given code string
Declaration
public Code(string code)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | UTF8-encoded G/M/T-Code |
Properties
Channel
Code channel to send this code to
Declaration
public CodeChannel Channel { get; set; }
Property Value
| Type | Description |
|---|---|
| CodeChannel |
Comment
Comment of the G/M/T-code. May be null if no comment is present
Declaration
public string? Comment { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The parser combines different comment segments and concatenates them as a single value. So for example a code like 'G28 (Do homing) ; via G28' causes the Comment field to be filled with 'Do homing via G28'
FilePosition
File position of this code in bytes (optional)
Declaration
public long? FilePosition { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
Flags
Flags of this code
Declaration
public CodeFlags Flags { get; set; }
Property Value
| Type | Description |
|---|---|
| CodeFlags |
Indent
Number of whitespaces prefixing the command content
Declaration
public byte Indent { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
IsFromFileChannel
Check if this code is from a file channel
Declaration
[JsonIgnore]
public bool IsFromFileChannel { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Keyword
Type of conditional G-code (if any)
Declaration
public KeywordType Keyword { get; set; }
Property Value
| Type | Description |
|---|---|
| KeywordType |
KeywordArgument
Argument of the conditional G-code (if any)
Declaration
public string? KeywordArgument { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Length
Length of the original code in bytes (optional)
Declaration
public int? Length { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
LineNumber
Line number of this code
Declaration
public long? LineNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
MajorNumber
Major code number (e.g. 28 in G28)
Declaration
public int? MajorNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
MinorNumber
Minor code number (e.g. 3 in G54.3)
Declaration
public sbyte? MinorNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| sbyte? |
Parameters
List of parsed code parameters (see CodeParameter for further information)
Declaration
public List<CodeParameter> Parameters { get; set; }
Property Value
| Type | Description |
|---|---|
| List<CodeParameter> |
See Also
Result
Result of this code. This property is only set when the code has finished its excution. It remains null if the code has been cancelled
Declaration
public Message? Result { get; set; }
Property Value
| Type | Description |
|---|---|
| Message |
Remarks
This used to be of type CodeResult but since v3.2 CodeResult can read Message JSON so it should remain compatible
SourceConnection
The connection ID this code was received from. If this is 0, the code originates from an internal DCS task
Declaration
public int SourceConnection { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
Usually there is no need to populate this property. It is internally overwritten by the control server on receipt
Type
Type of the code
Declaration
public CodeType Type { get; set; }
Property Value
| Type | Description |
|---|---|
| CodeType |
Methods
ConvertDriverIds()
Convert parameters of this code to driver id(s)
Declaration
public void ConvertDriverIds()
Exceptions
| Type | Condition |
|---|---|
| CodeParserException | Driver ID could not be parsed |
GetBool(char)
Get a boolean parameter value
Declaration
public bool GetBool(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| bool | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetBool(char, bool)
Get a boolean parameter value
Declaration
public bool GetBool(char letter, bool defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| bool | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| bool | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetDriverId(char)
Get a driver ID parameter value
Declaration
public DriverId GetDriverId(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| DriverId | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetDriverId(char, DriverId)
Get a driver ID parameter value
Declaration
public DriverId GetDriverId(char letter, DriverId defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| DriverId | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| DriverId | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetDriverIdArray(char)
Get a driver ID array parameter value
Declaration
public DriverId[] GetDriverIdArray(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| DriverId[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetDriverIdArray(char, DriverId[])
Get a driver ID array parameter value
Declaration
public DriverId[] GetDriverIdArray(char letter, DriverId[] defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| DriverId[] | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| DriverId[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetFloat(char)
Get a float parameter value
Declaration
public float GetFloat(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| float | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetFloat(char, float)
Get a float parameter value
Declaration
public float GetFloat(char letter, float defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| float | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| float | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetFloatArray(char)
Get a float array parameter value
Declaration
public float[] GetFloatArray(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| float[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetFloatArray(char, float[])
Get a float array parameter value
Declaration
public float[] GetFloatArray(char letter, float[] defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| float[] | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| float[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetIPAddress(char)
Get an IP address parameter value
Declaration
public IPAddress GetIPAddress(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| IPAddress | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetIPAddress(char, IPAddress)
Get an IP address parameter value
Declaration
public IPAddress GetIPAddress(char letter, IPAddress defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| IPAddress | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| IPAddress | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetInt(char)
Get an integer parameter value
Declaration
public int GetInt(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| int | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetInt(char, int)
Get an integer parameter value
Declaration
public int GetInt(char letter, int defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| int | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| int | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetIntArray(char)
Get an integer array parameter value
Declaration
public int[] GetIntArray(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| int[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetIntArray(char, int[])
Get an integer array parameter value
Declaration
public int[] GetIntArray(char letter, int[] defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| int[] | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| int[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetLong(char)
Get a long parameter value
Declaration
public long GetLong(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| long | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetLong(char, long)
Get a long parameter value
Declaration
public long GetLong(char letter, long defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| long | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| long | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetLongArray(char)
Get a long array parameter value
Declaration
public long[] GetLongArray(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| long[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetLongArray(char, long[])
Get a long array parameter value
Declaration
public long[] GetLongArray(char letter, long[] defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| long[] | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| long[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetOptionalString(char)
Get a string parameter value
Declaration
public string? GetOptionalString(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| string | Parameter value or null |
GetParameter(char)
Retrieve the parameter whose letter equals c
Declaration
public CodeParameter? GetParameter(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| CodeParameter | The parsed parameter instance or null if none could be found |
GetParameter(char, object)
Retrieve the parameter whose letter equals c or generate a default parameter
Declaration
public CodeParameter GetParameter(char letter, object defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| object | defaultValue | Default parameter value (no expression) |
Returns
| Type | Description |
|---|---|
| CodeParameter | The parsed parameter instance or null if none could be found |
GetString(char)
Get a string parameter value
Declaration
public string GetString(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| string | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetString(char, string)
Get an unsigned integer parameter value
Declaration
public string GetString(char letter, string defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| string | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| string | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetUInt(char)
Get an unsigned integer parameter value
Declaration
public uint GetUInt(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| uint | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetUInt(char, uint)
Get an unsigned integer parameter value
Declaration
public uint GetUInt(char letter, uint defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| uint | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| uint | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetUIntArray(char)
Get an unsigned integer array parameter value
Declaration
public uint[] GetUIntArray(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| uint[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| MissingParameterException | Parameter not found |
| InvalidParameterTypeException | Failed to convert parameter value |
GetUIntArray(char, uint[])
Get an unsigned integer array parameter value
Declaration
public uint[] GetUIntArray(char letter, uint[] defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| uint[] | defaultValue | Default value to return if no parameter could be found |
Returns
| Type | Description |
|---|---|
| uint[] | Parameter value |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
GetUnprecedentedString(bool)
Reconstruct an unprecedented string from the parameter list or retrieve the parameter which does not have a letter assigned
Declaration
public string GetUnprecedentedString(bool quoteStrings = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | quoteStrings | Encapsulate strings in double quotes |
Returns
| Type | Description |
|---|---|
| string | Unprecedented string |
Remarks
If no parameter is present, an empty string is returned
HasParameter(char)
Check if a given parameter exists
Declaration
public bool HasParameter(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| bool | If the parameter is present |
Parameter(char)
Retrieve the parameter whose letter equals c
Declaration
[Obsolete("Use GetParameter or one of the typed getter methods instead")]
public CodeParameter? Parameter(char letter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
Returns
| Type | Description |
|---|---|
| CodeParameter | The parsed parameter instance or null if none could be found |
Parameter(char, object)
Retrieve the parameter whose letter equals c or generate a default parameter
Declaration
[Obsolete("Use GetParameter or one of the typed getter methods instead")]
public CodeParameter Parameter(char letter, object defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| object | defaultValue | Default parameter value (no expression) |
Returns
| Type | Description |
|---|---|
| CodeParameter | The parsed parameter instance or null if none could be found |
Parse(TextReader, Code)
Parse the next available G/M/T-code from the given stream
Declaration
public static bool Parse(TextReader reader, Code result)
Parameters
| Type | Name | Description |
|---|---|---|
| TextReader | reader | Input to read from |
| Code | result | Code to fill |
Returns
| Type | Description |
|---|---|
| bool | Whether anything could be read |
Remarks
In general it is better to use ParseAsync(StreamReader, Code, CodeParserBuffer) because this implementation
- does not update the line number unless it is specified using the 'N' character
- does not set the corresponding flag for G53 after the first code on a line
- sets the indentation level only for the first code in a line
- does not support Fanuc or LaserWeb styles
Exceptions
| Type | Condition |
|---|---|
| CodeParserException | Thrown if the code contains errors like unterminated strings or unterminated comments |
ParseAsync(Stream, Code, CodeParserBuffer, CancellationToken)
Parse the next available G/M/T-code from the given stream asynchronously
Declaration
public static ValueTask<bool> ParseAsync(Stream stream, Code result, CodeParserBuffer buffer, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | Stream to read from |
| Code | result | Code to fill |
| CodeParserBuffer | buffer | Internal buffer for parsing codes |
| CancellationToken | cancellationToken | Cancellation token instance |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | Whether anything could be read |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | BOM from start of file showed that this file is neither ASCII nor UTF-8 |
| CodeParserException | Thrown if the code contains errors like unterminated strings or unterminated comments |
ParseAsync(StreamReader, Code, CodeParserBuffer)
Parse the next available G/M/T-code from the given stream reader asynchronously
Declaration
[Obsolete("This call is deprecated because the buffer position of a StreamReader is not accessible. Pass your stream directly instead")]
public static ValueTask<bool> ParseAsync(StreamReader reader, Code result, CodeParserBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamReader | reader | Stream reader to read from |
| Code | result | Code to fill |
| CodeParserBuffer | buffer | Internal buffer for parsing codes |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | Whether anything could be read |
Exceptions
| Type | Condition |
|---|---|
| CodeParserException | Thrown if the code contains errors like unterminated strings or unterminated comments |
Reset()
Reset this instance
Declaration
public virtual void Reset()
ToShortString()
Convert only the command portion to a text-based G/M/T-code (e.g. G28)
Declaration
public string ToShortString()
Returns
| Type | Description |
|---|---|
| string | Command fraction of the code |
ToString()
Convert the parsed code back to a text-based G/M/T-code
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | Reconstructed code string |
Overrides
TryGetBool(char, out bool)
Try to get a long parameter value by letter
Declaration
public bool TryGetBool(char letter, out bool parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| bool | parameter | Parameter if found, else default |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetBool(char, out bool?)
Try to get a long parameter value by letter
Declaration
public bool TryGetBool(char letter, out bool? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| bool? | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetDriverId(char, out DriverId?)
Try to get a driver ID parameter value by letter
Declaration
public bool TryGetDriverId(char letter, out DriverId? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| DriverId | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetDriverIdArray(char, out DriverId[]?)
Try to get a long array parameter value by letter
Declaration
public bool TryGetDriverIdArray(char letter, out DriverId[]? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| DriverId[] | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetFloat(char, out float?)
Try to get a float parameter value by letter
Declaration
public bool TryGetFloat(char letter, out float? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| float? | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetFloat(char, out float)
Try to get a float parameter value by letter
Declaration
public bool TryGetFloat(char letter, out float parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| float | parameter | Parameter if found, else default |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetFloatArray(char, out float[]?)
Try to get a float array parameter value by letter
Declaration
public bool TryGetFloatArray(char letter, out float[]? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| float[] | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetIPAddress(char, out IPAddress?)
Try to get a driver ID parameter value by letter
Declaration
public bool TryGetIPAddress(char letter, out IPAddress? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| IPAddress | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetInt(char, out int)
Try to get an integer parameter value by letter
Declaration
public bool TryGetInt(char letter, out int parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| int | parameter | Parameter if found, else default |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetInt(char, out int?)
Try to get an integer parameter value by letter
Declaration
public bool TryGetInt(char letter, out int? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| int? | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetIntArray(char, out int[]?)
Try to get an integer array parameter value by letter
Declaration
public bool TryGetIntArray(char letter, out int[]? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| int[] | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetLong(char, out long)
Try to get a long parameter value by letter
Declaration
public bool TryGetLong(char letter, out long parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| long | parameter | Parameter if found, else default |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetLong(char, out long?)
Try to get a long parameter value by letter
Declaration
public bool TryGetLong(char letter, out long? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| long? | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetLongArray(char, out long[]?)
Try to get a long array parameter value by letter
Declaration
public bool TryGetLongArray(char letter, out long[]? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| long[] | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetParameter(char, out CodeParameter?)
Try to get a parameter by letter
Declaration
public bool TryGetParameter(char letter, out CodeParameter? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| CodeParameter | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
TryGetString(char, out string?)
Try to get a string parameter value by letter
Declaration
public bool TryGetString(char letter, out string? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| string | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetUInt(char, out uint?)
Try to get an unsigned integer parameter value by letter
Declaration
public bool TryGetUInt(char letter, out uint? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| uint? | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetUInt(char, out uint)
Try to get an unsigned integer parameter value by letter
Declaration
public bool TryGetUInt(char letter, out uint parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| uint | parameter | Parameter if found, else default |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |
TryGetUIntArray(char, out uint[]?)
Try to get an unsigned integer array parameter value by letter
Declaration
public bool TryGetUIntArray(char letter, out uint[]? parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| char | letter | Letter of the parameter to find |
| uint[] | parameter | Parameter if found, else null |
Returns
| Type | Description |
|---|---|
| bool | True if the requested parameter could be found |
Exceptions
| Type | Condition |
|---|---|
| InvalidParameterTypeException | Failed to convert parameter value |