-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
47 lines (34 loc) · 1.09 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using IronBlock;
using IronBlock.Blocks;
namespace Project;
public class Program
{
public static int Main(string[] args)
{
// create a parser
var parser = new Parser();
// add the standard blocks to the parser
parser.AddStandardBlocks();
parser.AddBlock<MyCustomBlock1>("my_custom_block");
// read xml from a file
var xml = File.ReadAllText("my_file.xml");
// parse the xml file to create a workspace
var workspace = parser.Parse(xml);
// run the workspace
var output = workspace.Evaluate();
// "Hello World"
Console.WriteLine(output);
return 0;
}
}
public class MyCustomBlock1 : BlockBase
{
public override async Task<object> PerformStuff(Context context)
{
//print all context.Variables
context.Variables.ToList().ForEach(x => Console.WriteLine(x.Key + " " + x.Value));
Console.WriteLine("[WorkerThread] Performing work ");
await Task.Delay(3000);
return null;
}
}