コード例 #1
0
        private void BtnStartClick(object sender, EventArgs e)
        {
            _watch.Start();
            timer1.Enabled = true;
            if (string.IsNullOrEmpty(Globals.ActiveProject))
            {
                return;
            }
            //Check for unpause
            if (Globals.Pause)
            {
                Globals.Pause  = false;
                BtnStart.Text  = @"Start";
                LblStatus.Text = @"Working. . . ";// +uri.Split('|')[1];
                return;
            }

            _threads = new Thread[_currentProject.ThreadCount];
            //Log.AddToLog("Starting project: " + _currentProject.ProjectName, _currentProject.ProjectName);
            LblStatus.Text = @"Work Starting . . ";
            LstResults.Items.Clear();
            for (var l = 1; l <= _currentProject.LoopCount; l++)
            {
                foreach (var domain in _currentProject.Sites)
                {
                    foreach (var keyword in domain.Keywords)
                    {
                        foreach (var engine in _currentProject.Engines)
                        {
                            PrgMain.Maximum++;
                            ThreadPool.Enqueue(domain.Site + "|" + engine.Split('|')[1] + keyword + "+" + domain.Site + "|" + keyword + "|" + engine.Split('|')[0]);
                        }
                    }
                }
            }


            for (var i = 0; i < _currentProject.ThreadCount; i++)
            {
                _threads[i] = new Thread(ThreadFunc)
                {
                    IsBackground = true,
                };
                _threads[i].Start();
            }
            Log.Add2Log("Project started: " + _currentProject.ProjectName, _currentProject.ProjectName);

            LblStatus.Text = @"Working. . . ";// +uri.Split('|')[1];
        }