예제 #1
0
 public void Start(AutomationConfig config)
 {
     foreach (var triggerConfig in config.Triggers)
     {
         foreach (var eventConfig in triggerConfig.Events)
         {
             Log.Information("Subscribing event {Event}", eventConfig);
             SubscribeEvent(eventConfig, () =>
             {
                 Log.Information("Handling event {Event}", eventConfig);
                 if (triggerConfig.IsActive)
                 {
                     CallTrigger(triggerConfig);
                 }
             });
         }
     }
 }
예제 #2
0
        private static AutomationConfig LoadAutomationConfig(string filePath)
        {
            var document = XDocument.Load(filePath);

            return(AutomationConfig.FromXml(document.Root));
        }
 public void OneTimeSetUp()
 {
     Config = AutomationConfig.DeserializeConfig("AutomationSettings.json");
 }
예제 #4
0
 public AutomationConfig LoadAutomationConfig(string fileName) => LoadConfig(fileName, element => AutomationConfig.FromXml(element));