This repository has been archived by the owner on Jun 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Runner.cs
58 lines (50 loc) · 1.58 KB
/
Runner.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
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
namespace SupportTool
{
class Runner
{
private Config config;
private FileAggregator fileAggregator;
private LoggerInterface logger;
public Runner(Config config, FileAggregator fileAggregator, LoggerInterface logger)
{
this.config = config;
this.fileAggregator = fileAggregator;
this.logger = logger;
}
public void Run(List<CommandInterface> commands)
{
Propagation propagation = new Propagation();
foreach (CommandInterface command in commands)
{
if (propagation.ShouldStop)
{
logger.Log("Aborted");
return;
}
if (command is CommandCheckBoxInterface)
{
CommandCheckBoxInterface excludable = (CommandCheckBoxInterface)command;
bool shouldRun = (bool)config.GetType().GetProperty(excludable.ConfigPropertyPath).GetValue(config);
if (!shouldRun)
{
logger.Log("Skipping "+excludable.Text);
continue;
}
}
try
{
command.Execute(config, fileAggregator, logger, propagation);
}
catch (Exception e)
{
logger.Log(e.ToString());
#if DEBUG
throw e;
#endif
}
}
}
}
}