public static void UpdateExecutionSchedule(this ExecutionSchedule schedule, DirectoryInfo rootStatus) { var statusFile = schedule.GetStatusFileInfo(rootStatus); if (!statusFile.Directory.Exists) { statusFile.Directory.Create(); } statusFile.WriteAllText(schedule.JsonSerialize()); }
public static ExecutionSchedule LoadExecutionSchedule(this ExecutionSchedule schedule, DirectoryInfo rootStatus) { if (schedule.id.IsNullOrEmpty()) { throw new Exception("Schedule ID was not defined, could not load."); } var statusFile = schedule.GetStatusFileInfo(rootStatus); if (!statusFile.Directory.Exists) { statusFile.Directory.Create(); } if (!statusFile.Exists) { statusFile.WriteAllText("{ }"); } return(statusFile.DeserialiseJson <ExecutionSchedule>()); }