/// <summary> /// Add a job to the tab. /// </summary> /// <remarks>Will not add null objects.</remarks> /// <param name="job">The job to add.</param> public void AddJob(CronJob job) { if (job != null) { jobs.Add(job); } }
protected override void OnStart(string[] args) { // do startup stuff EventLog.WriteEntry("Starting WinCron service."); foreach (string line in File.ReadLines("crontab.txt")) { if (line.StartsWith("#")) { continue; } try { CronJob job = new CronJob(line); crontab.AddJob(job); } catch (ArgumentException ex) { this.EventLog.WriteEntry("Unparsable line: (" + line + ") - " + ex.Message); continue; } } masterthread.Start(); }