Class CodeBlock
Class representing a code block in a conditional G-code file
Implements
Inherited Members
Namespace: DuetControlServer.Files
Assembly: DuetControlServer.dll
Syntax
public record CodeBlock : IEquatable<CodeBlock>
Constructors
CodeBlock(Code, bool)
Constructor of this class
Declaration
public CodeBlock(Code startingCode, bool processBlock)
Parameters
Type | Name | Description |
---|---|---|
Code | startingCode | Code starting this block |
bool | processBlock | Whether instructions from this block may be processed |
Properties
ContinueLoop
Indicates if continue was called in a while loop
Declaration
public bool ContinueLoop { get; set; }
Property Value
Type | Description |
---|---|
bool |
ExpectingElse
Indicates if the corresponding condition may be followed by elif/else
Declaration
public bool ExpectingElse { get; set; }
Property Value
Type | Description |
---|---|
bool |
FilePosition
File position where the block started
Declaration
public long? FilePosition { get; }
Property Value
Type | Description |
---|---|
long? |
HasLocalVariables
Indicates if this block contains local variables
Declaration
public bool HasLocalVariables { get; set; }
Property Value
Type | Description |
---|---|
bool |
Indent
Indentation of this block
Declaration
public int Indent { get; }
Property Value
Type | Description |
---|---|
int |
Iterations
Number of times this code block has been run so far
Declaration
public int Iterations { get; set; }
Property Value
Type | Description |
---|---|
int |
Keyword
Keyword starting the block
Declaration
public KeywordType Keyword { get; }
Property Value
Type | Description |
---|---|
KeywordType |
LineNumber
Line number where the block started
Declaration
public long? LineNumber { get; }
Property Value
Type | Description |
---|---|
long? |
LocalVariables
List of local variables
Declaration
public List<string> LocalVariables { get; }
Property Value
Type | Description |
---|---|
List<string> |
ProcessBlock
Last evaluation result of the conditional start code indicating if this block is supposed to be processed
Declaration
public bool ProcessBlock { get; set; }
Property Value
Type | Description |
---|---|
bool |
SeenCodes
Whether any codes or echo instructions have been executed so far
Declaration
public bool SeenCodes { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
IsFinished(int)
Check if the given indentation level finishes this block
Declaration
public bool IsFinished(int indent)
Parameters
Type | Name | Description |
---|---|---|
int | indent | Current indentation level |
Returns
Type | Description |
---|---|
bool | Whether the block is complete |