//TODO: Add Error management // Non-service execution internal static void ExecuteConfig(string path) { // Set current directory as base directory Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); // Get application settings Settings.Agent settings = Agent.GetSettings(path); // Create envent handlers Agent.SetEventReaders(settings.EventLogs); // Create tasks Agent.CreateTasks(settings.InputPlugins); }
/// <summary> /// Executes the service logic occording to the specified options /// </summary> /// <param name="options">Parsed options</param> private void Start(ServiceOptions options) { // Get application settings Settings.Agent settings = Agent.GetSettings(options.Config); // Create envent handlers Agent.SetEventReaders(settings.EventLogs); // Create tasks Agent.CreateTasks(settings.InputPlugins); // Create detached autoupdater if autoupdates are enabled if (settings.AutoUpdates.Enabled) { // Run the updater after 1 minute // The timer will run every 10 mins Timer updaterTimer = new Timer(new TimerCallback(RunUpdater), null, 60000, settings.AutoUpdates.Schedule.GetTime()); // Save reference to avoid GC Agent.timersReference.Add(updaterTimer); } }