Class Macro
Class representing a macro being executed
Inheritance
Implements
Inherited Members
Namespace: DuetControlServer.FileExecution
Assembly: DuetControlServer.dll
Syntax
public sealed class Macro : IDisposable
Constructors
Macro(String, String, CodeChannel, Boolean, Int32)
Constructor of a macro
Declaration
public Macro(string fileName, string physicalFile, CodeChannel channel, bool isNested = false, int sourceConnection = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Filename of the macro |
System.String | physicalFile | Physical path of the macro |
CodeChannel | channel | Code requesting the macro |
System.Boolean | isNested | Whether the code was started from a G/M/T-code |
System.Int32 | sourceConnection | Original IPC connection requesting this macro file |
Properties
CancellationToken
Cancellation token that is triggered when the file is cancelled/aborted
Declaration
public CancellationToken CancellationToken { get; }
Property Value
Type | Description |
---|---|
System.Threading.CancellationToken |
Channel
Channel on which this macro is running
Declaration
public CodeChannel Channel { get; }
Property Value
Type | Description |
---|---|
CodeChannel |
FileName
Name of the file being executed
Declaration
public string FileName { get; }
Property Value
Type | Description |
---|---|
System.String |
FileOpened
Indicates if the macro file could be opened
Declaration
public bool FileOpened { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsAborted
Indicates if the macro file has been aborted
Declaration
public bool IsAborted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsConfig
Whether this file is config.g or config.g.bak
Declaration
public bool IsConfig { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsConfigOverride
Whether this file is config-override.g
Declaration
public bool IsConfigOverride { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsExecuting
Indicates if the macro file is being executed
Declaration
public bool IsExecuting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNested
Indicates if this macro was started from a G/M/T-code
Declaration
public bool IsNested { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPausable
Indicates if this macro can be aborted on a pause request
Declaration
public bool IsPausable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
JustStarted
Indicates if the macro file has just started
Declaration
public bool JustStarted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SourceConnection
IPC connection that (indirectly) requested this macro file
Declaration
public int SourceConnection { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Abort()
Abort this macro
Declaration
public void Abort()
AbortAsync()
Abort this macro asynchronously
Declaration
public async Task AbortAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Dispose()
Dispose this instance
Declaration
public void Dispose()
FinishAsync()
Wait for this macro to finish asynchronously
Declaration
public Task FinishAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Remarks
This task is always resolved and never cancelled
Lock()
Lock this instance
Declaration
public IDisposable Lock()
Returns
Type | Description |
---|---|
System.IDisposable | Disposable lock |
LockAsync()
Lock this instance asynchronously
Declaration
public AwaitableDisposable<IDisposable> LockAsync()
Returns
Type | Description |
---|---|
Nito.AsyncEx.AwaitableDisposable<System.IDisposable> | Disposable lock |
WaitForCodeFinish()
Method to wait until a new code can be finished in the right order
Declaration
public AwaitableDisposable<IDisposable> WaitForCodeFinish()
Returns
Type | Description |
---|---|
Nito.AsyncEx.AwaitableDisposable<System.IDisposable> | Disposable lock |
Remarks
This is required in case a flush is requested before another nested macro is started
WaitForCodeStart()
Method to wait until a new code can be started in the right order
Declaration
public AwaitableDisposable<IDisposable> WaitForCodeStart()
Returns
Type | Description |
---|---|
Nito.AsyncEx.AwaitableDisposable<System.IDisposable> | Disposable lock |
Remarks
This is required in case a flush is requested before another nested macro is started