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); }
private void DlgAddAccount_Load(object sender, EventArgs e) { try { SetControls(false); if (_oldemail != null && _oldemail != string.Empty) { this.Icon = IconCtrl.GetIconFromResx(TreeConstants.ICON_KEYS); txtEmail.Text = _account.Email; txtPassword.Text = _account.Password; txtUserName.Text = _account.UserName; txtUserId.Text = _account.UserId; txtGender.Text = _account.Gender ? "ÄÐ" : "Å®"; this.Text = "±à¼Õ˺Å"; } else { _account = new AccountInfo(); this.Text = "Ìí¼ÓÕ˺Å"; } _hh = new HttpHelper(); ProxyInfo proxy = ConfigCtrl.GetProxy(); if (proxy != null && proxy.Enable == true) _hh.SetProxy(proxy.Server, proxy.Port, proxy.UserName, proxy.Password); } catch (Exception ex) { ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex); } }
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(); }
public AccountInfo Clone() { AccountInfo newAcc = new AccountInfo(); newAcc.Email = this.Email; newAcc.Password = this.Password; newAcc.UserName = this.UserName; newAcc.UserId = this.UserId; newAcc.Gender = this.Gender; return newAcc; }
public AccountNode(AccountInfo ai) { base.NodeType = NodeType.Account; _account = ai; if (ai.UserName == null || ai.UserName == string.Empty) this.Text = ai.Email; else this.Text = ai.UserName; this.ToolTipText = ai.Email; this.ImageIndex = DataConvert.GetInt32(IconType.User); this.SelectedImageIndex = DataConvert.GetInt32(IconType.User); }
public OperationInfo() { _account = new AccountInfo(); _parkwhitelist = new Collection<int>(); _parkblacklist = new Collection<int>(); _postlist = new Collection<int>(); _postall = true; _carColor = 16711680; //<option value="16777215" >白色</option> //<option value="13421772" >银色</option> //<option value="0" >黑色</option> //<option value="16711680" selected>红色</option> //<option value="255" >蓝色</option> //<option value="16776960" >黄色</option> _bitewhitelist = new Collection<int>(); _biteblacklist = new Collection<int>(); _recoverwhitelist = new Collection<int>(); _recoverblacklist = new Collection<int>(); _allowrestlist = new Collection<int>(); _biteall = true; _buywhitelist = new Collection<int>(); _buyblacklist = new Collection<int>(); //hosue _staywhitelist = new Collection<int>(); _stayblacklist = new Collection<int>(); _robwhitelist = new Collection<int>(); _robblacklist = new Collection<int>(); //garden _stealwhitelist = new Collection<int>(); _stealblacklist = new Collection<int>(); _stealall = true; _farmwhitelist = new Collection<int>(); _farmblacklist = new Collection<int>(); _farmall = true; //ranch _helpranchwhitelist = new Collection<int>(); _helpranchblacklist = new Collection<int>(); _helpranchall = true; _stealproductwhitelist = new Collection<int>(); _stealproductblacklist = new Collection<int>(); _stealproductall = true; //fish _fishingwhitelist = new Collection<int>(); _fishingblacklist = new Collection<int>(); _fishingall = true; _helpfishwhitelist = new Collection<int>(); _helpfishblacklist = new Collection<int>(); _helpfishall = true; //cafe _hirewhitelist = new Collection<int>(); _hireblacklist = new Collection<int>(); _hireall = true; _purchasewhitelist = new Collection<int>(); _purchaseblacklist = new Collection<int>(); _purchaseall = true; }
private void btnBuildTeam_Click(object sender, EventArgs e) { try { _toolbuildteam = new ToolBuildTeam((AccountInfo)cmbAccount.SelectedItem); _toolbuildteam.MessageChanged += new KaixinBase.MessageChangedEventHandler(_toolbuildteam_MessageChanged); _toolbuildteam.ValidateCodeNeeded += new KaixinBase.ValidateCodeNeededEventHandler(_toolbuildteam_ValidateCodeNeeded); _toolbuildteam.BuildTeamFinished += new GamePark.BuildTeamFinishedEventHandler(_toolbuildteam_BuildTeamFinished); if (cmbAccount.Items.Count <= 0 || cmbAccount.SelectedIndex < 0) { MessageBox.Show("请选择账号!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); cmbAccount.Select(); return; } if (lstViewCarsInMarket.SelectedItems.Count == 0) { MessageBox.Show("请在市场上的汽车列表里选择你需要组建的车队车型!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); lstViewCarsInMarket.Select(); return; } if (cmbMaxCarCount.Items.Count <= 0 || cmbMaxCarCount.SelectedIndex < 0) { MessageBox.Show("请选择汽车数量!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); cmbMaxCarCount.Select(); return; } _account = cmbAccount.Items[cmbAccount.SelectedIndex] as AccountInfo; if (_account == null) return; _modelcar = new NewCarInfo(); ListViewItem item = lstViewCarsInMarket.SelectedItems[0]; if (item != null) { _modelcar.CarId = DataConvert.GetInt32(item.SubItems[3].Text); _modelcar.CarName = item.SubItems[1].Text; _modelcar.CarPrice = DataConvert.GetInt32(item.SubItems[2].Text); } if (_modelcar.CarPrice < 70000) { MessageBox.Show("按规则70000元以下的车型,同一款车只能拥有一辆!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); lstViewCarsInMarket.Select(); return; } if (_modelcar.CarPrice < 200000) { if (MessageBox.Show("根据游戏规则,不能组建汽车单价低于200000的车队!是否继续?", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { lstViewCarsInMarket.Select(); return; } } _maxcarcount = DataConvert.GetInt32(cmbMaxCarCount.Items[cmbMaxCarCount.SelectedIndex].ToString()); _exchange = ExchangeCar.Stop; if (rdbExpensive.Checked) _exchange = ExchangeCar.Expensive; else if (rdbCheap.Checked) _exchange = ExchangeCar.Cheap; SetControlStatus(false); _toolbuildteam._account = _account; _toolbuildteam._modelcar = _modelcar; _toolbuildteam._maxcarcount = _maxcarcount; _toolbuildteam._exchange = _exchange; _toolbuildteam._carsInMarket = _carsInMarket; _toolbuildteam.BuildTeamByThread(); } catch (Exception ex) { Program.ShowMessageBox("FrmBuildTeam", ex); } }
private void btnCarsInMarket_Click(object sender, EventArgs e) { try { _toolbuildteam = new ToolBuildTeam((AccountInfo)cmbAccount.SelectedItem); _toolbuildteam.MessageChanged += new KaixinBase.MessageChangedEventHandler(_toolbuildteam_MessageChanged); _toolbuildteam.ValidateCodeNeeded += new KaixinBase.ValidateCodeNeededEventHandler(_toolbuildteam_ValidateCodeNeeded); _toolbuildteam.AllCarsInMarketFetched += new GamePark.AllCarsInMarketFetchedEventHandler(_toolbuildteam_AllCarsInMarketFetched); if (cmbAccount.SelectedIndex >= 0) _account = cmbAccount.Items[cmbAccount.SelectedIndex] as AccountInfo; else { Collection<AccountInfo> accounts = ConfigCtrl.GetAccounts(""); if (accounts == null || accounts.Count == 0) { MessageBox.Show("没有有效的账号,无法刷新!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); cmbAccount.Select(); return; } if (accounts[0] == null) { MessageBox.Show("没有有效的账号,无法刷新!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); cmbAccount.Select(); return; } _account = accounts[0]; } SetControlStatus(false); _toolbuildteam.GetAllCarsInMarketByThread(); } catch (Exception ex) { Program.ShowMessageBox("FrmBuildTeam", ex); } }
public void OpenOperationConfigFile(string group, AccountInfo account) { string folder = Path.Combine(Application.StartupPath, Constants.FOLDER_ACCOUNTS) + Constants.CHAR_DOUBLEBACKSLASH + group; string fullName = folder + Constants.CHAR_DOUBLEBACKSLASH + account.Email + ".xml"; OpenFile(fullName, account.UserName + "[黑白名单]"); }
protected bool ValidationLogin(AccountInfo account, bool printMessage) { if (!this.Login(account, printMessage)) { if (_task != null && _task.SkipValidation == true) return false; //this.ValidationCode为null,表示取消登录操作 while (this.ValidationCode != null) { if (!this.Login(account, printMessage)) { continue; } else break; } if (this.ValidationCode == null) { if (printMessage) SetMessageLn("中止登录!"); return false; } } return true; }
private bool Login(AccountInfo account, bool printMessage) { if (account == null) account = _account; if (printMessage) SetMessageLn(account.UserName + "(" + account.Email + ")" + "正在登录..."); string content = RequestLogin(account); if (content.IndexOf("security.kaixin001.com/js/sso.js") != -1) { if (_resetUserInfo) { content = _hh.Get("http://www.kaixin001.com/home/index.php"); if (content.IndexOf("<title>我的首页 - 开心网</title>") != -1) { _account.UserId = JsonHelper.GetMid(content, "我的开心网ID:", "\"></a>"); _account.UserName = JsonHelper.GetMid(content, _account.UserId + "\" class=\"sl2\">", "</a></p>"); return true; } } if (printMessage) SetMessageLn("登录成功!"); return true; } else if (content.IndexOf("<title>登录 - 开心网</title>") != -1) { if (printMessage) SetMessageLn("密码或者验证码错误,请重试..."); //需要验证码 /********************************************************/ /* 取图片时用到randnum的值必须与登录时用到的rcode值相同 /********************************************************/ byte[] image = this._hh.GetImage("http://www.kaixin001.com/interface/regcreatepng.php?randnum=0.03706184340980051_1253091176687&norect=1", "http://www.kaixin001.com/login/login.php"); //invode the validation code dialog if (_task != null && !String.IsNullOrEmpty(_task.TaskId)) { if (!_task.SkipValidation) SetValidateCodeByParam(image, _task.TaskId, _task.TaskName); else { if (printMessage) SetMessageLn("跳过该帐号。"); } } else SetValidateCodeByParam(image, "", ""); return false; } if (LoginFailed != null) LoginFailed(); if (printMessage) SetMessageLn(account.UserName + "(" + account.Email + ")" + "登录失败!"); LogHelper.Write("KaixinBase.Login", account.UserName + "(" + account.Email + ")(" + account.Password + ")登录失败!", LogSeverity.Warn); return false; }
private static bool IsExistAccountNode(XmlDocument xmldoc, AccountInfo user) { XmlNode objRootNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); foreach (XmlNode xn in objRootNode.ChildNodes) { if (xn.SelectSingleNode(Constants.ACCOUNT_EMAIL).InnerText == user.Email) { return true; } } return false; }
public ToolSendMessages(AccountInfo account) { base.Caption = Constants.TOOL_SENDMESSAGE; base.Key = Constants.TOOL_SENDMESSAGE; base.CurrentAccount = account; }
protected bool ValidationLogin(AccountInfo account) { return(ValidationLogin(account, true)); }
private bool Login(AccountInfo account, bool printMessage) { if (account == null) { account = _account; } if (printMessage) { SetMessageLn(account.UserName + "(" + account.Email + ")" + "正在登录..."); } string content = RequestLogin(account); if (content.IndexOf("security.kaixin001.com/js/sso.js") != -1) { if (_resetUserInfo) { content = _hh.Get("http://www.kaixin001.com/home/index.php"); if (content.IndexOf("<title>我的首页 - 开心网</title>") != -1) { _account.UserId = JsonHelper.GetMid(content, "我的开心网ID:", "\"></a>"); _account.UserName = JsonHelper.GetMid(content, _account.UserId + "\" class=\"sl2\">", "</a></p>"); return(true); } } if (printMessage) { SetMessageLn("登录成功!"); } return(true); } else if (content.IndexOf("<title>登录 - 开心网</title>") != -1) { if (printMessage) { SetMessageLn("密码或者验证码错误,请重试..."); } //需要验证码 /********************************************************/ /* 取图片时用到randnum的值必须与登录时用到的rcode值相同 * /********************************************************/ byte[] image = this._hh.GetImage("http://www.kaixin001.com/interface/regcreatepng.php?randnum=0.03706184340980051_1253091176687&norect=1", "http://www.kaixin001.com/login/login.php"); //invode the validation code dialog if (_task != null && !String.IsNullOrEmpty(_task.TaskId)) { if (!_task.SkipValidation) { SetValidateCodeByParam(image, _task.TaskId, _task.TaskName); } else { if (printMessage) { SetMessageLn("跳过该帐号。"); } } } else { SetValidateCodeByParam(image, "", ""); } return(false); } if (LoginFailed != null) { LoginFailed(); } if (printMessage) { SetMessageLn(account.UserName + "(" + account.Email + ")" + "登录失败!"); } LogHelper.Write("KaixinBase.Login", account.UserName + "(" + account.Email + ")(" + account.Password + ")登录失败!", LogSeverity.Warn); return(false); }
public void AccountNodeSelected(AccountInfo account) { if (!IsHiding()) { _propertyForm.Account = account; _propertyForm.Show(dockPanel); } }
public void ShowWebBrowser(AccountInfo account) { FrmWebBrowser frmbrowser = new FrmWebBrowser(); frmbrowser.Account = account; frmbrowser.NeedsPost = true; frmbrowser.Text = account.UserName; if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { frmbrowser.MdiParent = this; frmbrowser.Show(); } else frmbrowser.Show(dockPanel); }
public void ShowUserDetail(string group, AccountInfo account) { FrmUserDetail frmuser = new FrmUserDetail(); frmuser.Group = group; frmuser.Account = account.Clone(); frmuser.Text = account.UserName; if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { frmuser.MdiParent = this; frmuser.Show(); } else { foreach (IDockContent content in dockPanel.Documents) { FrmUserDetail form = content as FrmUserDetail; if (form != null && form.Account.Email == account.Email) { content.DockHandler.Show(); return; } } frmuser.Show(dockPanel); } }
public static TaskInfo GetTask(string taskid, string taskname, bool IsDefault) { try { XmlDocument objXmlDoc; TaskInfo task = new TaskInfo(); if (IsDefault) { string configContent = Utility.GetTaskConfig("default", "defaultpassword"); objXmlDoc = new XmlDocument(); objXmlDoc.LoadXml(configContent); } else { if (taskid == null || taskid == string.Empty) return null; objXmlDoc = GetTaskConfigFile(taskid, taskname); if (objXmlDoc == null) return null; task.TaskId = taskid; task.TaskName = taskname; } //root node XmlNode objTaskNode = objXmlDoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK); if (objTaskNode == null) return null; XmlNode objNode; DataView dv; /*------------------------------ExecutingMode-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_EXECUTINGMODE); if (objNode != null) { task.RunMode = GetRunMode(DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNMODE).InnerText)); XmlNode nodeRunInLoop = objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNINLOOP); task.RoundTime = DataConvert.GetInt32(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_ROUNDTIME).InnerText); task.Forbidden = DataConvert.GetBool(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDEN).InnerText); string strtime = DataConvert.GetString(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENSTART).InnerText); string[] atime = strtime.Split(':'); if (strtime == string.Empty) task.ForbiddenStart = new TimeInfo(); else { task.ForbiddenStart = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1])); } strtime = DataConvert.GetString(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENEND).InnerText); atime = strtime.Split(':'); if (strtime == string.Empty) task.ForbiddenEnd = new TimeInfo(); else { task.ForbiddenEnd = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1])); } //StartTimes dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.TASK_NODE_EXECUTINGMODE + Constants.CHAR_SLASH + Constants.TASK_EXECUTINGMODE_RUNINTIME + Constants.CHAR_SLASH + Constants.TASK_RUNINTIME_STARTTIMES); Collection<TimeInfo> starttimes = new Collection<TimeInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { string strTime = dv.Table.Rows[ix][0].ToString(); string[] temp = strTime.Split(':'); starttimes.Add(new TimeInfo(DataConvert.GetInt32(temp[0]), DataConvert.GetInt32(temp[1]))); } task.StartTimes = starttimes; } /*------------------------------ExecutingMode-----------------------------------*/ /*------------------------------Park-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.GAME_PARK); if (objNode != null) { task.ExecutePark = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_EXECUTEPARK).InnerText); task.ParkMyCars = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_PARKMYCARS).InnerText); task.PostOthersCars = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_POSTOTHERSCARS).InnerText); task.JoinMatch = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_JOINMATCH).InnerText); task.OriginateMatch = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_ORIGINATEMATCH).InnerText); task.OriginateMatchId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATEMATCHID, "1").InnerText); task.OriginateTeamNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATETEAMNUM, "2").InnerText); task.StartCar = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_STARTCAR).InnerText); task.CheerUp = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_CHEERUP).InnerText); string strcartime = DataConvert.GetString(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_STARTCARTIME, "8:30").InnerText); string[] atime = strcartime.Split(':'); task.StartCarTime = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1])); } /*------------------------------Park-----------------------------------*/ /*------------------------------Bite-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.GAME_BITE); if (objNode != null) { task.ExecuteBite = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_EXECUTEBITE).InnerText); task.ApproveRecovery = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_APPROVERECOVERY).InnerText); task.BiteOthers = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_BITEOTHERS).InnerText); task.AutoRecover = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_AUTORECOVER).InnerText); if (objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND) != null) task.ProtectFriend = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND).InnerText); else task.ProtectFriend = false; } /*------------------------------Bite-----------------------------------*/ /*------------------------------Slave-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.GAME_SLAVE); if (objNode != null) { task.ExecuteSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_EXECUTESLAVE).InnerText); task.MaxSlaves = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_SLAVE_MAXSLAVES).InnerText); task.NickName = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_SLAVE_NICKNAME).InnerText); task.BuySlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYSLAVE).InnerText); task.BuyLowPriceSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYLOWPRICESLAVE).InnerText); task.FawnMaster = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_FAWNMASTER).InnerText); task.PropitiateSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_PROPITIATESLAVE).InnerText); task.AfflictSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_AFFLICTSLAVE).InnerText); task.ReleaseSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_RELEASESLAVE).InnerText); } /*------------------------------Slave-----------------------------------*/ /*------------------------------House-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.GAME_HOUSE); if (objNode != null) { task.ExecuteHouse = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_EXECUTEHOUSE).InnerText); task.DoJob = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_DOJOB).InnerText); task.StayHouse = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_STAYHOUSE).InnerText); task.RobFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFRIENDS).InnerText); task.RobFreeFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFREEFRIENDS).InnerText); task.DriveFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_DRIVEFRIENDS).InnerText); } /*------------------------------House-----------------------------------*/ /*------------------------------Garden-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.GAME_GARDEN); if (objNode != null) { task.ExecuteGarden = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXECUTEGARDEN).InnerText); task.FarmSelf = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSELF).InnerText); task.ExpensiveFarmSelf = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSELF).InnerText); task.CustomFarmSelf = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSELF).InnerText); task.FarmShared = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSHARED).InnerText); task.ExpensiveFarmShared = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSHARED).InnerText); task.CustomFarmShared = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSHARED).InnerText); task.HarvestFruit = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_HARVESTFRUIT).InnerText); task.BuySeed = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEED).InnerText); task.BuySeedCount = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEEDCOUNT).InnerText); task.HelpOthers = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_HELPOTHERS).InnerText); task.StealFruit = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_STEALFRUIT).InnerText); task.PresentFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUIT, "False").InnerText); task.PresentFruitByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITBYPRICE, "True").InnerText); task.PresentFruitCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKVALUE, "True").InnerText); task.PresentFruitValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITVALUE, "100").InnerText); task.PresentFruitId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITID, "11").InnerText); task.PresentFruitCheckNum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKNUM, "True").InnerText); task.PresentFruitNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITNUM, "1000").InnerText); task.SellFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFRUIT, "False").InnerText); task.LowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASH, "True").InnerText); task.LowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASHLIMIT, "100").InnerText); task.SellAllFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLALLFRUIT, "False").InnerText); task.MaxSellLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_MAXSELLLIMIT, "300").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFORBIDDENNFRUITSLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_GARDEN + Constants.CHAR_SLASH + Constants.TASK_GARDEN_SELLFORBIDDENNFRUITSLIST); Collection<int> sellfruits = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { sellfruits.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.SellForbiddennFruitsList = sellfruits; task.SowMySeedsFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SOWMYSEEDSFIRST, "False").InnerText); task.StealUnknowFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALUNKNOWFRUIT, "True").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_GARDEN + Constants.CHAR_SLASH + Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST); Collection<int> fruits = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { fruits.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.StealForbiddenFruitsList = fruits; } /*------------------------------Garden-----------------------------------*/ /*------------------------------Ranch-----------------------------------*/ objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RANCH, ""); if (objNode != null) { task.ExecuteRanch = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_EXECUTERANCH, "True").InnerText); task.HarvestProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTPRODUCT, "True").InnerText); task.HarvestAnimal = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTANIMAL, "True").InnerText); task.AddWater = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDWATER, "True").InnerText); task.HelpAddWater = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDWATER, "False").InnerText); task.AddGrass = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDGRASS, "True").InnerText); task.HelpAddGrass = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDGRASS, "False").InnerText); task.BuyCalf = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALF, "True").InnerText); task.BuyCalfByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFBYPRICE, "True").InnerText); task.BuyCalfCustom = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFCUSTOM, "1").InnerText); task.StealProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_STEALPRODUCT, "False").InnerText); task.MakeProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_MAKEPRODUCT, "True").InnerText); task.HelpMakeProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPMAKEPRODUCT, "False").InnerText); task.BreedAnimal = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BREEDANIMAL, "False").InnerText); task.FoodNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_FOODNUM, "200").InnerText); task.PresentProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCT, "False").InnerText); task.PresentProductByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTBYPRICE, "True").InnerText); task.PresentProductCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKVALUE, "True").InnerText); task.PresentProductValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTVALUE, "100").InnerText); task.PresentProductAid = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTAID, "1").InnerText); task.PresentProductType = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTTYPE, "0").InnerText); task.PresentProductCheckNum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKNUM, "True").InnerText); task.PresentProductNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTNUM, "100").InnerText); task.SellProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCT, "False").InnerText); task.SellProductLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASH, "True").InnerText); task.SellProductLowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASHLIMIT, "100").InnerText); task.SellAllProducts = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLALLPRODUCTS, "False").InnerText); task.SellProductMaxLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTMAXLIMIT, "300").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTFORBIDDENLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_RANCH + Constants.CHAR_SLASH + Constants.TASK_RANCH_SELLPRODUCTFORBIDDENLIST); Collection<ProductInfo> sellproducts = new Collection<ProductInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { ProductInfo product = new ProductInfo(); product.Aid = DataConvert.GetInt32(dv.Table.Rows[ix][0]); product.Type = DataConvert.GetInt32(dv.Table.Rows[ix][1]); sellproducts.Add(product); } task.SellProductForbiddenList = sellproducts; task.AddCarrot = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDCARROT, "True").InnerText); task.HelpAddCarrot = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDCARROT, "False").InnerText); task.CarrotNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_CARROTNUM, "200").InnerText); task.AddBamboo = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDBAMBOO, "True").InnerText); task.HelpAddBamboo = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDBAMBOO, "False").InnerText); task.BambooNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BAMBOONUM, "200").InnerText); } /*------------------------------Ranch-----------------------------------*/ /*------------------------------Fish-----------------------------------*/ objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_FISH, ""); if (objNode != null) { task.ExecuteFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_EXECUTEFISH, "True").InnerText); task.Shake = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SHAKE, "True").InnerText); task.TreatFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_TREATFISH, "True").InnerText); task.UpdateFishPond = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_UPDATEFISHPOND, "True").InnerText); task.BangKeJing = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BANGKEJING, "True").InnerText); task.BuyFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISH, "True").InnerText); task.MaxFishes = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXFISHES, "20").InnerText); task.BuyFishByRank = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHBYRANK, "True").InnerText); task.BuyFishFishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHFISHID, "1").InnerText); task.Fishing = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_FISHING, "True").InnerText); task.BuyUpdateTackle = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYUPDATETACKLE, "False").InnerText); task.MaxTackles = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXTACKLES, "5").InnerText); task.HarvestFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HARVESTFISH, "True").InnerText); task.NetSelfFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISH, "False").InnerText); task.NetSelfFishCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHCHEAP, "False").InnerText); task.NetSelfFishMature = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHMATURE, "80").InnerText); task.HelpFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HELPFISH, "True").InnerText); task.PresentFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISH, "False").InnerText); task.PresentFishCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHEAP, "False").InnerText); task.PresentFishCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHECKVALUE, "True").InnerText); task.PresentFishValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHVALUE, "10000").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHFORBIDDENLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_FISH + Constants.CHAR_SLASH + Constants.TASK_FISH_PRESENTFISHFORBIDDENLIST); Collection<int> presentfishes = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { presentfishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.PresentFishForbiddenList = presentfishes; task.SellFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISH, "False").InnerText); task.SellFishLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASH, "False").InnerText); task.SellFishLowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASHLIMIT, "10").InnerText); task.SellAllFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLALLFISH, "False").InnerText); task.SellFishCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHCHECKVALUE, "False").InnerText); task.SellFishValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHVALUE, "10000").InnerText); task.SellFishMaxLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHMAXLIMIT, "20").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHFORBIDDENLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_FISH + Constants.CHAR_SLASH + Constants.TASK_FISH_SELLFISHFORBIDDENLIST); Collection<int> sellfishes = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { sellfishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.SellFishForbiddenList = sellfishes; } /*------------------------------Fish-----------------------------------*/ /*------------------------------Rich-----------------------------------*/ objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RICH, ""); if (objNode != null) { task.ExecuteRich = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_EXECUTERICH, "True").InnerText); task.SellAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_SELLASSET, "True").InnerText); task.BuyAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSET, "True").InnerText); task.BuyAssetCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETCHEAP, "False").InnerText); task.GiveUpIfRatio = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFRATIO, "True").InnerText); task.GiveUpRatio = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPRATIO, "50").InnerText); task.GiveUpIfMinimum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMINIMUM, "True").InnerText); task.GiveUpMinimum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPMINIMUM, "5").InnerText); task.GiveUpIfMyAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMYASSET, "False").InnerText); task.GiveUpAssetCount = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPASSETCOUNT, "3").InnerText); task.AdvancedPurchase = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_ADVANCEDPURCHASE, "False").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETSLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_RICH + Constants.CHAR_SLASH + Constants.TASK_RICH_BUYASSETSLIST); Collection<int> buyassets = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { buyassets.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.BuyAssetsList = buyassets; } /*------------------------------Rich-----------------------------------*/ /*------------------------------Cafe-----------------------------------*/ objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_CAFE, ""); if (objNode != null) { task.ExecuteCafe = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_EXECUTECAFE, "True").InnerText); task.BoxClean = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_BOXCLEAN, "True").InnerText); task.Cook = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOK, "True").InnerText); task.CookTomatoFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKTOMATOFIRST, "True").InnerText); task.CookMedlarFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKMEDLARFIRST, "False").InnerText); task.CookCrabFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKCRABFIRST, "False").InnerText); task.CookPineappleFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKPINEAPPLEFIRST, "False").InnerText); task.CookDishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKDISHID, "4").InnerText); task.CookLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASH, "True").InnerText); task.CookLowCashLimit = DataConvert.GetInt64(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASHLIMIT, "2000").InnerText); task.Hire = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HIRE, "True").InnerText); task.MaxEmployees = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_MAXEMPLOYEES, "12").InnerText); task.HelpFriend = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HELPFRIEND, "True").InnerText); task.PresentFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOOD, "False").InnerText); GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFORBIDDENFOODLIST, ""); dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_CAFE + Constants.CHAR_SLASH + Constants.TASK_CAFE_PRESENTFORBIDDENFOODLIST); Collection<int> presentdishes = new Collection<int>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { presentdishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0])); } task.PresentForbiddenFoodList = presentdishes; task.PresentFoodByCount = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODBYCOUNT, "True").InnerText); task.PresentFoodDishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODDISHID, "4").InnerText); task.PresentFoodMessage = DataConvert.GetString(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODMESSAGE, "送你食物啦!").InnerText); task.PresentFoodRatio = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODRATIO, "50").InnerText); task.PresentLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASH, "True").InnerText); task.PresentLowCashLimit = DataConvert.GetInt64(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASHLIMIT, "2000").InnerText); task.PresentFoodLowCount = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNT, "True").InnerText); task.PresentFoodLowCountLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNTLIMIT, "2").InnerText); task.PurchaseFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOOD, "False").InnerText); task.PurchaseFoodByRefPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOODBYREFPRICE, "True").InnerText); task.SellFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOOD, "False").InnerText); task.SellFoodByRefPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOODBYREFPRICE, "True").InnerText); } /*------------------------------Cafe-----------------------------------*/ /*------------------------------Miscellaneous-----------------------------------*/ objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_MISCELLANEOUS); if (objNode != null) { task.GroupName = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_GROUP).InnerText); task.SendLog = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_SENDLOG).InnerText); task.ReceiverEmail = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_RECEIVEREMAIL).InnerText); if (objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE) != null) task.WriteLogToFile = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE).InnerText); else task.WriteLogToFile = false; task.SkipValidation = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_MISCELLANEOUS_SKIPVALIDATION, "False").InnerText); } /*------------------------------Miscellaneous-----------------------------------*/ /*------------------------------Accounts-----------------------------------*/ dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); Collection<AccountInfo> accounts = new Collection<AccountInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { AccountInfo account = new AccountInfo(); account.Email = dv.Table.Rows[ix][0].ToString(); account.Password = dv.Table.Rows[ix][1].ToString(); account.UserName = dv.Table.Rows[ix][2].ToString(); account.UserId = dv.Table.Rows[ix][3].ToString(); account.Gender = DataConvert.GetBool(dv.Table.Rows[ix][4]); accounts.Add(account); } task.Accounts = accounts; /*------------------------------Accounts-----------------------------------*/ return task; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetTask", taskname + "(" + taskid.ToString() + ")", ex, LogSeverity.Fatal); throw; } }
public static OperationInfo GetOperation(string groupname, AccountInfo account) { try { if (account.Email == null || account.Email == string.Empty) return null; XmlDocument objXmlDoc = GetOperationConfigFile(groupname, account.Email, account.Password); if (objXmlDoc == null) return null; OperationInfo operation = new OperationInfo(); operation.Account = account; //email operation.Email = GetInnerText(objXmlDoc, Constants.ACCOUNT_EMAIL); //password operation.Password = GetInnerText(objXmlDoc, Constants.ACCOUNT_PASSWORD); //park operation.ParkWhiteList = GetAccountList(objXmlDoc, Constants.PARK_PARKWHITE); operation.ParkBlackList = GetAccountList(objXmlDoc, Constants.PARK_PARKBLACK); operation.PostList = GetAccountList(objXmlDoc, Constants.PARK_POSTLIST); operation.PostAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.PARK_POSTALL)); //operation.ParkingDelayTime = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CONFIG_PARKINGDELAYTIME)); //operation.ParkMyCars = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_PARKMYCARS)); //operation.PostOthersCars = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_POSTOTHERSCARS)); //bite operation.BiteWhiteList = GetAccountList(objXmlDoc, Constants.BITE_BITEWHITE); operation.BiteBlackList = GetAccountList(objXmlDoc, Constants.BITE_BITEBLACK); operation.RecoverWhiteList = GetAccountList(objXmlDoc, Constants.BITE_RECOVERWHITE); operation.RecoverBlackList = GetAccountList(objXmlDoc, Constants.BITE_RECOVERBLACK); operation.BiteAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.BITE_BITEALL)); operation.ProtectId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.BITE_PROTECTID)); //operation.ApproveRecovery = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_APPROVERECOVERY)); //operation.BiteOthers = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BITEOTHERS)); //operation.AutoRecover = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_AUTORECOVER)); //slave operation.BuyWhiteList = GetAccountList(objXmlDoc, Constants.SLAVE_BUYWHITE); operation.BuyBlackList = GetAccountList(objXmlDoc, Constants.SLAVE_BUYBLACK); //operation.MaxSlaves = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CONFIG_MAXSLAVES)); //operation.NickName = GetInnerText(objXmlDoc, Constants.CONFIG_NICKNAME); //operation.BuySlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BUYSLAVE)); //operation.BuyLowPriceSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BUYLOWPRICESLAVE)); //operation.PropitiateSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_PROPITIATESLAVE)); //operation.AfflictSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_AFFLICTSLAVE)); //operation.ReleaseSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_RELEASESLAVE)); //house operation.StayWhiteList = GetAccountList(objXmlDoc, Constants.HOUSE_STAYWHITE); operation.StayBlackList = GetAccountList(objXmlDoc, Constants.HOUSE_STAYBLACK); operation.RobWhiteList = GetAccountList(objXmlDoc, Constants.HOUSE_ROBWHITE); operation.RobBlackList = GetAccountList(objXmlDoc, Constants.HOUSE_ROBBLACK); //garden operation.StealWhiteList = GetAccountList(objXmlDoc, Constants.GARDEN_STEALWHITE); operation.StealBlackList = GetAccountList(objXmlDoc, Constants.GARDEN_STEALBLACK); operation.StealAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.GARDEN_STEALALL)); operation.FarmWhiteList = GetAccountList(objXmlDoc, Constants.GARDEN_FARMWHITE); operation.FarmBlackList = GetAccountList(objXmlDoc, Constants.GARDEN_FARMBLACK); operation.FarmAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.GARDEN_FARMALL)); operation.PresentId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.GARDEN_PRESENTID)); //ranch operation.HelpRanchWhiteList = GetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHWHITE); operation.HelpRanchBlackList = GetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHBLACK); operation.HelpRanchAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.RANCH_HELPRANCHALL)); operation.StealProductWhiteList = GetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTWHITE); operation.StealProductBlackList = GetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTBLACK); operation.StealProductAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.RANCH_STEALPRODUCTALL)); operation.PresentProductId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.RANCH_PRESENTPRODUCTID)); //fish operation.FishingWhiteList = GetAccountList(objXmlDoc, Constants.FISH_FISHINGWHITE); operation.FishingBlackList = GetAccountList(objXmlDoc, Constants.FISH_FISHINGBLACK); operation.FishingAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.FISH_FISHINGALL)); operation.HelpFishWhiteList = GetAccountList(objXmlDoc, Constants.FISH_HELPFISHWHITE); operation.HelpFishBlackList = GetAccountList(objXmlDoc, Constants.FISH_HELPFISHBLACK); operation.HelpFishAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.FISH_HELPFISHALL)); operation.PresentFishId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.FISH_PRESENTFISHID)); //cafe operation.HireWhiteList = GetAccountList(objXmlDoc, Constants.CAFE_HIREWHITE); operation.HireBlackList = GetAccountList(objXmlDoc, Constants.CAFE_HIREBLACK); operation.HireAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CAFE_HIREALL)); operation.PurchaseWhiteList = GetAccountList(objXmlDoc, Constants.CAFE_PURCHASEWHITE); operation.PurchaseBlackList = GetAccountList(objXmlDoc, Constants.CAFE_PURCHASEBLACK); operation.PurchaseAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CAFE_PURCHASEALL)); operation.PresentFoodId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CAFE_PRESENTFOODID)); return operation; } catch (Exception ex) { LogHelper.Write("读取黑白名单配置" + account.UserName, ex); return null; } }
public void SendMessage(AccountInfo account, Collection <FriendInfo> friends, string msg, bool bMulti) { _threadMain = new Thread(new System.Threading.ThreadStart(delegate { TryCatchBlock th = new TryCatchBlock(delegate { _module = Constants.MSG_SENDMESSAGE; SetMessageLn("开始群发消息..."); if (!this.ValidationLogin(account, true)) { if (SendMessageFinished != null) { SendMessageFinished(); } return; } if (!bMulti) { foreach (FriendInfo friend in friends) { RequestMessageSending(friend.Id.ToString(), msg); SetMessageLn(string.Format("已经给{0}({1})发送消息!", friend.Name, friend.Id)); } SetMessageLn("全部消息发送完毕!"); } else { StringBuilder sbuids = new StringBuilder(); StringBuilder sbnames = new StringBuilder(); string[,] sendList = new string[(friends.Count - 1) / 30 + 1, 2]; for (int ix = 0; ix < friends.Count; ix++) { sbuids.Append(friends[ix].Id.ToString()); if ((ix + 1) % 30 != 0 && ix != friends.Count - 1) { sbuids.Append(","); } sbnames.Append(friends[ix].Name); if ((ix + 1) % 30 != 0 && ix != friends.Count - 1) { sbnames.Append(","); } if ((ix + 1) % 30 == 0) { sendList[ix / 30, 0] = sbuids.ToString(); sendList[ix / 30, 1] = sbnames.ToString(); sbuids = new StringBuilder(); sbnames = new StringBuilder(); } } if (friends.Count % 30 != 0) { sendList[sendList.GetLength(0) - 1, 0] = sbuids.ToString(); sendList[sendList.GetLength(0) - 1, 1] = sbnames.ToString(); } for (int ix = 0; ix < sendList.GetLength(0); ix++) { RequestMessageSending(sendList[ix, 0], msg); SetMessageLn("给" + sendList[ix, 1] + "群发消息成功!"); } } if (SendMessageFinished != null) { SendMessageFinished(); } return; }); base.ExecuteTryCatchBlock(th, "发生异常,群发消息失败!"); })); _threadMain.IsBackground = true; _threadMain.Start(); }
public static Collection<AccountInfo> GetAccounts(string groupname) { try { XmlDocument objXmlDoc = GetGroupConfigFile(groupname); if (objXmlDoc == null) return null; DataView dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); Collection<AccountInfo> accounts = new Collection<AccountInfo>(); accounts.Clear(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { AccountInfo account = new AccountInfo(); account.Email = dv.Table.Rows[ix][0].ToString(); account.Password = dv.Table.Rows[ix][1].ToString(); account.UserName = dv.Table.Rows[ix][2].ToString(); account.UserId = dv.Table.Rows[ix][3].ToString(); account.Gender = DataConvert.GetBool(dv.Table.Rows[ix][4]); accounts.Add(account); } return accounts; } catch (Exception ex) { LogHelper.Write("读取组内账号" + groupname, ex); return null; } }
private void cmbSender_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbSender.Items.Count <= 0 || cmbSender.SelectedIndex < 0) return; _account = cmbSender.Items[cmbSender.SelectedIndex] as AccountInfo; if (_account == null) return; SetControlStatus(false); _toolsendmsg = new ToolSendMessages(_account); _toolsendmsg.MessageChanged += new KaixinBase.MessageChangedEventHandler(toolsendmsg_MessageChanged); _toolsendmsg.ValidateCodeNeeded += new KaixinBase.ValidateCodeNeededEventHandler(_toolsendmsg_ValidateCodeNeeded); _toolsendmsg.AllMyFriendsFetched += new KaixinBase.AllMyFriendsFetchedEventHandler(toolsendmsg_AllMyFriendsFetched); _toolsendmsg.SendMessageFinished += new ToolSendMessages.SendMessageFinishedEventHandler(_toolsendmsg_SendMessageFinished); _toolsendmsg.GetAllMyFriends(); } catch (Exception ex) { Program.ShowMessageBox("FrmSendMessage", ex); } }
public static string EditAccount(string groupname, AccountInfo account, string oldemail) { try { XmlDocument objXmlDoc = GetGroupConfigFile(groupname); if (objXmlDoc == null) return "配置文件不存在!"; if (oldemail == null || oldemail == string.Empty) { if (IsExistAccountNode(objXmlDoc, account)) return "该用户已经存在!"; else InsertAccounNode(objXmlDoc, account); } else { if (account.Email != oldemail && IsExistAccountNode(objXmlDoc, account)) return "该用户已经存在!"; else EditAccountNode(objXmlDoc, oldemail, account); } return SetGroupConfigFile(objXmlDoc, groupname); } catch (Exception ex) { LogHelper.Write("编辑账号", ex); return Constants.STATUS_FAIL; } }
protected bool ValidationLogin(AccountInfo account) { return ValidationLogin(account, true); }
public static string DeleteAccount(string groupname, AccountInfo account) { try { XmlDocument objXmlDoc = GetGroupConfigFile(groupname); if (objXmlDoc == null) return "配置文件不存在!"; DeleteAccountNode(objXmlDoc, account); return SetGroupConfigFile(objXmlDoc, groupname); } catch (Exception ex) { LogHelper.Write("删除账号", ex); return Constants.STATUS_FAIL; } }
private string RequestLogin(AccountInfo account) { this._hh.Get("http://www.kaixin001.com/"); this._hh.DelayedTime = Constants.DELAY_2SECONDS; //string loginUrl = "http://www.kaixin001.com/login/login.php"; string loginUrl = "https://security.kaixin001.com/login/login_auth.php"; string param = ""; if (string.IsNullOrEmpty(this.ValidationCode)) //param = "url=%2Fhome%2F&email=" + DataConvert.GetEncodeData(email) + "&password="******"rcode=&url=http%3A%2F%2Fwww.kaixin001.com%2F%3F647383871%3D342757378&email=" + DataConvert.GetEncodeData(account.Email) + "&password="******"&code="; else param = "rcode=0.03706184340980051_1253091176687&url=%2Fhome%2F&rpkey=&diarykey=&invisible_mode=0&email=" + DataConvert.GetEncodeData(account.Email) + "&password="******"&code=" + DataConvert.GetEncodeData(this.ValidationCode); /********************************************************/ /* 取图片时用到randnum的值必须与登录时用到的rcode值相同 /********************************************************/ return this._hh.Post(loginUrl, "http://www.kaixin001.com/", param); }
private static void InsertAccounNode(XmlDocument xmldoc, AccountInfo account) { XmlNode objRootNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); XmlElement objChildNode = xmldoc.CreateElement(Constants.ACCOUNT_ACCOUNT); objRootNode.AppendChild(objChildNode); XmlElement emtEmail = xmldoc.CreateElement(Constants.ACCOUNT_EMAIL); emtEmail.InnerText = account.Email; XmlElement emtPassword = xmldoc.CreateElement(Constants.ACCOUNT_PASSWORD); emtPassword.InnerText = account.Password; XmlElement emtUserName = xmldoc.CreateElement(Constants.ACCOUNT_USERNAME); emtUserName.InnerText = account.UserName; XmlElement emtUserId = xmldoc.CreateElement(Constants.ACCOUNT_USERID); emtUserId.InnerText = account.UserId; XmlElement emtGender = xmldoc.CreateElement(Constants.ACCOUNT_GENDER); emtGender.InnerText = account.Gender.ToString(); objChildNode.AppendChild(emtEmail); objChildNode.AppendChild(emtPassword); objChildNode.AppendChild(emtUserName); objChildNode.AppendChild(emtUserId); objChildNode.AppendChild(emtGender); }
private static void EditAccountNode(XmlDocument xmldoc, string email, AccountInfo account) { XmlNode objRootNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); foreach (XmlNode xn in objRootNode.ChildNodes) { if (xn.SelectSingleNode(Constants.ACCOUNT_EMAIL).InnerText == email) { xn.SelectSingleNode(Constants.ACCOUNT_EMAIL).InnerText = account.Email; xn.SelectSingleNode(Constants.ACCOUNT_PASSWORD).InnerText = account.Password; xn.SelectSingleNode(Constants.ACCOUNT_USERNAME).InnerText = account.UserName; xn.SelectSingleNode(Constants.ACCOUNT_USERID).InnerText = account.UserId; if (xn.SelectSingleNode(Constants.ACCOUNT_GENDER) == null) { XmlElement emtGender = xmldoc.CreateElement(Constants.ACCOUNT_GENDER); xn.AppendChild(emtGender); } xn.SelectSingleNode(Constants.ACCOUNT_GENDER).InnerText = account.Gender.ToString(); break; } } }
private static void DeleteAccountNode(XmlDocument xmldoc, AccountInfo user) { XmlNode objRootNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS); foreach (XmlNode xn in objRootNode.ChildNodes) { if (xn.SelectSingleNode(Constants.ACCOUNT_EMAIL).InnerText == user.Email) { objRootNode.RemoveChild(xn); break; } } }
private void btnCars_Click(object sender, EventArgs e) { try { _toolbuildteam = new ToolBuildTeam((AccountInfo)cmbAccount.SelectedItem); _toolbuildteam.MessageChanged += new KaixinBase.MessageChangedEventHandler(_toolbuildteam_MessageChanged); _toolbuildteam.ValidateCodeNeeded += new KaixinBase.ValidateCodeNeededEventHandler(_toolbuildteam_ValidateCodeNeeded); _toolbuildteam.MyCarFetched += new GamePark.MyCarFetchedEventHandler(_toolbuildteam_MyCarFetched); if (cmbAccount.Items.Count <= 0 || cmbAccount.SelectedIndex < 0) { MessageBox.Show("请选择账号!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); cmbAccount.Select(); return; } _account = cmbAccount.Items[cmbAccount.SelectedIndex] as AccountInfo; if (_account == null) return; SetControlStatus(false); _toolbuildteam.GetMyCarsByThread(); } catch (Exception ex) { Program.ShowMessageBox("FrmBuildTeam", ex); } }
public static string SaveContactToFile(string path, AccountInfo account, Collection<FriendInfo> friends) { try { if (String.IsNullOrEmpty(path)) return "保存路径不能为空!"; if (friends == null || friends.Count <= 0) return "没有任何好友,无法保存!"; XmlDocument objXmlDoc = new XmlDocument(); //<ZrAssistant></ZrAssistant> XmlElement root = objXmlDoc.CreateElement("ZrAssistant"); objXmlDoc.AppendChild(root); //<Contact></Contact> XmlElement objContactNode = objXmlDoc.CreateElement("Contact"); root.AppendChild(objContactNode); //<Friend> // <UserName><UserName> // <UserId></UserId> //</Friend> /*------------------------------Contact-----------------------------------*/ foreach (FriendInfo friend in friends) { XmlElement objChildNode = objXmlDoc.CreateElement("Friend"); objContactNode.AppendChild(objChildNode); XmlElement emtUserName = objXmlDoc.CreateElement("UserName"); emtUserName.InnerText = friend.Name; objChildNode.AppendChild(emtUserName); XmlElement emtUserId = objXmlDoc.CreateElement("UserId"); emtUserId.InnerText = friend.Id.ToString(); objChildNode.AppendChild(emtUserId); } /*------------------------------Contact-----------------------------------*/ if (!Directory.Exists(path)) Directory.CreateDirectory(path); string configFile = path + Constants.CHAR_DOUBLEBACKSLASH + account.UserName + "(" + account.Email + ").xml"; objXmlDoc.Save(configFile); return Constants.STATUS_SUCCESS; } catch (Exception ex) { LogHelper.Write("保存联系人信息到文件" + path, ex); return ex.Message; } }
private void AddAllList(AccountInfo currentuser, Collection<AccountInfo> accountsList, bool isnew) { int num = 0; foreach (AccountInfo account in accountsList) { if (currentuser.UserId == account.UserId) continue; num++; if (isnew) SetMessageLn(string.Format("添加好友请求新账号#{0} {1}({2}) :", num, account.UserName, account.UserId)); else SetMessageLn(string.Format("添加好友请求旧账号#{0} {1}({2}) :", num, account.UserName, account.UserId)); if (this.SendFriendRequest(account.UserId)) SetMessage("成功!"); else SetMessage("失败!"); } }
public void SendMessage(AccountInfo account, Collection<FriendInfo> friends, string msg, bool bMulti) { _threadMain = new Thread(new System.Threading.ThreadStart(delegate { TryCatchBlock th = new TryCatchBlock(delegate { _module = Constants.MSG_SENDMESSAGE; SetMessageLn("开始群发消息..."); if (!this.ValidationLogin(account, true)) { if (SendMessageFinished != null) SendMessageFinished(); return; } if (!bMulti) { foreach (FriendInfo friend in friends) { RequestMessageSending(friend.Id.ToString(), msg); SetMessageLn(string.Format("已经给{0}({1})发送消息!", friend.Name, friend.Id)); } SetMessageLn("全部消息发送完毕!"); } else { StringBuilder sbuids = new StringBuilder(); StringBuilder sbnames = new StringBuilder(); string[,] sendList = new string[(friends.Count - 1) / 30 + 1, 2]; for (int ix = 0; ix < friends.Count; ix++) { sbuids.Append(friends[ix].Id.ToString()); if ((ix + 1) % 30 != 0 && ix != friends.Count - 1) sbuids.Append(","); sbnames.Append(friends[ix].Name); if ((ix + 1) % 30 != 0 && ix != friends.Count - 1) sbnames.Append(","); if ((ix + 1) % 30 == 0) { sendList[ix / 30, 0] = sbuids.ToString(); sendList[ix / 30, 1] = sbnames.ToString(); sbuids = new StringBuilder(); sbnames = new StringBuilder(); } } if (friends.Count % 30 != 0) { sendList[sendList.GetLength(0) - 1, 0] = sbuids.ToString(); sendList[sendList.GetLength(0) - 1, 1] = sbnames.ToString(); } for (int ix = 0; ix < sendList.GetLength(0); ix++) { RequestMessageSending(sendList[ix, 0], msg); SetMessageLn("给" + sendList[ix, 1] + "群发消息成功!"); } } if (SendMessageFinished != null) SendMessageFinished(); return; }); base.ExecuteTryCatchBlock(th, "发生异常,群发消息失败!"); })); _threadMain.IsBackground = true; _threadMain.Start(); }