Ejemplo n.º 1
0
 private void loginB_Click(object sender, EventArgs e)
 {
     Login login = new Login(this);
     Thread t = new Thread(login.loginT);
     t.Start();
 }
Ejemplo n.º 2
0
        public void startProbe()
        {
            if (form1.urlList.InvokeRequired)
            {
                delegate2 sl = new delegate2(delegate()
                {
                    form1.deleteB.Enabled = false;
                });
                form1.urlList.Invoke(sl);
            }
            else
            {
                form1.deleteB.Enabled = false;
            }

            if (form1.urlList.Items.Count == 0)
            {
                form1.setLogT("empty user list! please import a userID file");
                if (form1.urlList.InvokeRequired)
                {
                    delegate2 sl = new delegate2(delegate()
                    {
                        form1.deleteB.Enabled = true;
                    });
                    form1.urlList.Invoke(sl);
                }
                else
                {
                    form1.deleteB.Enabled = true;
                }
                Form1.gForceToStop = false;
                return;
            }
            Login login = new Login(form1) { };

            if (!Form1.gLoginOkFlag)
            {
                login.loginT();
                if (!Form1.gLoginOkFlag)
                {
                    if (form1.urlList.InvokeRequired)
                    {
                        delegate2 sl = new delegate2(delegate()
                        {
                            form1.deleteB.Enabled = true;
                        });
                        form1.urlList.Invoke(sl);
                    }
                    else
                    {
                        form1.deleteB.Enabled = true;
                    }
                    Form1.gForceToStop = false;
                    return;
                }
            }

            form1.setLogT("开始扫描..");
            while (true)
            {
                for (int i = 0; i < form1.urlList.Items.Count; i++)
                {
                    int r1 = 0;
                    while ((r1 = this.probe(form1.urlList.GetItemText(form1.urlList.Items[i]))) == -1)
                    {
                        Form1.gLoginOkFlag = false;
                        login.loginT();
                        if (!Form1.gLoginOkFlag)
                        {
                            if (form1.urlList.InvokeRequired)
                            {
                                delegate2 sl = new delegate2(delegate()
                                {
                                    form1.deleteB.Enabled = true;
                                });
                                form1.urlList.Invoke(sl);
                            }
                            else
                            {
                                form1.deleteB.Enabled = true;
                            }
                            Form1.gForceToStop = false;
                            return;
                        }
                    }
                    if (form1.urlList.InvokeRequired)
                    {
                        delegate2 sl = new delegate2(delegate()
                        {
                            if (r1 == -2)
                            {
                                //red daiyyr
                                failed++;
                            }
                            else
                            {
                                form1.urlList.SetItemChecked(i, true);
                                succeed++;
                                form1.setLogT(" got from " + form1.urlList.GetItemText(form1.urlList.Items[i]) + ": " + successInOneProbe);
                                SUMsuccessInOneProbe += successInOneProbe;
                                successInOneProbe = 0;
                            }
                        });
                        form1.urlList.Invoke(sl);
                    }
                    else
                    {
                        if (r1 == -2)
                        {
                            //red
                            failed++;
                        }
                        else
                        {
                            form1.urlList.SetItemChecked(i, true);
                            succeed++;
                        }
                    }

                    if (form1.rate.Text.Equals(""))
                    {
                        Thread.Sleep(100);
                    }
                    else if (Convert.ToInt32(form1.rate.Text) > 0)
                    {
                        Thread.Sleep(Convert.ToInt32(form1.rate.Text));
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                    if (Form1.gForceToStop)
                    {
                        break;
                    }
                }//end of 'for' for checklistbox
                break;//just proce once.
            }
            form1.setLogT( "列表扫描结束,成功列表项: " + succeed + ", 失败列表项: " + failed + ", 共收集好友: " + SUMsuccessInOneProbe);
            succeed = 0;
            failed = 0;
            SUMsuccessInOneProbe = 0;
            if (gFileName != null)
            {
                form1.setLogT("Result in " + System.Environment.CurrentDirectory + "\\" + gFileName);

            }
            gFriends.Clear();
            if (form1.urlList.InvokeRequired)
            {
                delegate2 sl = new delegate2(delegate()
                {
                    form1.deleteB.Enabled = true;
                });
                form1.urlList.Invoke(sl);
            }
            else
            {
                form1.deleteB.Enabled = true;
            }
            Form1.gForceToStop = false;
            return;
        }