private void ExecuteRunnerAction(RunnerAction runnerAction) { Console.WriteLine("Chosen action is: " + runnerAction.LongName); var client = TdlClient.Build() .SetHostname(hostname) .SetUniqueId(username) .SetAuditStream(new ConsoleAuditStream()) .Create(); var processingRules = new ProcessingRules(); processingRules .On("display_description") .Call(p => RoundManagement.SaveDescription(p[0], p[1])) .Then(ClientActions.Publish); foreach (var solution in solutions) { processingRules .On(solution.Key) .Call(solution.Value) .Then(runnerAction.ClientAction); } client.GoLiveWith(processingRules); RecordingSystem.NotifyEvent(RoundManagement.GetLastFetchedRound(), runnerAction.ShortName); }
public void Start(string[] args) { if (!IsRecordingSystemOk()) { Console.WriteLine("Please run `record_screen_and_upload` before continuing."); return; } var runnerAction = ExtractActionFrom(args).OrElse(defaultRunnerAction); Console.WriteLine("Chosen action is: " + runnerAction.LongName); var client = TdlClient.Build() .SetHostname(hostname) .SetUniqueId(username) .SetAuditStream(new ConsoleAuditStream()) .Create(); var processingRules = new ProcessingRules(); processingRules .On("display_description") .Call(p => RoundManagement.DisplayAndSaveDescription(p[0], p[1])) .Then(ClientActions.Publish); foreach (var solution in solutions) { processingRules .On(solution.Key) .Call(solution.Value) .Then(runnerAction.ClientAction); } client.GoLiveWith(processingRules); RecordingSystem.NotifyEvent(RoundManagement.GetLastFetchedRound(), runnerAction.ShortName); }
public void WhenIGoLiveWithTheFollowingProcessingRules(Table table) { var processingRuleSpecItems = table.CreateSet <ProcessingRuleSpecItem>().ToList(); var processingRules = new ProcessingRules(); processingRuleSpecItems.ForEach(ruleSpec => processingRules .On(ruleSpec.Method) .Call(CallImplementationFactory.Get(ruleSpec.Call)) .Then(ClientActionsFactory.Get(ruleSpec.Action))); var stopwatch = new Stopwatch(); stopwatch.Start(); client.GoLiveWith(processingRules); stopwatch.Stop(); processingTimeMillis = stopwatch.ElapsedMilliseconds; }