Ejemplo n.º 1
0
 private void SetThreadNum()
 {
     this.ThreadNum = m_TaskItemEntity.ThreadNum;
     runWebUrls     = new cGatherUrlItemDictionary();
     runFileUrls    = new cGatherUrlBaseItemDictionary();
     for (var i = 0; i < this.ThreadNum; i++)
     {
         runWebUrls.Add(i, new cGatherUrlItemQueue());
         runFileUrls.Add(i, new cGatherUrlBaseItemQueue());
     }
 }
Ejemplo n.º 2
0
        public void LoadTask(TaskRunItem _taskItemEntity)
        {
            this.GatherTaskType   = EnumGloabParas.EnumGatherTaskType.Noraml;
            this.m_TaskItemEntity = _taskItemEntity;
            this.ThreadNum        = _taskItemEntity.ThreadNum;
            runWebUrls            = new cGatherUrlItemDictionary();
            runFileUrls           = new cGatherUrlBaseItemDictionary();

            for (var i = 0; i < this.ThreadNum; i++)
            {
                runWebUrls.Add(i, new cGatherUrlItemQueue());
                runFileUrls.Add(i, new cGatherUrlBaseItemQueue());
            }
            if (_taskItemEntity.GatherUrlItemTempList != null)
            {
                List <cGatherUrlItem> mainList = _taskItemEntity.GatherUrlItemTempList.Where(q => q.GaterherFlag != EnumGloabParas.EnumUrlGaterherState.Run).ToList();
                foreach (var item in mainList)
                {
                    runWebUrls[0].Enqueue(item);
                }
                mainList = _taskItemEntity.GatherUrlItemTempList.Where(q => q.GaterherFlag == EnumGloabParas.EnumUrlGaterherState.Run).ToList();
                foreach (var item in mainList)
                {
                    runWebUrls[ThreadPos].Enqueue(item);
                }
            }
            if (_taskItemEntity.GatherFileItemTempList != null)
            {
                foreach (var item in _taskItemEntity.GatherFileItemTempList)
                {
                    runFileUrls[ThreadPos].Enqueue(item);
                }
            }
            if (_taskItemEntity.GatherUrlItemCompleteList != null)
            {
                this.runWebUrls.AddRange(_taskItemEntity.GatherUrlItemCompleteList);
            }
            if (_taskItemEntity.GatherFileItemCompleteList != null)
            {
                this.runFileUrls.AddRange(_taskItemEntity.GatherFileItemCompleteList);
            }
            this.GatherTaskType = EnumGloabParas.EnumGatherTaskType.RunData;
        }