Beispiel #1
0
        private static void LoadAllJobs()
        {
            //string[] files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "Task-*.xml", SearchOption.TopDirectoryOnly);
            string[] files = ConfigHelper.GetTaskFileNames();

            List <JobOption> list = new List <JobOption>(files.Length);

            foreach (string file in files)
            {
                string    xml = ConfigHelper.GetFile(file);
                JobOption job = XmlHelper.XmlDeserialize <JobOption>(xml);
                job.TaskFileName = file;

                if (job.Branch != null)     // 这二个属性在作业的XML文件中不需要指定
                {
                    job.Branch.Id   = job.Id;
                    job.Branch.Name = job.Name;
                }
                list.Add(job);
            }

            s_jobList = (from x in list
                         orderby x.Id
                         select x
                         ).ToArray();

            SetAllDefaultIgnoreRules();
        }
Beispiel #2
0
        public static JobOption GetJob(int id)
        {
            Init();

            JobOption job = s_jobList.FirstOrDefault(x => x.Id == id);

            if (job == null)
            {
                throw new ArgumentOutOfRangeException("指定的作业ID不存在:" + id.ToString());
            }

            return(job);
        }