private void checkAExp(Object index)
 {
     while (urlMappings.Count > 0)
     {
         BatchExps batchExp = null;
         lock (base_lock)
         {
             batchExp = urlMappings.Dequeue();
         }
         if (batchExp == null)
         {
             continue;
         }
         try
         {
             String url = "";
             if (BatchCheckListView.Items[batchExp.Index].ForeColor == Color.Green)
             {
                 continue;
             }
             ExpModule exp = getExpByIndex(batchExp.ExpIndex);
             url = BatchCheckListView.Items[batchExp.Index].SubItems[1].Text;
             BatchCheckListView.Items[batchExp.Index].SubItems[3].Text = "检测" + exp.Name;
             ExpVerificationResult result = ExpHandle.Verification(url, exp);
             result.Index = batchExp.Index;
             if (result.Code == 1)
             {
                 BatchCheckListView.Items[result.Index].SubItems[3].Text = result.Result;
                 BatchCheckListView.Items[result.Index].SubItems[2].Text = result.ExpName;
                 BatchCheckListView.Items[result.Index].ForeColor        = Color.Green;
                 successProsion++;
             }
             if (result.Code == 2)
             {
                 continue;
             }
         }
         catch { }
         finally
         {
             try
             {
                 lock (base_lock)
                 {
                     checkNum[batchExp.Index]++;
                 }
                 if (BatchCheckListView.Items[batchExp.Index].ForeColor != Color.Green)
                 {
                     if (checkNum[batchExp.Index] >= expLength)
                     {
                         BatchCheckListView.Items[batchExp.Index].ForeColor        = Color.DarkGray;
                         BatchCheckListView.Items[batchExp.Index].SubItems[3].Text = "不存在漏洞";
                     }
                 }
             }
             catch { }
             Thread.Sleep(1);
         }
     }
 }
 private void initUrlMapping()
 {
     BatchStatusStrip.Enabled = false;
     try
     {
         urlMappings.Clear();
         expDics.Clear();
         checkNum.Clear();
         int remain = BatchCheckListView.Items.Count;
         for (int i = 0; i < remain; i++)
         {
             try { checkNum.Add(i, 0); }
             catch { }
         }
         for (int i = 0; i < BatchCheckListView.Items.Count; i++)
         {
             if (BatchCheckListView.Items[i].ForeColor != Color.Black)
             {
                 BatchCheckListView.Items[i].ForeColor = Color.Black;
             }
         }
         List <Int32> ranges    = new List <int>();
         Int32        threadNum = Convert.ToInt32(ThreadNumComboBox.Text);
         while (remain > 0)
         {
             if (remain > threadNum)
             {
                 remain = remain - threadNum;
                 ranges.Add(threadNum);
                 continue;
             }
             ranges.Add(remain);
             remain = remain - remain;
         }
         int index = 0;
         foreach (Int32 range in ranges)
         {
             for (int j = 0; j < ExpListView.Items.Count; j++)
             {
                 for (int i = 0; i < range; i++)
                 {
                     try
                     {
                         if (ExpListView.Items[j].SubItems[5].Text.Equals("启用"))
                         {
                             BatchExps batch = new BatchExps();
                             batch.ExpIndex = j;
                             batch.Index    = index + i;
                             urlMappings.Enqueue(batch);
                         }
                     }
                     catch { }
                 }
             }
             index += range;
         }
         expDics.Clear();
         for (int i = 0; i < ExpListView.Items.Count; i++)
         {
             getExpByIndex(i);
         }
     }
     catch { }
     finally
     {
         BatchStatusStrip.Enabled = true;
     }
 }