Exemplo n.º 1
0
 private void btnaddcookie_Click(object sender, EventArgs e)
 {
     cbbtypelogin.SelectedIndex   = 0;
     AppExtension.DieCookieCount  = 0;
     AppExtension.LiveCookieCount = 0;
     AppExtension.AddCookie(dtgrvdata);
     lbtotaldata.Text = dtgrvdata.Rows.Count.ToString();
     //AppExtension.CheckListCookie(dtgrvdata);
     //lbdie.Text = AppExtension.DieCookieCount.ToString();
     //lblive.Text = AppExtension.LiveCookieCount.ToString();
 }
Exemplo n.º 2
0
 private void btnstop_Click(object sender, EventArgs e)
 {
     try
     {
         AppExtension.Writelog("hãy chờ 1 chút để toàn bộ các luồng kết thúc !", txtlog, 201);
         Isstop = true;
         _isrun = false;
         AppExtension.isstop = true;
         //btnstart.Invoke((MethodInvoker)delegate ()
         //{
         //    btnstart.Enabled = true;
         //    btnstop.Enabled = false;
         //});
     }
     catch { }
 }
Exemplo n.º 3
0
 private void btnadd_data_Click(object sender, EventArgs e)
 {
     cbbtypelogin.SelectedIndex = 1;
     AppExtension.AddCookie(dtgrvdata);
 }
Exemplo n.º 4
0
 private void checkLiveListCookieToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AppExtension.CheckListCookie(dtgrvdata);
     lbdie.Text  = AppExtension.DieCookieCount.ToString();
     lblive.Text = AppExtension.LiveCookieCount.ToString();
 }
Exemplo n.º 5
0
        private void StartRun(int row)
        {
            //string cookie = "";
            FacebookStatics facebookStatics = new FacebookStatics();

            string[]    arraydataAccount = null;
            YolikerLogs yolikerLogs      = new YolikerLogs()
            {
                dtgrvdata = dtgrvdata,
                row       = row
            };
            Session session = new Session();

            try
            {
START_RUN:
                if (Isstop == true)
                {
                    yolikerLogs.Write("đã dừng chương trình !", YolikerLogs.TypeLog.NORMAL);
                    return;
                }
                string data_ = dtgrvdata.Rows[row].Cells["cldata"].Value.ToString();
                string uid   = GetUID(data_);
                if (!ListFbDie.Contains(uid))
                {
                    if (ListFbLoged.ContainsKey(uid))
                    {
                        facebookStatics.IssCookie    = true;
                        facebookStatics.cookie       = ListFbLoged[uid];
                        facebookStatics.access_token = ListFbTokens[uid];
                    }
                    else
                    {
                        if (typeLogin_ == TypeLogin.COOKIE)
                        {
                            facebookStatics.IssCookie = true;
                            facebookStatics.cookie    = data_;
                        }
                        else
                        {
                            arraydataAccount          = data_.Split('|');
                            facebookStatics.IssCookie = false;
                            facebookStatics.uid       = uid;
                            facebookStatics.pass      = arraydataAccount[1];
                            if (arraydataAccount.Count() >= 3)
                            {
                                facebookStatics.tfa = arraydataAccount[2];
                            }
                        }
                    }
                    if (ListFbTokens.ContainsKey(uid))
                    {
                        //session = new Session();
                        //session.CreateSession();
                        goto strunn;
                    }
                    yolikerLogs.Write("đang login facebook...", YolikerLogs.TypeLog.NORMAL);
                    FacebookLogin login = new FacebookLogin(facebookStatics);
                    FacebookStatics.LoginStatus loginStatus = login.Login();
                    session = login.FacebookSession;
                    if (loginStatus != FacebookStatics.LoginStatus.SUCCESS)
                    {
                        yolikerLogs.Write(ErrorTypeHelper.GetDescriptionFacebookState(loginStatus), YolikerLogs.TypeLog.WARNING);
                        ListFbDie.Add(uid);
                        return;
                    }
                    strunn :;
                    if (!ListFbLoged.ContainsKey(uid))
                    {
                        ListFbLoged.Add(uid, facebookStatics.cookie);
                    }
                    if (!ListFbTokens.ContainsKey(uid))
                    {
                        ListFbTokens.Add(uid, facebookStatics.access_token);
                    }
                    CaptchaStatics.CaptchaService capService = (CaptchaStatics.CaptchaService)Enum.ToObject(typeof(CaptchaStatics.CaptchaService), cbbCapchaType.SelectedIndex);
                    CaptchaStatics captchaStatics            = new CaptchaStatics()
                    {
                        Apikey = txtapikey.Text,
                        Url    = YolikerStatics.LikeCustomUri
                    };
                    YolikerStatics yolikerStatics = new YolikerStatics()
                    {
                        captchaSvName = capService,
                        IdPost        = txtpostid.Text,
                        TypeAction    = GetAction()
                    };
                    Actions actions = new Actions()
                    {
                        statics        = facebookStatics,
                        fbSession      = session,
                        captchaSt      = captchaStatics,
                        yolikerStatics = yolikerStatics,
                        Logs           = yolikerLogs
                    };
                    yolikerLogs.Write("đang login yoliker...", YolikerLogs.TypeLog.NORMAL);
                    YolikerStatics.YolikerState yolikerState = actions.LoginYoliker();
                    if (yolikerState == YolikerStatics.YolikerState.SUCCESS)
                    {
                        yolikerState = actions.StartAction();
                        //session.Dispose();
                        //facebookStatics.dispose();
                        if (yolikerState == YolikerStatics.YolikerState.SUCCESS)
                        {
                            //yolikerLogs.Write("Tăng " + yolikerStatics.TypeAction + " thành công! + " + yolikerStatics.NumLikeDelivered.ToString() + " " + yolikerStatics.TypeAction, YolikerLogs.TypeLog.NORMAL);
                            AppExtension.Writelog("Tăng " + yolikerStatics.TypeAction + " thành công! + " + actions.NumLikeDelivered.ToString() + " " + yolikerStatics.TypeAction, txtlog, row);
                            totalLikeRec_   += actions.NumLikeDelivered;
                            lbtotallike.Text = totalLikeRec_.ToString();
                            if (chkautostop.Checked)
                            {
                                if (totalLikeRec_ >= Convert.ToInt32(numLike.Value))
                                {
                                    AppExtension.Writelog("Thread " + row.ToString() + " đã đủ số like theo yêu cầu !!! " + numLike.Value.ToString() + " LIKE", txtlog, row);
                                    yolikerLogs.Write("đã đủ số like --> tự động dừng tool !", YolikerLogs.TypeLog.NORMAL);
                                    Isstop = true;
                                    AppExtension.isstop = true;
                                    _isrun = false;
                                }
                            }
                            new Thread(() =>
                            {
                                checkapi();
                            }).Start();
                        }
                    }
                    else
                    {
                        yolikerLogs.Write(ErrorTypeHelper.GetDescriptionYolikerState(yolikerState), YolikerLogs.TypeLog.WARNING);
                    }
                    for (int i = 1; i < 16; i++)
                    {
                        if (Isstop == true)
                        {
                            yolikerLogs.Write("đã dừng chương trình !", YolikerLogs.TypeLog.NORMAL);
                            return;
                        }
                        yolikerLogs.Write("đang nghỉ " + i.ToString() + " phút / 16 phút", YolikerLogs.TypeLog.NORMAL);
                        Thread.Sleep(TimeSpan.FromMinutes(1));
                    }
                    goto START_RUN;
                }
                {
                    yolikerLogs.Write("fb này đã die !", YolikerLogs.TypeLog.WARNING);
                    return;
                }
            }
            catch (Exception ex)
            {
                File.AppendAllText("ErrorLog.txt", ex.ToString() + "\r\n");
            }
            finally
            {
                session.Dispose();
                facebookStatics.dispose();
                AppExtension.Writelog("Thread " + row.ToString() + " đã xong !!! ", txtlog, row);
            }
        }
Exemplo n.º 6
0
        private void ApplicationStart()
        {
            int maxThread     = Convert.ToInt32(numthread.Value);
            int curThread     = 0;
            int changeIpAfter = Convert.ToInt32(1);
            int curChangeIp   = 0;

            Isstop = false;
            _isrun = true;
            bool isDoneAll = true;

            btnstart.Enabled = false;
            btnstop.Enabled  = true;
            new Thread(() =>
            {
                int i = 0;
                while (i < dtgrvdata.Rows.Count - 1)
                {
                    while (isDoneAll == false)
                    {
                        Application.DoEvents();
                        Thread.Sleep(1000);
                        if (curThread <= 0)
                        {
                            Interlocked.Increment(ref curChangeIp);
                            if (curChangeIp >= changeIpAfter)
                            {
                                curChangeIp = 0;
                            }
                            isDoneAll = true;
                            Thread.Sleep(TimeSpan.FromSeconds(1));
                        }
                    }
                    if (curThread < maxThread)
                    {
                        if (Isstop)
                        {
                            break;
                        }
                        Interlocked.Increment(ref curThread);
                        int row = i;
                        new Thread(() =>
                        {
                            StartRun(row);
                            Interlocked.Decrement(ref curThread);
                        }).Start();
                        i += 1;
                    }
                    else
                    {
                        isDoneAll = false;
                        Thread.Sleep(1000);
                    }
                    if (Isstop)
                    {
                        break;
                    }
                }
                while (curThread > 0)
                {
                    Thread.Sleep(500);
                    Application.DoEvents();
                }
                btnstart.Invoke((MethodInvoker) delegate()
                {
                    AppExtension.Writelog("Toàn bộ luồng chạy đã kết thúc !", txtlog, 201);
                    btnstart.Enabled = true;
                    btnstop.Enabled  = false;
                    _isrun           = false;
                });
            }).Start();
        }