Example #1
0
File: Task.cs Project: legigor/Nake
        string ProxyBody(BaseMethodDeclarationSyntax method, string body)
        {
            var arguments = TaskArgument.BuildArgumentString(method.ParameterList.Parameters);

            return(symbol.IsAsync
                ? TaskRegistry.BuildInvokeTaskAsyncString(FullName, arguments, body)
                : TaskRegistry.BuildInvokeTaskString(FullName, arguments, body));
        }
Example #2
0
 object Convert(TaskArgument arg, int position, ParameterInfo parameter)
 {
     try
     {
         return(arg.Convert(parameter.ParameterType));
     }
     catch (InvalidCastException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (FormatException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (ArgumentException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (OverflowException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
 }
Example #3
0
File: Task.cs Project: jthelin/Nake
        public void Invoke(object script, TaskArgument[] arguments)
        {
            var invocation = new TaskInvocation(script, this, reflected, arguments);

            if (step)
            {
                var alreadyInvoked = !invocations.Add(invocation);
                if (alreadyInvoked)
                    return;
            }

            invocation.Invoke();
        }
Example #4
0
 object Convert(TaskArgument arg, int position, ParameterInfo parameter)
 {
     try
     {
         return arg.Convert(parameter.ParameterType);
     }
     catch (InvalidCastException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (FormatException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (ArgumentException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
     catch (OverflowException e)
     {
         throw new TaskArgumentException(task, parameter.Name, position, e.Message);
     }
 }