Table of Contents

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

startingCode Code

Code starting this block

processBlock bool

Whether instructions from this block may be processed

CodeBlock(CodeBlock)

protected CodeBlock(CodeBlock original)

Parameters

original CodeBlock

Properties

ContinueLoop

Indicates if continue was called in a while loop

public bool ContinueLoop { get; set; }

Property Value

bool

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

ExpectingElse

Indicates if the corresponding condition may be followed by elif/else

public bool ExpectingElse { get; set; }

Property Value

bool

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

bool

Indent

Indentation of this block

public int Indent { get; }

Property Value

int

Iterations

Number of times this code block has been run so far

public int Iterations { get; set; }

Property Value

int

Keyword

Keyword starting the block

public KeywordType Keyword { get; }

Property Value

KeywordType

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

List<string>

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

bool

SeenCodes

Whether any codes or echo instructions have been executed so far

public bool SeenCodes { get; set; }

Property Value

bool

Methods

Equals(CodeBlock?)

public virtual bool Equals(CodeBlock? other)

Parameters

other CodeBlock

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

IsFinished(int)

Check if the given indentation level finishes this block

public bool IsFinished(int indent)

Parameters

indent int

Current indentation level

Returns

bool

Whether the block is complete

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

Operators

operator ==(CodeBlock?, CodeBlock?)

public static bool operator ==(CodeBlock? left, CodeBlock? right)

Parameters

left CodeBlock
right CodeBlock

Returns

bool

operator !=(CodeBlock?, CodeBlock?)

public static bool operator !=(CodeBlock? left, CodeBlock? right)

Parameters

left CodeBlock
right CodeBlock

Returns

bool