void loadSchedules()
        {
            if (_schedules == null)
            {
                _schedules = new Dictionary <string, SealSchedule>();
            }
            lock (_schedules)
            {
                foreach (var file in Directory.GetFiles(Repository.Instance.SchedulesFolder, "*.xml"))
                {
                    var schedule = _schedules.Values.FirstOrDefault(i => i.FilePath == file);
                    if (schedule == null || (!schedule.BeingExecuted && File.GetLastWriteTime(file) != schedule.LastModification))
                    {
                        try
                        {
                            schedule = SealSchedule.LoadFromFile(file);
                            //Adjust report path if necessary (case of copy between Windows OS to Linux OS)
                            if (!File.Exists(schedule.ReportPath))
                            {
                                var newReportPath = Repository.Instance.ReportsFolder + schedule.ReportPath;
                                if (Path.DirectorySeparatorChar == '/' && newReportPath.Contains("\\"))
                                {
                                    newReportPath = newReportPath.Replace("\\", "/");
                                }
                                else if (Path.DirectorySeparatorChar == '\\' && newReportPath.Contains("/"))
                                {
                                    newReportPath = newReportPath.Replace("/", "\\");
                                }
                                if (File.Exists(newReportPath))
                                {
                                    schedule.ReportPath = newReportPath;
                                }
                            }

                            if (_schedules.ContainsKey(schedule.GUID))
                            {
                                _schedules[schedule.GUID] = schedule;
                            }
                            else
                            {
                                _schedules.Add(schedule.GUID, schedule);
                            }
                        }

                        catch (Exception ex)
                        {
                            Helper.WriteLogEntryScheduler(EventLogEntryType.Error, "Error loading '{0}'.\r\n{1}", file, ex.Message);
                        }
                    }
                }

                //Remove lost schedules
                foreach (var schedule in _schedules.Values.Where(i => !File.Exists(i.FilePath)).ToList())
                {
                    _schedules.Remove(schedule.GUID);
                }
            }
        }
        void loadSchedules()
        {
            if (_schedules == null)
            {
                _schedules = new Dictionary <string, SealSchedule>();
            }
            lock (_schedules)
            {
                foreach (var file in Directory.GetFiles(Repository.Instance.SchedulesFolder, "*.xml"))
                {
                    var schedule = _schedules.Values.FirstOrDefault(i => i.FilePath == file);
                    if (schedule == null || (!schedule.BeingExecuted && File.GetLastWriteTime(file) != schedule.LastModification))
                    {
                        try
                        {
                            schedule = SealSchedule.LoadFromFile(file);
                            if (_schedules.ContainsKey(schedule.GUID))
                            {
                                _schedules[schedule.GUID] = schedule;
                            }
                            else
                            {
                                _schedules.Add(schedule.GUID, schedule);
                            }
                        }

                        catch (Exception ex)
                        {
                            Helper.WriteLogEntryScheduler(EventLogEntryType.Error, "Error loading '{0}'.\r\n{1}", file, ex.Message);
                        }
                    }
                }

                //Remove lost schedules
                foreach (var schedule in _schedules.Values.Where(i => !File.Exists(i.FilePath)).ToList())
                {
                    _schedules.Remove(schedule.GUID);
                }
            }
        }