예제 #1
0
        private void NuoiNick(int rowIndex)
        {
            Task t = new Task(() =>
            {
                if (!TaoChrome(rowIndex))
                {
                    return;
                }
                var facebook = new FaceBook(dgvAccounts, rowIndex, chromeDriver[rowIndex]);
                var rsLogin  = facebook.DangNhap();
                if (!rsLogin.rs)
                {
                    dgvAccounts["status", rowIndex].Value = "Đăng nhập thất bại";
                    return;
                }
                dgvAccounts["status", rowIndex].Value = "Đi tương tác";

                for (int i = 0; i < Convert.ToInt32(numberAction.Text); i++)
                {
                    CheckStopAppAuto(rowIndex);
                    facebook.TrithongMinh(1, chromeDriver[rowIndex]);
                    dgvAccounts["status", rowIndex].Value = $"Xong tương tác số {i + 1}";
                    ChoClickButtonFB(rowIndex, $"thao tác  {i + 2}");
                }
            });

            t.Start();
        }
예제 #2
0
        private void RunMenu(ActionMenu actionMenu, int rowIndex)
        {
            Task t = new Task(() =>
            {
                if (!TaoChrome(rowIndex))
                {
                    return;
                }
                var facebook = new FaceBook(dgvAccounts, rowIndex, chromeDriver[rowIndex]);
                if (actionMenu == ActionMenu.OpenChrome)
                {
                    return;
                }
                else
                {
                    var rsLogin = facebook.DangNhap();
                    if (!rsLogin.rs)
                    {
                        return;
                    }
                    switch (actionMenu)
                    {
                    case ActionMenu.OpenFacebook:
                        break;

                    case ActionMenu.BackUpFacebookOnlyImageFriend:
                        facebook.BackUpFacebookOnlyImageFriend(chromeDriver[rowIndex], rowIndex);
                        break;

                    case ActionMenu.BackUpFacebookAll:
                        facebook.BackUpFacebookAll(chromeDriver[rowIndex], rowIndex);
                        break;

                    case ActionMenu.ChayDangKiHana:
                        break;

                    case ActionMenu.QuetThanhVienGroup:
                        facebook.QuetThanhVienGroup(chromeDriver[rowIndex], rowIndex);
                        break;

                    case ActionMenu.CommentGroup:
                        break;
                    }
                }
            });

            t.Start();
        }
예제 #3
0
        private void CommentGroup(int rowIndex)
        {
            Task t = new Task(() =>
            {
                ChromeDriverService chromeDriverService = ChromeDriverService.CreateDefaultService();
                ChromeOptions chromeOptions             = new ChromeOptions();
                var chrome = new Chrome(dgvAccounts, rowIndex, chromeDriverService, chromeOptions);
                if (chrome.SetUpChrome((bool)this.checkLoadImage.Checked, ref chromeDriver[rowIndex]))
                {
                    return;
                }
                FaceBook facebook = new FaceBook(dgvAccounts, rowIndex, chromeDriver[rowIndex]);
                var rsLogin       = facebook.DangNhap();
                if (rsLogin.rs == false)
                {
                    return;
                }
                facebook.MActionJobComment(chromeDriver[rowIndex]);
            });

            t.Start();
        }
예제 #4
0
        private void ChayDangKiHana(int rowIndex)
        {
            Task t = new Task(() =>
            {
                ChromeDriverService chromeDriverService = ChromeDriverService.CreateDefaultService();
                ChromeOptions chromeOptions             = new ChromeOptions();
                var chrome = new Chrome(dgvAccounts, rowIndex, chromeDriverService, chromeOptions);
                if (chrome.SetUpChrome((bool)this.checkLoadImage.Checked, ref chromeDriver[rowIndex]))
                {
                    return;
                }

                FaceBook facebook = new FaceBook(dgvAccounts, rowIndex, chromeDriver[rowIndex]);
                var rsLogin       = facebook.DangNhap();
                if (rsLogin.rs == false)
                {
                    return;
                }

                // mả tab 2 Hana
                Actions actionProvider = new Actions(chromeDriver[rowIndex]);
                ((IJavaScriptExecutor)chromeDriver[rowIndex]).ExecuteScript("window.open();");
                string originalWindow = chromeDriver[rowIndex].CurrentWindowHandle;
                chromeDriver[rowIndex].SwitchTo().Window(chromeDriver[rowIndex].WindowHandles.Last());

                // nếu login được thì làm tiếp
                if (this.dgvAccounts.Rows[rowIndex].Cells["hana"].Value.ToString() != null && this.dgvAccounts.Rows[rowIndex].Cells["passhana"].Value.ToString() != null)
                {
                    Hana hana = new Hana(this.dgvAccounts.Rows[rowIndex].Cells["hana"].Value.ToString(),
                                         this.dgvAccounts.Rows[rowIndex].Cells["passhana"].Value.ToString(), dgvAccounts, rowIndex);
                    string token = hana.LoginHana(chromeDriver[rowIndex]);
                    if (token != null)
                    {
                        dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Đăng nhập Hana thành công, bắt đầu thêm tài khoản";
                        // lấy Keyhana
                        var codeHana = hana.LayKeyThemTaiKhoanHana(chromeDriver[rowIndex]);
                        if (codeHana != null)
                        {
                            // đăng bài code hana lên fb
                            chromeDriver[rowIndex].SwitchTo().Window(chromeDriver[rowIndex].WindowHandles.First());
                            //var urlbaiviet = facebook.ActionDangBai(chromeDriver[rowIndex], codeHana);
                            var urlbaiviet = "";
                            if (urlbaiviet != null)
                            {
                                chromeDriver[rowIndex].SwitchTo().Window(chromeDriver[rowIndex].WindowHandles.Last());
                                // thêm vào hana
                                //hana.NhapMaBaiFBChuaCodeHana(chromeDriver[rowIndex], urlbaiviet);
                                return;
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                    else
                    {
                        dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Đăng nhập Hana thất bại";
                        dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                        chromeDriver[rowIndex].Quit();
                        return;
                    }
                }
            });

            t.Start();
            Common.DelayMiliSeconde(1000);
        }
예제 #5
0
        private void ChayJobHana(int rowIndex)
        {
            Task t = new Task(() =>
            {
                ChromeDriverService chromeDriverService = ChromeDriverService.CreateDefaultService();
                ChromeOptions chromeOptions             = new ChromeOptions();
                var chrome = new Chrome(dgvAccounts, rowIndex, chromeDriverService, chromeOptions);
                if (chrome.SetUpChrome((bool)this.checkLoadImage.Checked, ref chromeDriver[rowIndex]))
                {
                    return;
                }

                FaceBook facebook = new FaceBook(dgvAccounts, rowIndex, chromeDriver[rowIndex]);
                var rsLogin       = facebook.DangNhap();
                if (rsLogin.rs == false)
                {
                    return;
                }

                // nếu login fb được thì làm tiếp
                if (this.dgvAccounts.Rows[rowIndex].Cells["hana"].Value.ToString() != null && this.dgvAccounts.Rows[rowIndex].Cells["passhana"].Value.ToString() != null && (bool)this.dgvAccounts.Rows[rowIndex].Cells["runhana"].Value)
                {
                    Hana hana = new Hana(this.dgvAccounts.Rows[rowIndex].Cells["hana"].Value.ToString(),
                                         this.dgvAccounts.Rows[rowIndex].Cells["passhana"].Value.ToString(), dgvAccounts, rowIndex);
                    string token = hana.LoginHana(chromeDriver[rowIndex]);
                    if (token != null)
                    {
                        #region chọn tài khoản làm việc
                        if (!hana.SelectAccountLeanJob(chromeDriver[rowIndex], dgvAccounts.Rows[rowIndex].Cells["name"].Value.ToString()))
                        {
                            return;
                        }
                        #endregion

                        while (true)
                        {
                            CheckStopAppAuto(rowIndex); // kiểm tra tạm dừng

                            dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Đi lấy Job Hana";
                            bool takeJob = hana.LayMotJobAndClick(chromeDriver[rowIndex], ref _soCapchaDagiai, ref _soCapchaDagiaiKhongthanh);
                            if (takeJob)
                            {
                                var rsLamJob = facebook.LamJob(chromeDriver[rowIndex], ref _soTienDalam, ref _solanKhonggiaiduocTien);

                                if (rsLamJob.isError5Finish == true)
                                {
                                    dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Hoàn thành Job lỗi liên tục 5 lần";
                                    dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                                    chromeDriver[rowIndex].Quit();
                                    return;
                                }
                                else if (rsLamJob.isBlockaction == true)
                                {
                                    dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Tài khoản bị chặn tương tác";
                                    dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                                    chromeDriver[rowIndex].Quit();
                                    return;
                                }
                                else if (rsLamJob.isCheckpoint == true)
                                {
                                    dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Tài khoản bị checkpoint";
                                    dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                                    chromeDriver[rowIndex].Quit();
                                    return;
                                }
                                else if (rsLamJob.isFinishTotalJob == true || (int)dgvAccounts.Rows[rowIndex].Cells["total"].Value >= ljobMaxOfDay)
                                {
                                    dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Hoàn thành tối đa lượng job 1 ngày";
                                    dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                                    chromeDriver[rowIndex].Quit();
                                    return;
                                }
                            }
                            else
                            {
                                dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                                chromeDriver[rowIndex].Quit();
                                return;
                            }
                        }
                    }
                    else
                    {
                        dgvAccounts.Rows[rowIndex].Cells["status"].Value = "Đăng nhập Hana thất bại";
                        dgvAccounts.Rows[rowIndex].Cells["Action"].Value = "Bắt đầu";
                        chromeDriver[rowIndex].Quit();
                        return;
                    }
                }
            });

            t.Start();
            Common.DelayMiliSeconde(1000);
        }