private void showFarmland(JsonObject farmStatus) { this.Invoke((MethodInvoker)delegate { listViewFarmland.Items.Clear(); }); string landStatus = ""; string cropStatus = ""; for (int i = 0; i < farmStatus.GetCollection().Count; i++) { ListViewItem lv = new ListViewItem(); lv.SubItems[0].Text = i.ToString(); Land newLand = new Land(farmStatus.GetCollection()[i]); CropItem newCropItem = new CropItem(GetCropModel(newLand.a)); //lv.SubItems.Add(newLand.b.Equals("0") ? "空地":newShopItem.cName); landStatus = GetLandStatus(newLand, newCropItem); lv.SubItems.Add(landStatus); lv.SubItems.Add(newLand.f.Equals("0") ? "无" : newLand.f); lv.SubItems.Add(newLand.g.Equals("0") ? "无" : newLand.g); lv.SubItems.Add(newLand.h.Equals("0") ? "是" : "否"); GetCropStatus(out cropStatus, newLand); lv.SubItems.Add(cropStatus); lv.SubItems.Add(TimeFormat.FormatTime((Convert.ToInt64(newLand.q) + Convert.ToInt64(newCropItem.growthCycle)).ToString())); this.Invoke((MethodInvoker)delegate { listViewFarmland.Items.Add(lv); }); } }
private void LandSpraying(string userId, JsonObject theFarmStatus) { string worm = ""; string result = ""; User friendInfo = new User(GetUserModel(userId)); if (!userId.Equals("")) { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); worm = newLand.g; if (!worm.Equals("0"))//有虫 { for (int j = 0; j < Convert.ToInt32(worm); j++) { result = Spraying(userId, i.ToString()); if (result.Contains("\"farmlandIndex\":" + i.ToString())) { toLog("除掉" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的虫子成功"); saveAch(0, 0, 1, "", "0"); } else { toLog("除掉" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的虫子失败"); } } } } } }
private void LandWater(string userId, JsonObject theFarmStatus) { string dry = ""; string result = ""; User friendInfo = new User(GetUserModel(userId)); if (!userId.Equals("")) { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); dry = newLand.h; if (dry.Equals("0"))//干旱 { result = Water(userId, i.ToString()); if (result.Contains("\"farmlandIndex\":" + i.ToString())) { toLog("对" + friendInfo.userName + "的农场的第" + i.ToString() + "号地浇水成功"); saveAch(1, 0, 0, "", "0"); } else { toLog("对" + friendInfo.userName + "的农场的第" + i.ToString() + "号地浇水失败"); } } } } }
private void LandPlant(string userId, JsonObject theFarmStatus) { string have = ""; string result = ""; User friendInfo = new User(GetUserModel(userId)); CropItem cropInfo = new CropItem(GetCropModel(cId)); if (!userId.Equals("")) { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); have = newLand.b; if (have.Equals("0"))//无植物 { BagItem newBagItem = new BagItem(GetBagItemModel(cId)); if (_autoSeed && (Convert.ToInt32(newBagItem.amount) == 0)) { buySeed(cId, "1"); } else { } result = Plant(cId, userId, i.ToString()); if (result.Contains("\"farmlandIndex\":" + i.ToString()) && result.Contains("\"cId\":" + cId.ToString())) { toLog("往" + friendInfo.userName + "的农场的第" + i.ToString() + "号地种植" + cropInfo.cName + "成功"); } else { toLog("往" + friendInfo.userName + "的农场的第" + i.ToString() + "号地种植" + cropInfo.cName + "失败"); } } } } }
private void LandScaify(string userId, JsonObject theFarmStatus) { string kuwei = ""; string result = ""; User friendInfo = new User(GetUserModel(userId)); //需要判断枯萎时的变量 if (!userId.Equals("")) { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); kuwei = newLand.b;//? if (kuwei.Equals("7"))//无植物? { result = Scarify(userId, i.ToString()); if (result.Contains("\"farmlandIndex\":" + i.ToString())) { toLog("锄掉" + friendInfo.userName + "的农场的第" + i.ToString() + "号地成功"); } else { toLog("锄掉" + friendInfo.userName + "的农场的第" + i.ToString() + "号地失败"); } System.Threading.Thread.Sleep(200); } } } }
private void LandHarvest(string userId, JsonObject theFarmStatus) { string cropStatus = ""; string result = ""; User friendInfo = new User(GetUserModel(userId)); string dogId = ""; string isHungry = ""; dogId = dogJson.GetValue("dogId"); isHungry = dogJson.GetValue("isHungry"); if (!userId.Equals("")) { if (userId.Equals(uIdx)) { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); bool landDogFlag = true; //true表示可偷,false表示不可偷 //自己的地尽管偷 //无狗 无狗粮 /* if (_autoDog) { landDogFlag = (dogId.Equals("0") || isHungry.Equals("1")); toLog(friendInfo.userName + "的农场有狗,不偷"); }*/ if (landDogFlag) { GetCropStatus(out cropStatus, newLand); if (cropStatus.Equals("无") || cropStatus.Equals("已枯萎") || regexMature.IsMatch(cropStatus) || cropStatus.Equals("已摘取")) { } else { result = Harvest(userId, i.ToString()); DoResult doResultItem = new DoResult(result); if (result.Contains("\"farmlandIndex\":" + i.ToString() + ",\"harvest\":")) { toLog("收获" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的" + new CropItem(GetCropModel(newLand.a)).cName + "一共" + doResultItem.harvest + "个"); saveAch(0, 0, 0, newLand.a, doResultItem.harvest); } else { toLog("收获" + friendInfo.userName + "的农场的第" + i.ToString() + "号地失败"); } } } } } else { for (int i = 0; i < theFarmStatus.GetCollection().Count; i++) { Land newLand = new Land(theFarmStatus.GetCollection()[i]); bool landDogFlag = true; //true表示可偷,false表示不可偷 //无狗 无狗粮 if (_autoDog) { landDogFlag = (dogId.Equals("0") || isHungry.Equals("1")); toLog(friendInfo.userName + "的农场有狗,不偷"); } if (landDogFlag) { GetCropStatus(out cropStatus, newLand); if (cropStatus.Equals("无") || cropStatus.Equals("已枯萎") || regexMature.IsMatch(cropStatus) || cropStatus.Equals("已摘取")) { } else { result = Steal(userId, i.ToString()); DoResult doResultItem = new DoResult(result); if (result.Contains("\"farmlandIndex\":" + i.ToString() + ",\"harvest\":")) { toLog("摘取" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的" + new CropItem(GetCropModel(newLand.a)).cName + "一共" + doResultItem.harvest + "个"); saveAch(0, 0, 0, newLand.a, doResultItem.harvest); } else { toLog("摘取" + friendInfo.userName + "的农场的第" + i.ToString() + "号地失败"); } } } } } } }
private string VerifyHtml(string html) { //{"code":0,"direction":"转换ID失败","poptype":3} //{"direction":"系统错误","errorType":"timeOut","poptype":3} if (html == "") return ""; JsonObject model = new JsonObject(html); if (model.GetValue("errorType") != null) { ChangeError(html); string errorType = model.GetValue("errorType"); switch (errorType) { case "validateCode": ChangeInfo(Utils.ConvertUnicodeStringToChinese(model.GetValue("errorContent")) + ",时间:" + DateTime.Now.ToString()); this.Invoke((MethodInvoker)delegate { //是否弹出验证码 if (chbVerify.Checked) { FrmFramVerify framverify = new FrmFramVerify(cookie, _uid); framverify.ShowDialog(this); } else { FrmRest(); } }); break; /* case "session": break; this.Invoke((MethodInvoker)delegate { Dispose(); if (thread1 != null && thread1.IsAlive) thread1.Abort(); if (thread2 != null && thread2.IsAlive) thread2.Abort(); FrmFarmLogin login = new FrmFarmLogin(); login.Show(); }); break;*/ default: if (model.GetValue("errorContent") != null) { ChangeInfo("错误:"+Utils.ConvertUnicodeStringToChinese(model.GetValue("errorContent"))); } ChangeInfo("错误类型:" + Utils.ConvertUnicodeStringToChinese(model.GetValue("errorType"))); break; } return null; } string direction = model.GetValue("direction"); string poptype = model.GetValue("poptype"); if (poptype != null && poptype=="3"&&direction!=null) { ChangeError(html); ChangeInfo("错误:" + direction); return null; } if (direction != null) { ChangeMsg(model); } else { for (int i = 0; i < model.GetCollection().Count; i++) { direction = model.GetCollection()[i].GetValue("direction"); if (direction != null) { ChangeMsg(model.GetCollection()[i]); } else break; } } return html; }
private void AutoRun() { _autosteal = chbSteal.Checked;//摘取 _autoweed = chbClearWeed.Checked;//除草 _autowater = chbWater.Checked;//浇水 _autonorm = chbSpraying.Checked;//杀虫 _autoscarify = chbScarify.Checked;//铲除 _autoplant = chbPlant.Checked;//种植 _autoseed = chbSeed.Checked;//购买 _autobag = chbBag.Checked;//背包 _autodog = chkDog.Checked; if (_status_filter.Count < 1) thread2.Abort(); JsonObject _statusModel = _status_filter.GetJson(0); JsonObject _statusModel_1 = _statusModel.GetJson(0); if (_statusModel_1 == null) thread2.Abort(); _status_filter.Remove(_statusModel); /* 0:1 干旱 1 > 0有手 2:1有草 3:1有虫 */ #region 局部变量 string frienduid = _statusModel_1.Key; JsonObject _friends = _xiaoyoufriends; string url = _statusModel.GetValue("url"); string frienduName = ""; string urlTitle = ""; string _autostealstr = "";//摘取 string _autoweedstr = "";//除草 string _autowaterstr = "";//浇水 string _autonormstr = "";//杀虫 string _autoscarifystr = "";//铲除 string _autoplantstr = "";//种植 switch (url) { case "xiaoyou": _friends = _xiaoyoufriends; urlTitle = "校友"; runUrl = "http://nc.xiaoyou.qq.com"; break; case "qzone": _friends = _qzonefriends; urlTitle = "QQ空间"; runUrl = "http://nc.qzone.qq.com"; break; } #region 查找好友名称 string _msg = ""; if (frienduid != _uid) { for (int i = 0; i < _friends.GetCollection().Count; i++) { if (_friends.GetCollection()[i].GetValue("userId") == frienduid) { frienduName = Utils.ConvertUnicodeStringToChinese(_friends.GetCollection()[i].GetValue("userName")); _msg = "查看 " + urlTitle + " 好友【" + frienduName + "】"; } } } else { _msg = "查看 自己 农场"; } ChangeLBFM(_msg); ChangeTSSL(_msg); #endregion #endregion _statusModel_1 = new JsonObject(_statusModel_1[frienduid]); #region 判断是否需要操作 if (!frienduid.Contains(_uid)) { bool _autorun = false; string _autostr = ""; if (_autowater) { _autostr = _statusModel_1.GetValue("0"); if (_autostr != null && Convert.ToInt32(_autostr) > 0) _autorun = true; } if (_autosteal) { _autostr = _statusModel_1.GetValue("1"); if (_autostr != null && Convert.ToInt64(_autostr)>0) { _autorun = true; //double times = 0; //double durtime = Convert.ToInt64(times + Convert.ToInt64(_autostr)); //if (durtime < now)//成熟 // _autorun = true; } } if (_autoweed) { _autostr = _statusModel_1.GetValue("2"); if (_autostr != null && Convert.ToInt32(_autostr) > 0) _autorun = true; } if (_autonorm) { _autostr = _statusModel_1.GetValue("3"); if (_autostr != null && Convert.ToInt32(_autostr) > 0) _autorun = true; } if (!_autorun) { thread2.Abort(); } } #endregion //加载土地信息 string result = ShowFriend(frienduid, runUrl); JsonObject lands = new JsonObject(result); double nowtime = (DateTime.Now - new DateTime(1970, 1, 1, 8, 0, 0)).TotalSeconds; double servertime = nowtime; if (lands.GetJson("user") != null && lands.GetJson("user").GetJson("healthMode") != null) { if (lands.GetJson("user").GetJson("healthMode").GetValue("serverTime") != null) { servertime = Convert.ToInt32(lands.GetJson("user").GetJson("healthMode").GetValue("serverTime")); } } FarmKey.NetworkDelay = nowtime - servertime; if (lands.GetValue("pf") != null && lands.GetValue("pf") != "1") { if (6 <= DateTime.Now.Hour && DateTime.Now.Hour >= 0) { ChangeLBFM("保护模式"); } } #region 循环 地 for (int j = 0; j < lands.GetCollection("farmlandStatus").GetCollection().Count; j++) { //bool s = false; //double times = 0; /*//if (lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("j").Equals("0")) //{ for (int x = 0; x < _shop.GetCollection().Count; x++) { if (_shop.GetCollection()[x].GetValue("cId").Equals(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("a")))//不是空地 { ChangeLBFM("第" + (j + 1) + "块地种植了【" + Utils.ConvertUnicodeStringToChinese(_shop.GetCollection()[x].GetValue("cName")) + "】"); s = true; times = Convert.ToInt64(_shop.GetCollection()[x].GetValue("growthCycle")); break; } } //} */ #region 是否有庄稼 if (Convert.ToInt32(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("a")) > 0) { //double durtime = Convert.ToInt64(times + Convert.ToInt64(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("b"))); //if (durtime < now)//成熟 string farmlandStatus_b = lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("b"); #region 可摘取判断 if (farmlandStatus_b == "6") { //ChangeLBFM("第" + (j + 1) + "块地成熟"); int farmlandStatus_m = Convert.ToInt32(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("m"));//剩余数 int farmlandStatus_l = Convert.ToInt32(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("l"));//可摘取数 JsonObject farmlandStatus_n = lands.GetCollection("farmlandStatus").GetCollection()[j].GetJson("n");//摘取记录 string ModelRawjson = ""; if (farmlandStatus_n != null) { ModelRawjson = farmlandStatus_n.ToString(); } if (frienduid.Contains(_uid)||(farmlandStatus_m > farmlandStatus_l && (farmlandStatus_n == null || !ModelRawjson.Contains(_uid))))//没有偷过 { if (_autosteal) { ChangeLBFM("第 " + (j+1) + " 块可以采摘,开始摘取..."); bool _rundog = false; #region 查看是否有狗 if (lands.GetJson("dog") != null) { if (lands.GetJson("dog").GetValue("isHungry") == "0") { if (_autodog) { _rundog = true; ChangeLBFM("此好友 有狗..."); } else { ChangeLBFM("未开启-不摘有狗"); } } } #endregion if (frienduid.Contains(_uid)) Harvest(_uid, j.ToString()); else { if (!_rundog) Steal(frienduid, j.ToString()); } //ChangeLBFM("成功摘取..."); } if (_autostealstr != "") _autostealstr += ","; _autostealstr += j.ToString(); } //else //{ // ChangeLBFM("已经摘取或到最低限额,不可摘取"); //} } //else //{ // ChangeLBFM("未成熟,不可摘取"); //} #endregion #region 判断庄稼枯萎 //string farmlandStatus_j = lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("j"); if (farmlandStatus_b == "7")//lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("j").Equals("1")|| { if (_autoscarifystr != "") _autoscarifystr += ","; _autoscarifystr += j.ToString(); } #endregion #region 是否有草判断 //除草 f代表有几棵草 0为没有 k为产量,为0时即尚未成熟 成熟的植物不长草的 if (!lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("f").Equals("0") && lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("k").Equals("0")) { ChangeLBFM("第 " + (j + 1) + " 块地有草,开始除草..."); for (int x = 0; x < Convert.ToInt32(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("f")); x++) { if (_autoweed || frienduid.Contains(_uid)) { //ChangeLBFM("第 " + _autoweedstr + " 块地有草,开始除草..."); ClearWeed(frienduid, j.ToString() ); // ChangeLBFM("第 " + _autoweedstr + " 块地 除草成功"); } if (_autoweedstr != "") _autoweedstr += ","; _autoweedstr += j.ToString(); //ClearWeed(frienduid, j.ToString()); } //ChangeLBFM("第 " + (j + 1) + " 块地 除草成功"); } #endregion #region 是否需浇水 if (!lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("h").Equals("1"))//浇水 { ChangeLBFM("第 " + (j + 1) + " 块地干燥,开始浇水..."); if (_autowater || frienduid.Contains(_uid)) { // ChangeLBFM("第 " + _autowaterstr + " 块地干燥,开始浇水..."); Water(frienduid, j.ToString()); } if (_autowaterstr != "") _autowaterstr += ","; _autowaterstr += j.ToString(); //Water(frienduid, j.ToString()); //ChangeLBFM("第 " + (j + 1) + " 块地 浇水成功"); } #endregion #region 是否需杀虫 if (!lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("g").Equals("0") && lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("k").Equals("0"))//杀虫 g代表有几条虫 0为没有 k为产量,为0时即尚未成熟 成熟的植物不长虫的 { ChangeLBFM("第 " + (j + 1) + " 块地有虫,开始杀虫..."); for (int x = 0; x < Convert.ToInt32(lands.GetCollection("farmlandStatus").GetCollection()[j].GetValue("g")); x++) { if (_autonorm || frienduid.Contains(_uid)) { //ChangeLBFM("第 " + _autonormstr + " 块地有虫,开始杀虫..."); Spraying(frienduid, j.ToString()); //ChangeLBFM("第 " + _autonormstr + " 块地 杀虫成功"); } if (_autonormstr != "") _autonormstr += ","; _autonormstr += j.ToString(); // Spraying(frienduid, j.ToString()); } //ChangeLBFM("第 " + (j + 1) + " 块地 杀虫成功"); } #endregion } else { if (frienduid.Contains(_uid)) { if (_autoplantstr != "") _autoplantstr += ","; _autoplantstr += j.ToString(); } } #endregion } #endregion #region 摘取 if (_autostealstr != "") { if (_autosteal || frienduid.Contains(_uid)) { /* ChangeLBFM("第 " + _autostealstr + " 块可以采摘,开始摘取..."); bool _rundog = false; #region 查看是否有狗 if (lands.GetJson("dog") != null) { if (lands.GetJson("dog").GetValue("isHungry") == "0") { if (_autodog) { _rundog = true; ChangeLBFM("此好友 有狗..."); } else { ChangeLBFM("未开启-不摘有狗"); } } } #endregion if (frienduid.Contains(_uid)) Harvest(_uid, _autostealstr); else { if (!_rundog) Steal(frienduid, _autostealstr); } */ //ChangeLBFM("成功摘取..."); } else { ChangeLBFM("未开启自动摘取"); } } #endregion #region 除草 if (_autoweedstr != "" ) { if (_autoweed || frienduid.Contains(_uid)) { //ChangeLBFM("第 " + _autoweedstr + " 块地有草,开始除草..."); //ClearWeed(frienduid, _autoweedstr); // ChangeLBFM("第 " + _autoweedstr + " 块地 除草成功"); } else { ChangeLBFM("未开启自动除草"); } } #endregion #region 浇水 if (_autowaterstr != "" ) { if (_autowater || frienduid.Contains(_uid)) { /* ChangeLBFM("第 " + _autowaterstr + " 块地干燥,开始浇水..."); Water(frienduid, _autowaterstr); */ } else { ChangeLBFM("未开启自动浇水"); } } #endregion #region 杀虫 if (_autonormstr != "" ) { if (_autonorm || frienduid.Contains(_uid)) { ChangeLBFM("第 " + _autonormstr + " 块地有虫,开始杀虫..."); Spraying(frienduid, _autonormstr); //ChangeLBFM("第 " + _autonormstr + " 块地 杀虫成功"); } else { ChangeLBFM("未开启自动杀虫"); } } #endregion #region 铲除 if (_autoscarifystr != "") { if (frienduid.Contains(_uid)) { if (_autoscarify) { ChangeLBFM("第 " + _autoscarifystr + " 块地枯萎,开始翻地..."); Scarify(frienduid, _autoscarifystr); _autoplantstr = _autoscarifystr; //ChangeLBFM("第 " + _autonormstr + " 块地 杀虫成功"); } else { ChangeLBFM("未开启自动翻地"); } } } #endregion #region 种植 if (_autoplantstr != "") { if (_autoplant) { if (frienduid.Contains(_uid)) { ChangeLBFM("第 " + _autoplantstr + " 块地是空地"); string[] plantIds = _autoplantstr.Split(','); int plantIdsIndex = 0; int number = 0; string key = ""; string value = ""; Hashtable plantht = new Hashtable(); if (_autobag) { JsonObject bag = new JsonObject(GetBag()); ChangeLBFM("开始查看背包..."); for (int y = 0; y < bag.GetCollection().Count; y++) { if (plantIdsIndex >= plantIds.Length) break; if (bag.GetCollection()[y].GetValue("type").Equals("1")) { key = bag.GetCollection()[y].GetValue("cId"); value = ""; if (plantht.ContainsKey(key)) { value = plantht[key].ToString(); plantht.Remove(key); } for (int ount = 0; ount < Convert.ToInt32(bag.GetCollection()[y].GetValue("amount")); ount++) { if (plantIdsIndex >= plantIds.Length) break; if (value != "") value += ",";//amount value += plantIds[plantIdsIndex]; plantIds[plantIdsIndex] = null; plantIdsIndex++; } plantht.Add(key, value); } } } else { ChangeLBFM("未开启查看背包"); } key = "Seed"; for (int n = 0; n < plantIds.Length; n++) { if (plantIds[n] != null) { value = ""; if (plantht.ContainsKey(key)) { value = plantht[key].ToString(); plantht.Remove(key); } if (value != "") value += ","; value += plantIds[n]; plantht.Add(key, value); number++; } } if (plantht.ContainsKey(key)) { value = plantht[key].ToString(); plantht.Remove(key); if (_autoplant) { key = GetShopLv(); if (key != null) { ChangeLBFM("开始购买 " + Utils.NoHTML(Utils.ConvertUnicodeStringToChinese(GetShopModel(key).GetValue("cName"))) + " " + number + "个"); Seed(_uid, key, number); plantht.Add(key, value); } else { ChangeLBFM("没有同一等级的种子"); } } else { ChangeLBFM("未开启自动购买"); } } foreach (DictionaryEntry plant in plantht) { ChangeLBFM("开始种地..."); Plant(plant.Key.ToString(), _uid, plant.Value.ToString()); } } } else { ChangeLBFM("未开启自动种植"); } #endregion } thread2.Abort(); }
/// <summary> /// 获取可操作的用户 /// </summary> private void statusFilter() { BindUserInfo(); ChangeTSSL("正在获取获取可操作的用户列表..."); ChangeLBFM(); string farmtime = GetFarmTime(); string Url = ""; string urlNum = ""; string post = ""; string result = ""; JsonObject _model_1 = new JsonObject("\"" + _uid + "\":{\"1\":1}"); if (_model_1.ToString().Contains(_uid)) { addStatus(_model_1, "qzone"); } Url = xiaoyouUrl; urlNum = "/cgi-bin/cgi_farm_getstatus_filter?cmd=1"; post = "friend%5Fuids=" + HttpUtility.UrlEncode(_xiaoyoufriendsIds) + "&farmTime=" + farmtime + "&farmKey=" + GetFarmKey(farmtime) + "&uIdx=" + _uid; result = GetHtml(Url + urlNum, post, true, cookie); model = new JsonObject(result); model = model.GetJson("status"); for (int i = 0; i < model.GetCollection().Count; i++) { _model_1 = model.GetCollection()[i]; addStatus(_model_1, "xiaoyou"); } farmtime = GetFarmTime(); Url = qzoneUrl; post = "friend%5Fuids=" + HttpUtility.UrlEncode(_qzonefriendsIds + "," + _uid) + "&farmTime=" + farmtime + "&farmKey=" + GetFarmKey(farmtime) + "&uIdx=" + _uid; result = GetHtml(Url + urlNum, post, true, cookie); model = new JsonObject(result); model = model.GetJson("status"); for (int i = 0; i < model.GetCollection().Count; i++) { _model_1 = model.GetCollection()[i]; addStatus(_model_1, "qzone"); } ChangeTSSL("获取获取可操作的用户列表完成"); }
/// <summary> /// 获取所有好友 /// </summary> private void ListFriends() { string url = "http://happyfarm.xiaoyou.qq.com/api.php?mod=friend"; string result = GetHtml(url, cookie); this._xiaoyoufriends = new JsonObject(result); for (int i = 0; i < _xiaoyoufriends.GetCollection().Count; i++) { if (_xiaoyoufriendsIds != "") _xiaoyoufriendsIds += ","; _xiaoyoufriendsIds += _xiaoyoufriends.GetCollection()[i].GetValue("userId"); } url = "http://happyfarm.qzone.qq.com/api.php?mod=friend"; result = GetHtml(url, cookie); this._qzonefriends = new JsonObject(result); for (int i = 0; i < _qzonefriends.GetCollection().Count; i++) { if (_qzonefriendsIds != "") _qzonefriendsIds += ","; _qzonefriendsIds += _qzonefriends.GetCollection()[i].GetValue("userId"); } }