Skip to content

Compiler

Summary

Provides access to compiler for algos.

Signature

1
public abstract interface Compiler

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 using cAlgo.API;
 namespace cAlgo.Robots;
 [Robot(AccessRights = AccessRights.None)]
 public class TestExample : Robot
 {
    protected override void OnStart()
    {
        // Path is relative to Algo type data directory
        var result = Compiler.Compile(@"Test\Test\Test.csproj");
        if (result.Succeeded)
             Print("Compilation finished successfully");
        else
             Print($"Compilation failed with errors: {string.Join(", ", result.Errors)}");
    }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 using cAlgo.API;
 namespace cAlgo.Robots;
 [Robot(AccessRights = AccessRights.None)]
 public class TestExample : Robot
 {
    protected override void OnStart()
    {
        // Path is relative to Algo type data directory
        var operation = Compiler.CompileAsync(@"Test\Test\Test.csproj", result => 
        {
             if (result.Succeeded)
                 Print("Compilation finished successfully");
             else
                 Print($"Compilation failed with errors: {string.Join(", ", result.Errors)}");
        });
        if (operation.IsExecuting)
             Print("Compilation is running");
    }
 }

Methods

Compile (2)

Compile (1 of 2)

Summary

Compiles an algo.

Signature

1
public abstract CompilationResult Compile(string csprojFilePath)

Parameters

Name Type Description
csprojFilePath string Algo project file path.

Return Value

CompilationResult

Compile (2 of 2)

Summary

Compiles an algo.

Signature

1
public abstract CompilationResult Compile(string csprojFilePath, CompilationOptions options)

Parameters

Name Type Description
csprojFilePath string Algo project file path.
options CompilationOptions Compilation options.

Return Value

CompilationResult

CompileAsync (2)

CompileAsync (1 of 2)

Summary

Compiles an algo asynchronously and calls the passed callback when compilation finishes.

Signature

1
public abstract CompilationOperation CompileAsync(string csprojFilePath, Action<CompilationResult> callback)

Parameters

Name Type Description
csprojFilePath string Algo project file path.
callback Action Callback that will be called after compilation finished.

Return Value

CompilationOperation

CompileAsync (2 of 2)

Summary

Compiles an algo asynchronously and calls the passed callback when compilation finishes.

Signature

1
public abstract CompilationOperation CompileAsync(string csprojFilePath, Action<CompilationResult> callback, CompilationOptions options)

Parameters

Name Type Description
csprojFilePath string Algo project file path.
callback Action Callback that will be called after compilation finished.
options CompilationOptions Compilation options.

Return Value

CompilationOperation