예제 #1
0
 public void Add(Task t)
 {
     if(! ToRun.Contains(t))
     {
         ToRun.Add(t,new RunManifestItem{Task=t});
     }
 }
예제 #2
0
        public void Run(Recipe recipe, Task task, params object[] parameters )
        {
            //TODO: Tasks should run in their own appdomain?
            //      We need to create an app domain that has the
            //      base dir the same as the target assembly

            var recipeInstance = Activator.CreateInstance(recipe.Class);
            SetContextualInformationIfInheritsRecipeBase(recipeInstance);
            task.Method.Invoke(recipeInstance, parameters);
        }
예제 #3
0
 private static void CreateDependentTasks(Type type, string[] dependencies, Task task)
 {
     foreach(string methodName in dependencies)
     {
         var dependee = type.GetMethod(methodName);
         if(dependee == null) throw new Exception(String.Format("No dependee method {0}",methodName));
         task.DependsOnMethods.Add(dependee);
     }
 }
예제 #4
0
        private static Task CreateTaskFromAttribute(MethodInfo method, TaskAttribute ta)
        {
            Task t = new Task();

            if(! String.IsNullOrEmpty(ta.Name))
                t.Name = ta.Name;
            else
                t.Name = method.Name.Replace("Task", "").ToLower();

            t.Method = method;

            if(! String.IsNullOrEmpty(ta.Description))
                t.Description = ta.Description;
            else
                t.Description = "";
            return t;
        }