public override void RunCommand() { if (!LicenseTool.FeatureAllowedMsg(JobsFeature.Test)) { Logging.Error("Proffesional edition required"); return; } if (m_jobname.ToLower().EndsWith(".djb")) { m_jobname = m_jobname.Substring(0, m_jobname.Length - 4); } Job job = Job.LoadFromFile(Path.Combine(Core.JobsDirectory, m_jobname + ".djb")); Logging.Info("Running job: " + job.ToString()); if (!String.IsNullOrEmpty(Filtercommands)) { var job2 = new Job(); var ids = new HashSetEx <string>(Filtercommands.Split('|')); foreach (var cmd in job.Root.Commands) { if (ids.Contains(cmd.GroupId)) { job2.AddCommand(cmd.Clone(false)); } } job2 = job; } job.Run(ExtParams); Logging.Info("Job finished"); }
public static SaveJobResult Run(Func <Job> createJob) { if (!LicenseTool.FeatureAllowedMsg(JobsFeature.Test)) { return(null); } //if (!Licenseto. Registration.TryCheckEdition(SoftwareEdition.Professional, "export to job")) return null; SaveJobForm win = new SaveJobForm(); if (win.ShowDialogEx() == DialogResult.OK) { if (win.rbtCreateNewJob.Checked) { string fn = Path.Combine(Core.JobsDirectory, win.tbxJob.Text + ".djb"); if (File.Exists(fn)) { if (!StdDialog.ReallyOverwriteFile(fn)) { return(null); } } try { Job job = createJob(); job.SaveToFile(fn); if (win.chbAddToFavorites.Checked) { if (String.IsNullOrEmpty(win.addToFavoritesFrame1.FavoriteName)) { win.addToFavoritesFrame1.FavoriteName = Path.GetFileNameWithoutExtension(fn); } win.addToFavoritesFrame1.Favorite = new JobFavorite { JobFile = fn }; Favorites.AddLast(win.addToFavoritesFrame1.GetHolder()); Favorites.NotifyChanged(); } //UsageStats.Usage("export_as_job", "jobname", job.ToString(), "addtofavorite", win.chbAddToFavorites.Checked ? "1" : "0"); return(new SaveJobResult { Commands = new List <JobCommand>(job.Root.m_commands), JobConn = new JobConnection(fn), }); } catch (Exception err) { Errors.Report(err); } } if (win.rbtAppendToExistingJob.Checked) { string fn = Path.Combine(Core.JobsDirectory, win.lbxJobs.Items[win.lbxJobs.SelectedIndex].ToString()); Job job = Job.LoadFromFile(fn); Job job2 = createJob(); job.Root.m_commands.AddRange(job2.Root.m_commands); job.SaveToFile(fn); return(new SaveJobResult { Commands = new List <JobCommand>(job2.Root.m_commands), JobConn = new JobConnection(fn), }); } } return(null); }