Class CodeBlock
- Namespace
- DuetControlServer.Files
- Assembly
- DuetControlServer.dll
Class representing a code block in a conditional G-code file
public record CodeBlock : IEquatable<CodeBlock>
- Inheritance
-
CodeBlock
- Implements
- Inherited Members
Constructors
CodeBlock(Code, bool)
Constructor of this class
public CodeBlock(Code startingCode, bool processBlock)
Parameters
startingCodeCodeCode starting this block
processBlockboolWhether instructions from this block may be processed
CodeBlock(CodeBlock)
protected CodeBlock(CodeBlock original)
Parameters
originalCodeBlock
Properties
ContinueLoop
Indicates if continue was called in a while loop
public bool ContinueLoop { get; set; }
Property Value
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
ExpectingElse
Indicates if the corresponding condition may be followed by elif/else
public bool ExpectingElse { get; set; }
Property Value
FilePosition
File position where the block started
public long? FilePosition { get; }
Property Value
- long?
HasLocalVariables
Indicates if this block contains local variables
public bool HasLocalVariables { get; set; }
Property Value
Indent
Indentation of this block
public int Indent { get; }
Property Value
Iterations
Number of times this code block has been run so far
public int Iterations { get; set; }
Property Value
Keyword
Keyword starting the block
public KeywordType Keyword { get; }
Property Value
LineNumber
Line number where the block started
public long? LineNumber { get; }
Property Value
- long?
LocalVariables
List of local variables
public List<string> LocalVariables { get; }
Property Value
ProcessBlock
Last evaluation result of the conditional start code indicating if this block is supposed to be processed
public bool ProcessBlock { get; set; }
Property Value
SeenCodes
Whether any codes or echo instructions have been executed so far
public bool SeenCodes { get; set; }
Property Value
Methods
Equals(CodeBlock?)
public virtual bool Equals(CodeBlock? other)
Parameters
otherCodeBlock
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsFinished(int)
Check if the given indentation level finishes this block
public bool IsFinished(int indent)
Parameters
indentintCurrent indentation level
Returns
- bool
Whether the block is complete
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(CodeBlock?, CodeBlock?)
public static bool operator ==(CodeBlock? left, CodeBlock? right)
Parameters
Returns
operator !=(CodeBlock?, CodeBlock?)
public static bool operator !=(CodeBlock? left, CodeBlock? right)