Inheritance: ContentItem
コード例 #1
0
        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 GetOffPicAction(IQQContext context, QQActionListener listener,
     OffPicItem offpic, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     _offpic = offpic;
     _msg = msg;
     _picOut = picOut;
 }
コード例 #3
0
ファイル: GetOffPicAction.cs プロジェクト: NitroXenon/iQQ.Net
        public GetOffPicAction(QQContext context, QQActionEventHandler listener,
            OffPicItem offpic, QQMsg msg, Stream picOut)
            : base(context, listener)
        {

            this.offpic = offpic;
            this.msg = msg;
            this.picOut = picOut;
        }
コード例 #4
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            Regex rex = new Regex(QQConstants.REGXP_JSON_SINGLE_RESULT);
            Match m = rex.Match(response.GetResponseString());

            OffPicItem pic = new OffPicItem();
            JObject obj = null;

            if (!m.Success)
            {
                pic.IsSuccess = false;
                NotifyActionEvent(QQActionEventType.EVT_ERROR,
                        new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.GetResponseString()));
            }

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

            int 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.EVT_OK, pic);
                return;
            }

            // 失败后返回路径
            pic.FilePath = file;
            pic.IsSuccess = false;
            NotifyActionEvent(QQActionEventType.EVT_ERROR,
                    new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.GetResponseString()));

        }
コード例 #5
0
ファイル: ChatModule.cs プロジェクト: huoshan12345/iQQ.Net
 public IQQActionFuture GetOffPic(OffPicItem offpic, QQMsg msg, Stream picout, QQActionListener listener)
 {
     return PushHttpAction(new GetOffPicAction(Context, listener, offpic, msg, picout));
 }