/// <summary> /// 将 Json.JsonObject 元素添加到 Json.JsonObject中 /// </summary> /// <param name="json"></param> public void Add(JsonObject json) { Insert(null, json.ToString(), true); }
/// <summary> /// 从 Json.JsonObject 中移除带有指定键的元素 /// </summary> /// <param name="JsonObject"></param> public void Remove(JsonObject json) { if (isModel==false) { return; } int statsIndex = rawjson.IndexOf(json.ToString());//key的位置 if (statsIndex < 0) return; string jsonq = rawjson.Substring(0, statsIndex); statsIndex = statsIndex + json.ToString().Length;//key的长度 加 :的长度 引号长度 string jsonh = rawjson.Substring(statsIndex, rawjson.Length - statsIndex); bool requ = true; if (jsonh.StartsWith(",") && requ) { jsonh = jsonh.Substring(1); requ = false; } if (jsonq.EndsWith(",") && requ) jsonq = jsonq.Substring(0, jsonq.Length - 1); rawjson = jsonq + jsonh; }
/// <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("获取获取可操作的用户列表完成"); }