Esempio n. 1
0
 private void FrmUpdateData_Load(object sender, EventArgs e)
 {
     try
     {
         BuildCmbGroup();
         BuildCmbAccount(cmbGroup.Text);
         BuildLstCars(ConfigCtrl.GetCarsInMarket());
         BuildLstMatches(ConfigCtrl.GetMatches());
         BuildLstFruits(ConfigCtrl.GetFruits());
         BuildLstCalves(ConfigCtrl.GetCalvesInShop());
         BuildLstAnimalProducts(ConfigCtrl.GetAnimalProducts());
         BuildLstFishFrys(ConfigCtrl.GetFishFrysInShop());
         BuildLstFishTackles(ConfigCtrl.GetFishTacklesInShop());
         BuildLstFishMatured(ConfigCtrl.GetFishMaturedInMarket());
         BuildLstAssets(ConfigCtrl.GetAssetsInShop());
         BuildLstDishes(ConfigCtrl.GetDishesInMenu());
         BuildGridViewSeeds(AddColumnsToTable(ConfigCtrl.GetSeedsToTable()), "种子列表读取失败!");
         BuildRankGridViewSeeds(AddRankColumnsToTable(ConfigCtrl.GetRankSeedsToTable()), "等级种子列表读取失败!");
         BuildDgvAssetRecommends(AddColumnsToAssetRecommends(ConfigCtrl.GetAssetsToTable()), "推荐买卖率表读取失败!");
         BuildDgvAdvancedPurchase(AddColumnsToAdvancedPurchase(ConfigCtrl.GetAdvancedPurchaseToTable()), "高级购买配置表读取失败!");
         BuildDgvTransactionDishes(AddColumnsToTransactionDishes(ConfigCtrl.GetTransactionDishesToTable()), "菜肴交易价格表读取失败!");
         _shopseeds = ConfigCtrl.GetSeedsInShop();
     }
     catch (Exception ex)
     {
         Program.ShowMessageBox("FrmUpdateData", ex);
     }
 }
Esempio n. 2
0
 private void btnReloadDishes_Click(object sender, EventArgs e)
 {
     try
     {
         BuildLstDishes(ConfigCtrl.GetDishesInMenu());
     }
     catch (Exception ex)
     {
         Program.ShowMessageBox("FrmUpdateData.btnReloadDishes_Click", ex);
     }
 }
 private void DlgStealFruitSelection_Load(object sender, EventArgs e)
 {
     try
     {
         this.Text = _caption;
         lstViewDishes.SetSelectedTitle(_selectedtitle);
         //²ËëÈ
         _dishes = ConfigCtrl.GetDishesInMenu();
         lstViewDishes.Clear();
         lstViewDishes.SelectedItems = _selecteddishes;
         lstViewDishes.AllItems      = _dishes;
     }
     catch (Exception ex)
     {
         Program.ShowMessageBox("DlgStealFruitSelection.DlgStealFruitSelection_Load", ex);
     }
 }
Esempio n. 4
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);
            }
        }