예제 #1
0
파일: Target.cs 프로젝트: perploug/cshake
        public ITarget Run(IContext context)
        {
            context.Important(this.Description);

            if (IfFunc != null)
            {
                bool result = IfFunc.Invoke();
                if (!result)
                    return this;
            }
            if (UnlessFunc != null)
            {
                bool result = UnlessFunc.Invoke();
                if (result)
                    return this;
            }

            if (ExecutionAction != null)
            {
                try
                {
                    ExecutionAction.DynamicInvoke(null);
                }
                catch (Exception ex)
                {
                    context.Error(ex);

                    if (ThrowExceptionOnError)
                        throw new TargetExecutionException();
                }
            }

            return this;
        }