Пример #1
0
        private async Task <bool> ExecuteEventInterceptorMethod(CrawlingEventInterceptorBase eventInterceptor, Func <CrawlingEventInterceptorBase, Task <bool> > executeMethodFunc)
        {
            return(await executeMethodFunc(eventInterceptor)
                   .ContinueWith(task =>
            {
                if (task.Status == TaskStatus.RanToCompletion)
                {
                    if (!task.Result)
                    {
                        Trace.TraceWarning("{0}: returned FALSE", eventInterceptor.GetType());
                    }

                    return task.Result;
                }
                else
                {
                    Trace.TraceError("{0}: Failed with exception {1}", eventInterceptor.GetType(), task.Exception);
                    return false;
                }
            }));
        }
Пример #2
0
 public void RegisterInterceptor(CrawlingEventInterceptorBase interceptor, int order = 10)
 {
     CrawlingEventInterceptors.AddValue(order, interceptor);
 }