public void AddAttempt(string name, Exception exception = null) { try { string guid = GetIdOnRobotJobFile(name); if (!_jobs.ContainsKey(guid)) { throw new Exception("The job was not found, but it should be."); } lock (GetSyncObject(guid)) { string file = Path.Combine(CommonService.JobsDirectory, $"{ name }.xml"); RobotJobManager.Save(file, new AddAttemptRobotJob() { ErrorMessage = exception == null ? null : $"{ exception.Message }\n{ exception.StackTrace }" }); } } catch (Exception ex) { throw ex; } }
private void CreateRobotJob(string path) { string guid = GetIdOnRobotJobFile(path); lock (GetSyncObject(guid)) { if (!File.Exists(path)) { throw new Exception("The job was not found, but it should be."); } Job job = RobotJobManager.Parse(path); _jobs[guid] = job; } }
public string Create(Globals.BackgroundAppType type, DateTime dt, Dictionary <string, object> parameters) { try { string guid = null; string name = GetRobotJobFileName(type, out guid); AddSynObject(guid); lock (GetSyncObject(guid)) { string file = Path.Combine(CommonService.JobsDirectory, $"{ name }.xml"); RobotJobManager.Save(file, name, type, dt, parameters); } return(name); } catch (Exception ex) { throw ex; } }