예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }