Exemplo n.º 1
0
        public frmMain(string msg)
        {
            goLike = new CGoLike();
            CGlobal._registerPresenter       = new CBqRegisterPresenter();
            CGlobal._session                 = new CSession();
            CGlobal._session.sessionTimeOut += new EventHandler(OnSessionTimeOut);
            CGlobal._session.sessionTrigger += new EventHandler(OnSessionTrigger);
            CEventLog.Log.EnableLog          = true;

            InitializeComponent();
            if (msg != "")
            {
                _msg      = msg;
                this.Text = "Không có INTERNET";
            }
        }
Exemplo n.º 2
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (btnRun.Text == "Làm việc")
            {
                CGlobal._pauseJob = false;
                btnRun.Text       = "Tạm ngưng";
            }
            else if (btnRun.Text == "Tạm ngưng")
            {
                CGlobal._pauseJob = true;
                btnRun.Text       = "Làm tiếp";
                UpdateProgress("Đợi điểm tạm ngưng");
                return;
            }
            else if (btnRun.Text == "Làm tiếp")
            {
                CGlobal._pauseJob = false;
                btnRun.Text       = "Tạm ngưng";
                UpdateProgress("");
                if (t1 != null)
                {
                    if (t1.Status == TaskStatus.Running)
                    {
                        return;
                    }
                }
            }
            if (txtUserName.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show(this, "Hãy kiểm tra lại Tên đăng nhập hoăc Mật khẩu.", "Web Auto - Sai dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (CGlobal.user == null)
            {
                CGlobal.user = new CUserAccount(txtUserName.Text, txtPassword.Text);
                CGlobal.user.EnableRedoJob = chkEnableRedo.Checked;
                CGlobal.user.JobLessMoney  = chkJobLessMoney.Checked;
            }
            try
            {
                CGlobal.user.GoLikeDelay1       = Int32.Parse(txtGolikeDelay1.Text);
                CGlobal.user.FBDelay1           = Int32.Parse(txtFBDelay1.Text);
                CGlobal.user.LimitFault         = Int32.Parse(txtFaultLimit.Text);
                CGlobal.user.EnableRedoJob      = chkEnableRedo.Checked;
                CGlobal.user.JobLessMoney       = chkJobLessMoney.Checked;
                CGlobal.user.CheckLinkCondition = chkLinkCondition.Checked;
            }
            catch (Exception ii)
            {
                MessageBox.Show(this, "Hãy kiểm tra lại giá trị nhập.", "Web Auto - Sai dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            foreach (DataGridViewRow r in gridUser.Rows)
            {
                if (r.Cells["colUser"].Value != null && r.Cells["colPass"].Value != null && r.Cells["colJobCount"].Value != null && r.Cells["colFaceCount"].Value != null)
                {
                    int job = 0;
                    if (r.Cells["colUser"].Value.ToString() == "-1" || r.Cells["colUser"].Value.ToString() == "" || r.Cells["colPass"].Value.ToString() == "" ||
                        Int32.TryParse(r.Cells["colJobCount"].Value.ToString(), out job) == false || Int32.TryParse(r.Cells["colFaceCount"].Value.ToString(), out job) == false ||
                        Int32.TryParse(r.Cells["colMaxGoLike"].Value.ToString(), out job) == false || Int32.TryParse(r.Cells["colMaxLink"].Value.ToString(), out job) == false)
                    {
                        MessageBox.Show(this, "Hay kiem tra lai tai khoan FB", "Web Auto - Sai du lieu", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                    if ((bool)(r.Cells["colEnable"].Value) == true)
                    {
                        CGlobal.user.ReadJobCount(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString());
                        CGlobal.user.ReadJobCountFB(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString());
                        if (r.Cells["colJobCount"].Value.ToString().Contains("/"))
                        {
                            r.Cells["colJobCount"].Value = CGlobal.user.ReadJobCount("facebook", r.Cells["colUser"].Value.ToString());
                        }
                        if (r.Cells["colFaceCount"].Value.ToString().Contains("/"))
                        {
                            r.Cells["colFaceCount"].Value = CGlobal.user.ReadJobCountFB("facebook", r.Cells["colUser"].Value.ToString());
                        }
                        if (CGlobal.user.addLinkAccount(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), r.Cells["colPass"].Value.ToString(), Int32.Parse(r.Cells["colJobCount"].Value.ToString()), Int32.Parse(r.Cells["colFaceCount"].Value.ToString()), (bool)(r.Cells["colEnable"].Value), Int32.Parse(r.Cells["colMaxGoLike"].Value.ToString()), Int32.Parse(r.Cells["colMaxLink"].Value.ToString())) == false)
                        {
                            CGlobal.user.ResetJobCount(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), Int32.Parse(r.Cells["colJobCount"].Value.ToString()));
                            CGlobal.user.ResetJobCountFB(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), Int32.Parse(r.Cells["colFaceCount"].Value.ToString()));
                            CGlobal.user.ResetJobEnable(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), true);
                        }
                    }
                    else
                    {
                        if (CGlobal.user.addLinkAccount(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), r.Cells["colPass"].Value.ToString(), Int32.Parse(r.Cells["colJobCount"].Value.ToString()), Int32.Parse(r.Cells["colFaceCount"].Value.ToString()), (bool)(r.Cells["colEnable"].Value), Int32.Parse(r.Cells["colMaxGoLike"].Value.ToString()), Int32.Parse(r.Cells["colMaxLink"].Value.ToString())) == false)
                        {
                            CGlobal.user.ResetJobEnable(r.Cells["colAccount"].Value.ToString(), r.Cells["colUser"].Value.ToString(), false);
                        }
                    }
                }
            }

            Action <object> action = (object obj) =>
            {
                this.Invoke((MethodInvoker) delegate
                {
                    //btnRun.Enabled = false;
                    btnLoad.Enabled             = false;
                    btnSave.Enabled             = false;
                    btnNew.Enabled              = false;
                    btnLikeArticle.Enabled      = false;
                    btnLikeFanPage.Enabled      = false;
                    chkEnableRedo.Enabled       = false;
                    chkJobLessMoney.Enabled     = false;
                    btnFollow.Enabled           = false;
                    chkInvisibleBrowser.Enabled = false;
                    gridUser.Enabled            = false;
                    timeCountDown = 0;
                    timer1.Start();
                    startDoJob       = true;
                    lblProgress.Text = "Go ...";
                });
                test = new bqChromeService();

                test.Initialize();

                test.Start(chkInvisibleBrowser.Checked);
                while (true)

                {
                    bool finish = true;
                    foreach (string id in CGlobal.user.linkAccount.Keys)
                    {
                        if (CGlobal.user.LimitFault <= 0)
                        {
                            int limit = 0;
                            if (Int32.TryParse(txtFaultLimit.Text, out limit))
                            {
                                CGlobal.user.LimitFault = limit;
                            }
                            else
                            {
                                MessageBox.Show("Xem lại giá trị Chuyển TK sau số lần thất bại.");
                                finish = true;
                                break;
                            }
                        }
                        //if (CGlobal.user.linkAccount[id].EnableJob == false)
                        //    continue;
                        if (CGlobal.user.linkAccount[id].EnableJob == false && CGlobal.user.EnableRedoJob == false)
                        {
                            continue;
                        }
                        else if (CGlobal.user.linkAccount[id].EnableJob == false && CGlobal.user.EnableRedoJob == true)
                        {
                            startDoJob = false;
                        }
                        if (CGlobal.user.CheckLinkCondition)
                        {
                            if (CGlobal.user.linkAccount[id].JobCountUp >= CGlobal.user.linkAccount[id].JobCount ||
                                CGlobal.user.linkAccount[id].JobCountUpFB >= CGlobal.user.linkAccount[id].JobCountFB)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            if (CGlobal.user.linkAccount[id].JobCountUp >= CGlobal.user.linkAccount[id].JobCount /*||
                                                                                                                  * CGlobal.user.linkAccount[id].JobCountUpFB >= CGlobal.user.linkAccount[id].JobCountFB*/)
                            {
                                continue;
                            }
                        }

                        while (CGlobal._pauseJob)
                        {
                            UpdateProgress("Tạm ngưng ..");
                            System.Threading.Thread.Sleep(550);
                            UpdateProgress("Tạm ngưng .....");
                        }


                        //test.GotoURL("https://app.golike.net");
                        if (CGlobal.user.linkAccount[id].Type == "Facebook")
                        {
                            goLike = new CGoLike();
                        }
                        else if (CGlobal.user.linkAccount[id].Type == "Instagram")
                        {
                            goLike = new CGoLikeInst();
                        }

                        goLike.LinkAccount = CGlobal.user.linkAccount[id];
                        goLike.UpdateGUI   = this;

                        goLike.DoJob(test);

                        //goLike.DoJobTest(test);

                        if (CGlobal.user.CheckLinkCondition)
                        {
                            if (CGlobal.user.linkAccount[id].JobCountUpMax >= CGlobal.user.linkAccount[id].JobCountMax)
                            {
                                CGlobal.user.linkAccount[id].JobCountUpMax = 0;
                            }
                            if (CGlobal.user.linkAccount[id].JobCountUpFBMax >= CGlobal.user.linkAccount[id].JobCountFBMax)
                            {
                                CGlobal.user.linkAccount[id].JobCountUpFBMax = 0;
                            }
                            if (CGlobal.user.linkAccount[id].JobCountUp < CGlobal.user.linkAccount[id].JobCount ||
                                CGlobal.user.linkAccount[id].JobCountUpFB < CGlobal.user.linkAccount[id].JobCountFB)
                            {
                                finish = false;
                            }
                        }
                        else
                        {
                            if (CGlobal.user.linkAccount[id].JobCountUpMax >= CGlobal.user.linkAccount[id].JobCountMax)
                            {
                                CGlobal.user.linkAccount[id].JobCountUpMax = 0;
                            }
                            if (CGlobal.user.linkAccount[id].JobCountUp < CGlobal.user.linkAccount[id].JobCount /*||
                                                                                                                 * CGlobal.user.linkAccount[id].JobCountUpFB < CGlobal.user.linkAccount[id].JobCountFB*/)
                            {
                                finish = false;
                            }
                        }

                        UpdateProgress("Waiting next account...");
                        UpdateAccount("Timer", "9000");
                        System.Threading.Thread.Sleep(9000);


                        if (startDoJob == false)
                        {
                            break;
                        }
                    }
                    if (finish || startDoJob == false)
                    {
                        break;
                    }
                }

                test.Quit();

                this.Invoke((MethodInvoker) delegate
                {
                    //btnRun.Enabled = true;
                    btnRun.Text                 = "Làm việc";
                    btnLoad.Enabled             = true;
                    btnSave.Enabled             = true;
                    btnNew.Enabled              = true;
                    btnLikeArticle.Enabled      = true;
                    btnLikeFanPage.Enabled      = true;
                    chkEnableRedo.Enabled       = true;
                    chkJobLessMoney.Enabled     = true;
                    btnFollow.Enabled           = true;
                    chkInvisibleBrowser.Enabled = true;
                    gridUser.Enabled            = true;
                    timeCountDown               = 0;
                    lblCountDown.Text           = "0";
                    timer1.Stop();
                    startDoJob = false;
                });
            };

            t1 = new Task(action, "jobQB#1");
            t1.Start();
        }