Beispiel #1
0
        public TaskParameters CreateSingleScriptTask <T>(Dictionary <string, object> paramz = null)
            where T : ISchedulerTaskScript, new()
        {
            if (paramz == null)
            {
                paramz = new Dictionary <string, object>();
            }
            var    scripts = new Dictionary <string, ISchedulerTaskScript>();
            string name    = "Single_" + typeof(T).FullName;

            scripts.Add(name, new T());

            var tp = new TaskParameters(scripts, paramz);

            tp.TaskName = name;
            return(tp);
        }
Beispiel #2
0
        public SchedulerTask InitTaskFromParameters(TaskParameters paramz)
        {
            SchedulerTask task = container.Resolve <SchedulerTask>();

            task.TaskName = paramz.TaskName;
            task.Settings = new DetachedTaskSettings();
            task.Scripts  = paramz.Scripts;
            foreach (var p in paramz.Settings)
            {
                //XXX: skip task and script speciffic params
                if (p.Key.StartsWith("task_"))
                {
                    log.Debug("skip param: " + p.Key);
                    continue;
                }
                task.Settings.Set(p.Key, p.Value);
            }
            return(task);
        }