Exemple #1
0
 protected void InvokeTaskProcessDoneEvent(object sender, TaskProcessDoneEventHandlerArgs args)
 {
     if (OnTaskProcessDone != null)
     {
         OnTaskProcessDone(sender, args);
     }
 }
Exemple #2
0
        private void DoTaskProcessDone(object sender, TaskProcessDoneEventHandlerArgs args)
        {
            if (args.ContentProcessResult.NewTasks != null)
            {
                taskPool.ProduceTasks(args.ContentProcessResult.NewTasks);
            }
            ProxyInfo pi = args.ProxyInfo;

            if (pi != null)
            {
                if (!args.ContentProcessResult.Success)
                {
                    ProxyPool.FailProxy(pi);
                }
            }
            if (args.ContentProcessResult.Success)
            {
                //finish task
                taskPool.FinishTask(args.Task);
            }
            else
            {
                //file not ok
                string path = args.Task.LocalPath;
                if (taskGuide.ShouldStore(args.Task))
                {
                    try
                    {
                        File.Delete(path);
                        Console.WriteLine("MalFile deleted {0}", Path.GetFileName(path));
                    }
                    catch (IOException)
                    {
                    }
                }

                //re enqueue
                taskPool.FailTask(args.Task);
            }
        }