Esempio n. 1
0
 public void GetAllMyFriends()
 {
     base.Proxy = ConfigCtrl.GetProxy();
     base.Delay = ConfigCtrl.GetDelay();
     base.Initial();
     base.GetAllMyFriendsByThread();
 }
Esempio n. 2
0
        public WhiteBlackCore(string groupname, AccountInfo account)
        {
            base.Caption        = account.UserName;
            base.Key            = account.Email;
            base.CurrentAccount = account;
            base.Proxy          = ConfigCtrl.GetProxy();
            base.Delay          = ConfigCtrl.GetDelay();
            base.Initial();

            Operation = ConfigCtrl.GetOperation(groupname, account);
            Task      = ConfigCtrl.GetTask("", "", true);

            _gPark   = new GamePark();
            _gBite   = new GameBite();
            _gSlave  = new GameSlave();
            _gHouse  = new GameHouse();
            _gGarden = new GameGarden();
            _gRanch  = new GameRanch();
            _gFish   = new GameFish();
            _gCafe   = new GameCafe();
            //不要clone validatecode 事件
            _gPark.Clone(this, true);
            _gBite.Clone(this, true);
            _gSlave.Clone(this, true);
            _gHouse.Clone(this, true);
            _gGarden.Clone(this, true);
            _gRanch.Clone(this, true);
            _gFish.Clone(this, true);
            _gCafe.Clone(this, true);
        }
Esempio n. 3
0
 public ToolUpgradeGarage()
 {
     base.Caption = Constants.TOOL_UPGRADEGARAGE;
     base.Key     = Constants.TOOL_UPGRADEGARAGE;
     base.Proxy   = ConfigCtrl.GetProxy();
     base.Delay   = ConfigCtrl.GetDelay();
     base.Initial();
 }
Esempio n. 4
0
 public ToolMaintainContact()
 {
     base.Caption = Constants.TOOL_MAINTAINCONTACT;
     base.Key     = Constants.TOOL_MAINTAINCONTACT;
     base.Proxy   = ConfigCtrl.GetProxy();
     base.Delay   = ConfigCtrl.GetDelay();
     base.Initial();
 }
Esempio n. 5
0
 public ToolUpdateData()
 {
     base.Caption = Constants.TOOL_UPDATEDATA;
     base.Key     = Constants.TOOL_UPDATEDATA;
     base.Proxy   = ConfigCtrl.GetProxy();
     base.Delay   = ConfigCtrl.GetDelay();
     base.Initial();
 }
Esempio n. 6
0
 public ToolBuyCards()
 {
     base.Caption = Constants.TOOL_BUYCARDS;
     base.Key     = Constants.TOOL_BUYCARDS;
     base.Proxy   = ConfigCtrl.GetProxy();
     base.Delay   = ConfigCtrl.GetDelay();
     base.Initial();
 }
Esempio n. 7
0
 public ToolBuildTeam(AccountInfo account)
 {
     base.Caption        = Constants.TOOL_BUILDTEAM;
     base.Key            = Constants.TOOL_BUILDTEAM;
     base.CurrentAccount = account;
     base.Proxy          = ConfigCtrl.GetProxy();
     base.Delay          = ConfigCtrl.GetDelay();
     base.Initial();
 }
Esempio n. 8
0
        public void AddFriends(AddFriendsInfo addfriends)
        {
            base.Proxy = ConfigCtrl.GetProxy();
            base.Delay = ConfigCtrl.GetDelay();
            base.Initial();

            this._addFriends = addfriends;

            _threadMain = new Thread(new System.Threading.ThreadStart(RunAddFriend));
            _threadMain.IsBackground = true;
            _threadMain.Start();
        }
Esempio n. 9
0
        private void DlgDelaySetting_Load(object sender, EventArgs e)
        {
            try
            {
                //load config info
                DelayInfo delay = ConfigCtrl.GetDelay();
                if (delay != null)
                {
                    txtDelayedTime.Text = delay.DelayedTime.ToString();
                    txtTimeOut.Text     = delay.TimeOut.ToString();
                    txtTryTimes.Text    = delay.TryTimes.ToString();
                }

                txtDelayedTime.Select();
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("DlgDelaySetting", ex);
                this.Close();
            }
        }
Esempio n. 10
0
        public void TaskRun()
        {
            try
            {
                //重新读取
                Task = ConfigCtrl.GetTask(_taskid, _taskname, false);

                base.ExecutionLog = new StringBuilder();
                base.Proxy        = ConfigCtrl.GetProxy();
                base.Delay        = ConfigCtrl.GetDelay();

                if (Task.RunMode != EnumRunMode.SingleLoop || _singleloopfirst == true)
                {
                    base.Initial(true);
                }
                else
                {
                    base.Initial(false);
                }

                if (Task.ExecutePark)
                {
                    this._matchList = ConfigCtrl.GetMatches();
                }
                if (Task.ExecuteHouse)
                {
                    this._houseFullList.Clear();
                }
                if (Task.ExecuteGarden)
                {
                    this._hasNothingTobeFarmedList.Clear();
                    this._seedsList     = ConfigCtrl.GetSeedsInShop();
                    this._rankSeedsList = ConfigCtrl.GetRankSeeds();
                    this._fruitsList    = ConfigCtrl.GetFruits();
                }
                if (Task.ExecuteRanch)
                {
                    this._hasNothingTobeHelpedList.Clear();
                    this._calfsList    = ConfigCtrl.GetCalvesInShop();
                    this._productsList = ConfigCtrl.GetAnimalProducts();
                }
                if (Task.ExecuteFish)
                {
                    this._fishFrysList    = ConfigCtrl.GetFishFrysInShop();
                    this._fishTacklesList = ConfigCtrl.GetFishTacklesInShop();
                    this._fishMaturedList = ConfigCtrl.GetFishMaturedInMarket();
                }
                if (Task.ExecuteRich)
                {
                    this._assetsList           = ConfigCtrl.GetAssetsInShop();
                    this._advancedPurchaseList = ConfigCtrl.GetAdvancedPurchaseMD();
                }
                if (Task.ExecuteCafe)
                {
                    this._dishesList             = ConfigCtrl.GetDishesInMenu();
                    this._transactiondDishesList = ConfigCtrl.GetTransactionDishes();
                }

                SetMessage(Constants.COMMAND_CLEARLOG);
                //start
                SetMessage("\r\n" + "============================== 开始 ==============================");

                int num = 0;
                foreach (AccountInfo account in Task.Accounts)
                {
                    try
                    {
                        Thread.Sleep(2000);
                        //common
                        base.AllMyFriendsList.Clear();
                        //this._verifyCode = "";
                        this._module = Constants.MSG_TASK;

                        num++;
                        SetMessageLn("------ 共" + Task.Accounts.Count + "个帐户,第" + num + "个帐户:" + account.UserName + "(" + account.Email + ") ------");
                        base.Operation      = ConfigCtrl.GetOperation(Task.GroupName, account);
                        base.CurrentAccount = account;

                        if (Task.RunMode != EnumRunMode.SingleLoop || _singleloopfirst == true)
                        {
                            if (!this.ValidationLogin(account))
                            {
                                continue;
                            }
                            else
                            {
                                _singleloopfirst = false;
                            }
                        }
                        //if (!this.Login(true))
                        //{
                        //    if (base.NeedValidationCode)
                        //    {
                        //        while (base.RetryLogin)
                        //        {
                        //            if (!this.Login(true))
                        //                continue;
                        //            else
                        //                break;
                        //        }
                        //        if (!base.RetryLogin)
                        //            continue;
                        //    }
                        //    else
                        //        continue;
                        //}

                        string content = RequestAllMyFriends();
                        ReadAllMyFriends(content, false);

                        if (Task.ExecutePark)
                        {
                            GamePark gPark = new GamePark();
                            gPark.Clone(this);
                            gPark.MatchesList = this._matchList;
                            gPark.RunPark();
                            this.ExecutionLog = gPark.ExecutionLog;
                        }
                        if (Task.ExecuteBite)
                        {
                            GameBite gBite = new GameBite();
                            gBite.Clone(this);
                            gBite.RunBite();
                            this.ExecutionLog = gBite.ExecutionLog;
                        }
                        if (Task.ExecuteSlave)
                        {
                            GameSlave gSlave = new GameSlave();
                            gSlave.Clone(this);
                            gSlave.RunSlave();
                            this.ExecutionLog = gSlave.ExecutionLog;
                        }
                        if (Task.ExecuteHouse)
                        {
                            GameHouse gHouse = new GameHouse();
                            gHouse.Clone(this);
                            gHouse.HouseFullList = this._houseFullList;
                            gHouse.RunHouse();
                            this.ExecutionLog   = gHouse.ExecutionLog;
                            this._houseFullList = gHouse.HouseFullList;
                        }
                        if (Task.ExecuteGarden)
                        {
                            GameGarden gGarden = new GameGarden();
                            gGarden.Clone(this);
                            gGarden.SeedsList                = this._seedsList;
                            gGarden.RankSeedsList            = this._rankSeedsList;
                            gGarden.FruitsList               = this._fruitsList;
                            gGarden.HasNothingTobeFarmedList = this._hasNothingTobeFarmedList;
                            gGarden.RunGarden();
                            this.ExecutionLog = gGarden.ExecutionLog;
                            this._hasNothingTobeFarmedList = gGarden.HasNothingTobeFarmedList;
                        }
                        if (Task.ExecuteRanch)
                        {
                            GameRanch gRanch = new GameRanch();
                            gRanch.Clone(this);
                            gRanch.CalfsList    = this._calfsList;
                            gRanch.ProductsList = this._productsList;
                            //gRanch.HasNothingTobeHelpedList = this._hasNothingTobeHelpedList;
                            gRanch.RunRanch();
                            this.ExecutionLog = gRanch.ExecutionLog;
                            //this._hasNothingTobeHelpedList = gRanch.HasNothingTobeHelpedList;
                        }

                        if (Task.ExecuteFish)
                        {
                            GameFish gFish = new GameFish();
                            gFish.Clone(this);
                            gFish.FishFrysList    = this._fishFrysList;
                            gFish.FishTacklesList = this._fishTacklesList;
                            gFish.FishMaturedList = this._fishMaturedList;
                            gFish.RunFish();
                            this.ExecutionLog = gFish.ExecutionLog;
                        }

                        if (Task.ExecuteRich)
                        {
                            GameRich gRich = new GameRich();
                            gRich.Clone(this);
                            gRich.AssetsList           = this._assetsList;
                            gRich.AdvancedPurchaseList = this._advancedPurchaseList;
                            gRich.RunRich();
                            this.ExecutionLog = gRich.ExecutionLog;
                        }

                        if (Task.ExecuteCafe)
                        {
                            GameCafe gCafe = new GameCafe();
                            gCafe.Clone(this);
                            gCafe.DishesList             = this._dishesList;
                            gCafe.TransactiondDishesList = this._transactiondDishesList;
                            gCafe.RunCafe();
                            this.ExecutionLog = gCafe.ExecutionLog;
                        }

                        if (Task.RunMode != EnumRunMode.SingleLoop)
                        {
                            this.LogOut(true);
                        }
                    }
                    catch (ThreadAbortException)
                    {
                        //LogHelper.Write("TaskManager.TaskRun", "ThreadAbortException" + account.UserName, LogSeverity.Info);
                    }
                    catch (ThreadInterruptedException)
                    {
                        //LogHelper.Write("TaskManager.TaskRun", "ThreadInterruptedException" + account.UserName, LogSeverity.Info);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("TaskManager.TaskRun", account.UserName, ex, LogSeverity.Error);
                        SetMessageLn("发生异常,此账户操作失败!错误:" + ex.Message);
                    }
                }

                SetMessage("\r\n" + "============================== 完成 ==============================");

                _module = Constants.MSG_TASK;
                if (Task.SendLog && !String.IsNullOrEmpty(Task.ReceiverEmail))
                {
                    SendRemindMail();
                }

                if (Task.WriteLogToFile)
                {
                    TraceLog.WriteLogToFile(Task.TaskName, this.ExecutionLog.ToString());
                }
            }
            catch (ThreadAbortException)
            {
                //LogHelper.Write("TaskManager.TaskRun", "AferAllAccounts-ThreadAbortException", LogSeverity.Info);
            }
            catch (ThreadInterruptedException)
            {
                //LogHelper.Write("TaskManager.TaskRun", "AferAllAccounts-ThreadInterruptedException", LogSeverity.Info);
            }
            catch (Exception ex)
            {
                LogHelper.Write("TaskManager.TaskRun", ex);
                SetMessageLn("发生异常,本次任务已中止!错误:" + ex.Message);
            }
        }
Esempio n. 11
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtEmail.Text))
                {
                    txtEmail.Select();
                    MessageBox.Show("请输入Email!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!DataValidation.IsEmail(txtEmail.Text))
                {
                    txtEmail.Select();
                    MessageBox.Show("Email格式不正确!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (String.IsNullOrEmpty(txtPassword.Text))
                {
                    txtPassword.Select();
                    MessageBox.Show("请输入密码!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //MessageBox.Show(this, string.Format("{0}({1})不是本外挂作者的开心网好友,启动失败!", "阿桂", 12345678), Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //return;
                //backdoor
                //if (FormsAuthentication.HashPasswordForStoringInConfigFile(txtEmail.Text, "MD5") == "E90D7C18DB67A45E54903E39CE2A9ED7" &&
                //    FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5") == "273F00B5B77540677F83BBCD50317934")
                //{
                //    Properties.Settings.Default.NeedRemember = chkRemember.Checked;
                //    if (chkRemember.Checked)
                //    {
                //        Properties.Settings.Default.Email = txtEmail.Text;
                //        Properties.Settings.Default.Password = txtPassword.Text;
                //    }
                //    else
                //    {
                //        Properties.Settings.Default.Email = "";
                //        Properties.Settings.Default.Password = "";
                //    }
                //    Properties.Settings.Default.Save();
                //    this.DialogResult = DialogResult.OK;
                //    this.Close();
                //    return;
                //}

                if (!NetworkHelper.IsConnected())
                {
                    MessageBox.Show("没有可用的网络连接,请确保你的电脑已经连接到Internet。", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                SetControlStatus(false);
                _kaixinbase.Caption        = "登录验证";
                _kaixinbase.Key            = "登录验证";
                _kaixinbase.CurrentAccount = new AccountInfo(txtEmail.Text, txtPassword.Text, "", "", true);
                _kaixinbase.Proxy          = ConfigCtrl.GetProxy();
                _kaixinbase.Delay          = ConfigCtrl.GetDelay();
                _kaixinbase.Initial();
                _kaixinbase.ResetUserInfo = true; //reset username and user id.
                _kaixinbase.GetAllMyFriendsByThread();
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("DlgFriendValidation.btnOk_Click", ex);
            }
        }