public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var rex = new Regex(QQConstants.REGXP_JSON_SINGLE_RESULT);
            var str = response.GetResponseString();
            var m = rex.Match(str);
            if (!m.Success) throw new QQException(QQErrorCode.UnexpectedResponse, str);

            var pic = new OffPicItem();
            var regResult = Regex.Replace(Regex.Replace(m.Groups[0].Value, "[\\r]?[\\n]", " "), "[\r]?[\n]", " ");
            var obj = JObject.Parse(regResult);

            var retcode = obj["retcode"].ToObject<int>();
            if (retcode == 0)
            {
                pic.IsSuccess = (obj["progress"].ToObject<int>() == 100) ? true : false;
                pic.FileSize = obj["filesize"].ToObject<int>();
                pic.FileName = obj["filename"].ToString();
                pic.FilePath = obj["filepath"].ToString();
                NotifyActionEvent(QQActionEventType.EvtOK, pic);
                return;
            }

            // 失败后返回路径
            pic.FilePath = _file;
            pic.IsSuccess = false;
            throw new QQException(QQErrorCode.UnexpectedResponse, str);
        }
예제 #2
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var rex = new Regex(QQConstants.REGXP_LOGIN);
            var m = rex.Match(response.GetResponseString());
            if (m.Success)
            {
                var ret = m.Groups[1].Value;
                switch (ret)
                {
                    //case "0": NotifyActionEvent(QQActionEventType.EVT_OK, m.Groups[3].Value); break;
                    //case "66": throw new QQException(QQErrorCode.QRCODE_OK, m.Groups[5].Value);
                    //case "67": throw new QQException(QQErrorCode.QRCODE_AUTH, m.Groups[5].Value);
                    case "0": NotifyActionEvent(QQActionEventType.EvtOK, new CheckQRCodeArgs(QRCodeStatus.QRCODE_OK, m.Groups[3].Value)); break;
                    case "66": NotifyActionEvent(QQActionEventType.EvtOK, new CheckQRCodeArgs(QRCodeStatus.QRCODE_VALID, m.Groups[5].Value)); break;
                    case "67": NotifyActionEvent(QQActionEventType.EvtOK, new CheckQRCodeArgs(QRCodeStatus.QRCODE_AUTH, m.Groups[5].Value)); break;
                    case "65":NotifyActionEvent(QQActionEventType.EvtOK, new CheckQRCodeArgs(QRCodeStatus.QRCODE_INVALID, m.Groups[5].Value)); break;

                    default: throw new QQException(QQErrorCode.InvalidUser, m.Groups[5].Value);
                }
            }
            else
            {
                throw new QQException(QQErrorCode.UnexpectedResponse);
            }
        }
예제 #3
0
        public virtual void OnHttpFinish(QQHttpResponse response)
        {
            try
            {
                string type = response.GetContentType() ?? "";
                if ((type.StartsWith("application/x-javascript")
                        || type.StartsWith("application/json")
                        || type.Contains("text")
                        ) && response.GetContentLength() > 0)
                {
                    MyLogger.Default.Debug(response.GetResponseString());
                }

                if (response.ResponseCode == QQHttpResponse.S_OK)
                {
                    OnHttpStatusOK(response);
                }
                else
                {
                    OnHttpStatusError(response);
                }
            }
            catch (QQException e)
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, e);
            }
            catch (JsonException e)
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.JSON_ERROR, e));
            }
            catch (Exception e)
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNKNOWN_ERROR, e));
            }
        }
예제 #4
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var json = JObject.Parse(response.GetResponseString());

            if (json["retcode"].ToString() == "0")
            {
                var result = json["result"].ToObject<JArray>();
                for (var index = 0; index < result.Count; index++)
                {   //结果获取;
                    var info = new QQGroupSearchInfo();
                    var ret = result[index].ToObject<JObject>();
                    info.GroupId = ret["GE"].ToObject<long>();  //真实的QQ号
                    info.OwerId = ret["QQ"].ToObject<long>();
                    info.GroupName = ret["TI"].ToString();
                    info.CreateTimeStamp = ret["RQ"].ToObject<long>();  //QQ群创建时间,时间戳形式;
                    info.GroupAliseId = ret["GEX"].ToObject<long>();
                }
            }
            if (json["retcode"].ToString() == "100110") //需要验证码
            {
                this._buddy.NeedVfcode = true;

            }
            NotifyActionEvent(QQActionEventType.EvtOK, _buddy);
        }
예제 #5
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            //{"retcode":0,"result":{"dnamelist":[{"did":3536443553,"name":"\u8FD9\u662F\u6807\u9898"},
            //{"did":625885728,"name":""}],"dmasklist":[{"did":1000,"mask":0}]}}

            JObject json = JObject.Parse(response.GetResponseString());
            QQStore store = Context.Store;
            if (json["retcode"].ToString() == "0")
            {
                JObject result = json["result"].ToObject<JObject>();
                JArray dizlist = result["dnamelist"].ToObject<JArray>();
                for (int i = 0; i < dizlist.Count; i++)
                {
                    QQDiscuz discuz = new QQDiscuz();
                    JObject dizjson = dizlist[i].ToObject<JObject>();
                    discuz.Did = dizjson["did"].ToObject<long>();
                    discuz.Name = dizjson["name"].ToString();
                    store.AddDiscuz(discuz);
                }
                NotifyActionEvent(QQActionEventType.EVT_OK, store.GetDiscuzList());
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE));
            }
        }
예제 #6
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            //{"retcode":0,"result":{"uin":236557647,"cip":1991953329,"index":1075,"port":51494,"status":"online","vfwebqq":"41778677efd86bae2ed575eea02349046a36f3f53298a34b97d75297ec1e67f6ee5226429daa6aa7","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133332e342e31373200005b9200000549016e04004f95190e6d0000000a4052347371696a62724f6d0000002841778677efd86bae2ed575eea02349046a36f3f53298a34b97d75297ec1e67f6ee5226429daa6aa7","user_state":0,"f":0}}

            var str = response.GetResponseString();
            var json = JObject.Parse(str);
            var session = Context.Session;
            var account = Context.Account;
            var retcode = json["retcode"].ToString();
            if (retcode == "0")
            {
                var ret = json["result"].ToObject<JObject>();
                account.Uin = ret["uin"].ToObject<long>();
                account.QQ = ret["uin"].ToObject<long>();
                session.SessionId = ret["psessionid"].ToString();
                // session.Vfwebqq = ret["vfwebqq"].ToString();
                account.Status = QQStatus.ValueOfRaw(ret["status"].ToString());
                session.State = QQSessionState.Online;
                session.Index = ret["index"].ToObject<int>();
                session.Port = ret["port"].ToObject<int>();
                NotifyActionEvent(QQActionEventType.EvtOK, null);
            }
            else
            {
                //var msg = $"errmsg: {json["errmsg"] ?? ""}, retcode: {retcode}";
                //NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.INVALID_RESPONSE, msg));	//TODO ..
                throw new QQException(QQErrorCode.UnexpectedResponse, str);
            }
        }
예제 #7
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());
            if (json["retcode"].ToString() == "0")
            {
                json = json["result"].ToObject<JObject>();

                // 消除所有成员状态,如果不在线的,webqq是不会返回的。
                foreach (QQGroupMember member in group.Members)
                {
                    member.Status = QQStatus.OFFLINE;
                    member.ClientType = QQClientType.UNKNOWN;
                }

                //result/stats
                JArray stats = json["stats"].ToObject<JArray>();
                for (int i = 0; i < stats.Count; i++)
                {
                    // 下面重新设置最新状态
                    JObject stat = stats[i].ToObject<JObject>();
                    QQGroupMember member = group.GetMemberByUin(stat["uin"].ToObject<long>());
                    if (member != null)
                    {
                        member.ClientType = QQClientType.ValueOfRaw(stat["client_type"].ToObject<int>());
                        member.Status = QQStatus.ValueOfRaw(stat["stat"].ToObject<int>());
                    }
                }

                NotifyActionEvent(QQActionEventType.EVT_OK, group);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, QQErrorCode.UNEXPECTED_RESPONSE);
            }
        }
예제 #8
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     var str = response.ResponseString;
     var json = JObject.Parse(str);
     var store = Context.Store;
     if (json["retcode"].ToString() == "0")
     {
         var result = json["result"].ToObject<JArray>();
         foreach (var token in result)
         {
             var obj = token.ToObject<JObject>();
             var uin = obj["uin"].ToObject<long>();
             var status = obj["status"].ToString();
             var clientType = obj["client_type"].ToObject<int>();
             var buddy = store.GetBuddyByUinOrAdd(uin);
             buddy.Status = QQStatus.ValueOfRaw(status);
             buddy.ClientType = QQClientTypeInfo.ValueOfRaw(clientType);
         }
         NotifyActionEvent(QQActionEventType.EvtOK, null);
     }
     else
     {
         throw new QQException(QQErrorCode.InvalidResponse, str);
     }
 }
예제 #9
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            // {'ret':0,'msg':'5F7E31F0001EF4310865F1FF4549B12B.jPg'}
            Regex rex = new Regex(QQConstants.REGXP_JSON_SINGLE_RESULT);
            Match m = rex.Match(response.GetResponseString());
            CFaceItem pic = new CFaceItem();
            JObject obj = null;
            if (m.Success)
            {
                try
                {
                    string regResult = Regex.Replace(Regex.Replace(m.Groups[0].Value, "[\\r]?[\\n]", " "), "[\r]?[\n]", " ");
                    obj = JObject.Parse(regResult);

                    int retcode = obj["ret"].ToObject<int>();
                    if (retcode == 0)
                    {
                        pic.IsSuccess = true;
                        pic.FileName = obj["msg"].ToString();
                        NotifyActionEvent(QQActionEventType.EVT_OK, pic);

                        Context.Store.AddPicItem(pic);
                        return;
                    }
                    else if (retcode == 4)
                    {
                        // {'ret':4,'msg':'D81AB7A7627ED673FDCD4DD24220C192.jPg
                        // -6102 upload cface failed'}
                        string prefix = "\"msg\":\"";
                        string suffix = ".jPg";

                        rex = new Regex(prefix + "([\\s\\S]*)" + suffix, RegexOptions.IgnoreCase);
                        m = rex.Match(obj.ToString());

                        if (m.Success)
                        {
                            string r = Regex.Replace(m.Groups[0].Value, prefix, "");
                            //LOG.debug("ret 4: " + r);
                            pic.IsSuccess = true;
                            pic.FileName = r;
                            NotifyActionEvent(QQActionEventType.EVT_OK, pic);
                            return;
                        }
                    }
                    else
                    {
                        MyLogger.Default.Debug($"ret: {retcode}");
                    }
                }
                catch (Exception e)
                {
                    MyLogger.Default.Warn(e.Message, e);
                }
            }
            // 失败后返回路径
            pic.FileName = file;
            pic.IsSuccess = false;
            NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE, "CFace: " + response.GetResponseString()));
        }
예제 #10
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());
            if (json["retcode"].ToString() == "0")
            {
                JObject obj = json["result"].ToObject<JObject>();
                buddy.QQ = obj["account"].ToObject<long>();
            }

            NotifyActionEvent(QQActionEventType.EVT_OK, buddy);
        }
예제 #11
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var json = JObject.Parse(response.GetResponseString());
            if (json["retcode"].ToString() == "0")
            {
                var result = json["result"].ToObject<JArray>();
                var obj = result[0].ToObject<JObject>();
                _buddy.Sign = obj["lnick"].ToString();
            }

            NotifyActionEvent(QQActionEventType.EvtOK, _buddy);
        }
예제 #12
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     var json = JObject.Parse(response.GetResponseString());
     if (json["retcode"].ToString() == "0")
     {
         NotifyActionEvent(QQActionEventType.EvtOK, _user);
     }
     else
     {
         NotifyActionEvent(QQActionEventType.EvtError, new QQException(QQErrorCode.UnexpectedResponse));
     }
 }
예제 #13
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());
            if (json["retcode"].ToString() == "0")
            {
                NotifyActionEvent(QQActionEventType.EVT_OK, user);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE));
            }

        }
예제 #14
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     // ({msg : "new successful",rbkey : "1391255617",status : "false"})
     string ct = response.GetResponseString();
     if (ct.Contains("success"))
     {
         NotifyActionEvent(QQActionEventType.EVT_OK, ct);
     }
     else
     {
         NotifyActionEvent(QQActionEventType.EVT_ERROR, ct);
     }
 }
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     // {"result":null,"retcode":0}
     var json = JObject.Parse(response.GetResponseString());
     if (json["retcode"].ToString() == "0")
     {
         NotifyActionEvent(QQActionEventType.EvtOK, Context.Store.GetGroupList());
     }
     else
     {
         NotifyActionEvent(QQActionEventType.EvtError, QQErrorCode.UnexpectedResponse);
     }
 }
예제 #16
0
 public override void OnHttpFinish(QQHttpResponse response)
 {
     //如果返回的内容为空,认为这次PollMsg仍然成功
     if (response.GetContentLength() == 0)
     {
         // LOG.debug("PollMsgAction: empty response!!!!");
         NotifyActionEvent(QQActionEventType.EVT_OK, new List<QQNotifyEvent>());
     }
     else
     {
         base.OnHttpFinish(response);
     }
 }
예제 #17
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());
            List<object> recents = new List<object>();
            QQStore store = Context.Store;
            if (json["retcode"].ToString() == "0")
            {
                JArray result = json["result"].ToObject<JArray>();
                for (int i = 0; i < result.Count; i++)
                {
                    JObject rejson = result[i].ToObject<JObject>();
                    switch (rejson["type"].ToObject<int>())
                    {
                        case 0:
                        {	//好友
                            QQBuddy buddy = store.GetBuddyByUin(rejson["uin"].ToObject<long>());
                            if (buddy != null)
                            {
                                recents.Add(buddy);
                            }
                            break;
                        }

                        case 1:
                        {	//群
                            QQGroup group = store.GetGroupByCode(rejson["uin"].ToObject<long>());
                            if (group != null)
                            {
                                recents.Add(group);
                            }
                            break;
                        }

                        case 2:
                        {	//讨论组
                            QQDiscuz discuz = store.GetDiscuzByDid(rejson["uin"].ToObject<long>());
                            if (discuz != null)
                            {
                                recents.Add(discuz);
                            }
                            break;
                        }
                    }
                }
                NotifyActionEvent(QQActionEventType.EVT_OK, recents);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE));
            }
        }
예제 #18
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var json = JObject.Parse(response.GetResponseString());
            var account = Context.Account;
            if (json["retcode"].ToString() == "0")
            {
                var obj = json["result"].ToObject<JObject>();
                try
                {
                    account.Birthday = DateUtils.Parse(obj["birthday"].ToObject<JObject>());
                }
                catch (Exception e)
                {
                    Context.Logger.LogWarning($"日期转换失败:{obj["birthday"]}", e);
                    account.Birthday = null;
                }

                account.Occupation = obj["occupation"].ToString();
                account.Phone = obj["phone"].ToString();
                account.Allow = (QQAllow) obj["allow"].ToObject<int>();
                account.College = obj["college"].ToString();
                account.RegTime = obj["reg_time"]?.ToObject<int>() ?? 0;
                account.Uin = obj["uin"].ToObject<long>();
                account.Constel = obj["constel"].ToObject<int>();
                account.Blood = obj["blood"].ToObject<int>();
                account.Homepage = obj["homepage"].ToString();
                account.Stat = obj["stat"]?.ToObject<int>() ?? 0;
                account.Sign = obj["lnick"].ToString();
                account.VipLevel = obj["vip_info"].ToObject<int>(); // VIP等级 0为非VIP
                account.Country = obj["country"].ToString();
                account.City = obj["city"].ToString();
                account.Personal = obj["personal"].ToString();
                account.Nickname = obj["nick"].ToString();
                account.ChineseZodiac = obj["shengxiao"].ToObject<int>();
                account.Email = obj["email"].ToString();
                account.Province = obj["province"].ToString();
                account.Gender = obj["gender"].ToString();
                account.Mobile = obj["mobile"].ToString();
                account.Vfwebqq = obj["vfwebqq"].ToString(); // 重要
                var clientType = obj["client_type"];
                if (clientType != null)
                {
                    account.ClientType = QQClientTypeInfo.ValueOfRaw(clientType.ToString());
                }
                NotifyActionEvent(QQActionEventType.EvtOK, account);
            }
            else
            {
                throw new QQException(QQErrorCode.InvalidResponse, response.ResponseString);
            }
        }
예제 #19
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var json = JObject.Parse(response.GetResponseString());
            var recents = new List<object>();
            var store = Context.Store;
            if (json["retcode"].ToString() == "0")
            {
                var result = json["result"].ToObject<JArray>();
                for (var i = 0; i < result.Count; i++)
                {
                    var rejson = result[i].ToObject<JObject>();
                    switch (rejson["type"].ToObject<int>())
                    {
                        case 0:
                        {	//好友
                            var buddy = store.GetBuddyByUin(rejson["uin"].ToObject<long>());
                            if (buddy != null)
                            {
                                recents.Add(buddy);
                            }
                            break;
                        }

                        case 1:
                        {	//群
                            var group = store.GetGroupByCode(rejson["uin"].ToObject<long>());
                            if (group != null)
                            {
                                recents.Add(group);
                            }
                            break;
                        }

                        case 2:
                        {	//讨论组
                            var discuz = store.GetDiscuzByDid(rejson["uin"].ToObject<long>());
                            if (discuz != null)
                            {
                                recents.Add(discuz);
                            }
                            break;
                        }
                    }
                }
                NotifyActionEvent(QQActionEventType.EvtOK, recents);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EvtError, new QQException(QQErrorCode.UnexpectedResponse));
            }
        }
예제 #20
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            // {"retcode":0,"result":{"gmasklist":[{"gid":1000,"mask":0},{"gid":1638195794,"mask":0},{"gid":321105219,"mask":0}],
            // "gnamelist":[{"flag":16777217,"name":"iQQ","gid":1638195794,"code":2357062609},{"flag":1048577,"name":"iQQ核心开发区","gid":321105219,"code":640215156}],"gmarklist":[]}}
            QQStore store = Context.Store;
            JObject json = JObject.Parse(response.GetResponseString());

            int retcode = json["retcode"].ToObject<int>();
            if (retcode == 0)
            {
                // 处理好友列表
                JObject results = json["result"].ToObject<JObject>();
                JArray groupJsonList = results["gnamelist"].ToObject<JArray>();	// 群列表

                // 禁止接收群消息标志:正常 0, 接收不提醒 1, 完全屏蔽 2
                JArray groupMaskJsonList = results["gmasklist"].ToObject<JArray>();

                foreach (JToken t in groupJsonList)
                {
                    JObject groupJson = t.ToObject<JObject>();
                    QQGroup group = new QQGroup();
                    group.Gin = groupJson["gid"].ToObject<long>();
                    group.Code = groupJson["code"].ToObject<long>();
                    group.Flag = groupJson["flag"].ToObject<int>();
                    group.Name = groupJson["name"].ToString();
                    //添加到Store
                    store.AddGroup(group);
                }

                foreach (JToken t in groupMaskJsonList)
                {
                    JObject maskObj = t.ToObject<JObject>();
                    long gid = maskObj["gid"].ToObject<long>();
                    int mask = maskObj["mask"].ToObject<int>();
                    QQGroup group = store.GetGroupByGin(gid);
                    if (group != null)
                    {
                        group.Mask = mask;
                    }
                }

                NotifyActionEvent(QQActionEventType.EVT_OK, store.GetGroupList());

            }
            else
            {
                // LOG.warn("unknown retcode: " + retcode);
                NotifyActionEvent(QQActionEventType.EVT_ERROR, null);
            }

        }
예제 #21
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            // {'ret':0,'msg':'5F7E31F0001EF4310865F1FF4549B12B.jPg'}
            var rex = new Regex(QQConstants.REGXP_JSON_SINGLE_RESULT);
            var str = response.GetResponseString();
            var m = rex.Match(str);
            var pic = new CFaceItem();
            if (m.Success)
            {
                var regResult = Regex.Replace(Regex.Replace(m.Groups[0].Value, "[\\r]?[\\n]", " "), "[\r]?[\n]", " ");
                var obj = JObject.Parse(regResult);

                var retcode = obj["ret"].ToObject<int>();
                if (retcode == 0)
                {
                    pic.IsSuccess = true;
                    pic.FileName = obj["msg"].ToString();
                    NotifyActionEvent(QQActionEventType.EvtOK, pic);

                    Context.Store.AddPicItem(pic);
                    return;
                }
                else if (retcode == 4)
                {
                    // {'ret':4,'msg':'D81AB7A7627ED673FDCD4DD24220C192.jPg
                    // -6102 upload cface failed'}
                    var prefix = "\"msg\":\"";
                    var suffix = ".jPg";

                    rex = new Regex(prefix + "([\\s\\S]*)" + suffix, RegexOptions.IgnoreCase);
                    m = rex.Match(obj.ToString());

                    if (m.Success)
                    {
                        var r = Regex.Replace(m.Groups[0].Value, prefix, "");
                        //LOG.debug("ret 4: " + r);
                        pic.IsSuccess = true;
                        pic.FileName = r;
                        NotifyActionEvent(QQActionEventType.EvtOK, pic);
                        return;
                    }
                }
                else
                {
                    Context.Logger.LogDebug($"ret: {retcode}");
                }
            }

            throw new QQException(QQErrorCode.UnexpectedResponse, "CFace: " + str);
        }
예제 #22
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     var json = JObject.Parse(response.GetResponseString());
     if (json["retcode"].ToString() == "0")
     {
         Context.Account.Status = _status;
         NotifyActionEvent(QQActionEventType.EvtOK, _status);
     }
     else
     {
         // NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.GetResponseString()));
         throw new QQException(QQErrorCode.UnexpectedResponse, response.GetResponseString());
     }
 }
예제 #23
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     MemoryStream ms = new MemoryStream(response.ResponseData); // 输入流
     Image image = null;
     try
     {
         image = Image.FromStream(ms);
         user.Face = image;
     }
     catch (IOException e)
     {
         throw new QQException(QQErrorCode.IO_ERROR, e);
     }
     NotifyActionEvent(QQActionEventType.EVT_OK, user);
 }
예제 #24
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     // ({msg : "new successful",rbkey : "1391255617",status : "false"})
     var str = response.GetResponseString();
     // LOG.info("delete email: " + ct);
     if (str.Contains("success"))
     {
         NotifyActionEvent(QQActionEventType.EvtOK, str);
     }
     else
     {
         // NotifyActionEvent(QQActionEventType.EVT_ERROR, str);
         throw new QQException(QQErrorCode.UnexpectedResponse, str);
     }
 }
예제 #25
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     string resp = response.GetResponseString();
     resp = resp.Substring(1, resp.Length - 1);
     JObject json = JObject.Parse(resp);
     if (json["k"] != null)
     {
         NotifyActionEvent(QQActionEventType.EVT_OK, json["k"].ToString());
     }
     else
     {
         NotifyActionEvent(QQActionEventType.EVT_ERROR, QQErrorCode.UNEXPECTED_RESPONSE);
     }
     // System.out.println("GetWPKeyAction: " + response.GetResponseString());
 }
예제 #26
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     JObject json = JObject.Parse(response.GetResponseString());
     int retcode = json["retcode"].ToObject<int>();
     if (retcode == 0)
     {
         string result = json["result"].ToString();
         if (result.Equals("ok"))
         {
             NotifyActionEvent(QQActionEventType.EVT_OK, msg);
             return;
         }
     }
     NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE, JsonConvert.SerializeObject(json)));
 }
예제 #27
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     var resp = response.GetResponseString();
     resp = resp.Substring(1, resp.Length - 1);
     var json = JObject.Parse(resp);
     if (json["k"] != null)
     {
         NotifyActionEvent(QQActionEventType.EvtOK, json["k"].ToString());
     }
     else
     {
         NotifyActionEvent(QQActionEventType.EvtError, QQErrorCode.UnexpectedResponse);
     }
     // System.out.println("GetWPKeyAction: " + response.GetResponseString());
 }
예제 #28
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());
            string isOK = json["result"].ToString().ToLower();
            if (json["retcode"].ToString() == "0")
            {
                if (isOK.Equals("ok"))
                {
                    NotifyActionEvent(QQActionEventType.EVT_OK, isOK);
                    return;
                }
            }

            NotifyActionEvent(QQActionEventType.EVT_ERROR, isOK);
        }
예제 #29
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            Regex rex = new Regex(QQConstants.REGXP_EMAIL_AUTH);
            Match m = rex.Match(response.GetResponseString());

            if (m.Success)
            {
                string qqHex = m.Groups[2].Value;
                NotifyActionEvent(QQActionEventType.EVT_OK, qqHex);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR,
                        new QQException(QQErrorCode.INVALID_LOGIN_AUTH));
            }
        }
예제 #30
0
 public override void OnHttpStatusOK(QQHttpResponse response)
 {
     var str = response.GetResponseString();
     var json = JObject.Parse(str);
     if (json["retcode"].ToString() == "0")
     {
         var ret = json["result"].ToObject<JObject>();
         Context.Session.Vfwebqq = ret["vfwebqq"].ToString();
         NotifyActionEvent(QQActionEventType.EvtOK, null);
     }
     else
     {
         // NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.INVALID_RESPONSE));    //TODO ..
         throw new QQException(QQErrorCode.InvalidResponse, str);
     }
 }