public T Exec <T>(ScriptUtility xx, string name, object input = null)
        {
            var command = utilityCommands.FirstOrDefault(x => x.Metadata.CommandName == name);

            if (command == null)
            {
                throw new Exception(String.Format("Command '{0}' not found", name));
            }
            if (command.Value.ReturnType != typeof(T))
            {
                throw new Exception(String.Format("Invalid returntype '{0}' was '{1}' expected '{2}'", name, typeof(T),
                                                  command.Value.ReturnType));
            }
            if (input != null)
            {
                if (!command.Value.InputType.IsAssignableFrom(input.GetType()))
                {
                    throw new Exception(String.Format("Invalid input type '{0}' was '{1}' expected '{2}'", name,
                                                      input.GetType(), command.Value.InputType));
                }
            }
            else if (command.Value.InputType != typeof(void))
            {
                throw new Exception(String.Format("Input '{1}' expected type {0}", command.Value.InputType, name));
            }

            return((T)command.Value.Execute(xx, input));
        }
 public void Init(
     SchedulerTaskScriptDependencies dependencies,
     ITaskSettings settings,
     ScriptFlow flow,
     ScriptUtility utils
     )
 {
     this.x            = utils;
     this.Settings     = settings;
     this.Flow         = flow;
     this.Dependencies = dependencies;
     if (dependencies != null && dependencies.GetType() != DependencyClassType)
     {
         throw new InvalidOperationException("Wrong dependency class provided");
     }
 }