Esempio n. 1
0
 private void btnTestASync_Click(object sender, EventArgs e)
 {
     try
     {
         BeefWrapNet net = new BeefWrapNet();
         this.tokenRWAsync = NetUtility.GetNextToken();
         // 异步请求
         net.HttpPostRequestAsync(url + @"/app", this.tokenRWAsync, new RequestPreCallBack(RequestPreRWAsync), new RequestWriteCallBack(RequestWriteRWAsync), new ResponseReadCallBack(ResponseReadRWAsync), new MessageCallBack(MessageRWAsync));
     }
     catch { }
 }
Esempio n. 2
0
 private void btnDownLoad_Click(object sender, EventArgs e)
 {
     this.btnDownLoad.Enabled = false;
     this.progressBar1.Value = 0;
     try
     {
         BeefWrapNet net = new BeefWrapNet();
         this.tokenDownLoad = NetUtility.GetNextToken();
         // 异步下载
         net.HttpGetRequestAsync(picUrl, this.tokenDownLoad, null, null, new ResponseReadCallBack(ResponseReadDownLoad), new MessageCallBack(MessageDownLoad));
     }
     catch { }
     this.btnDownLoad.Enabled = true;
 }
Esempio n. 3
0
        /// <summary>
        /// HlrSync
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool HlrSync(string mobile, out Result result)
        {
            string name = string.Format("{0}_HlrSync_{1}", Command.C_COMMON_HLR_SYNC_REQUEST, mobile);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenHlrSync = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}HlrSync?mobile={1}", this.RequestAddress, mobile);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenHlrSync, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenHlrSync.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 4
0
        /// <summary>
        /// AppCatalog
        /// </summary>
        /// <param name="appCatalogParentId"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool AppCatalog(string appCatalogParentId, out Result result)
        {
            string name = string.Format("{0}_AppCatalog_{1}", Command.C_APP_CATALOG_REQUEST, appCatalogParentId);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenAppCatalog = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}AppCatalog?appCatalogParentId={1}", this.RequestAddress, appCatalogParentId);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAppCatalog, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAppCatalog.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 5
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="albumName"></param>
        /// <param name="description"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Add(string albumName, string description, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenAdd = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}addUserAlbumInfo?passport={1}&albumName={2}&description={3}", this.RequestAddress, passport, albumName, description);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 6
0
        /// <summary>
        /// PhotoView
        /// </summary>
        /// <param name="photoId"></param>
        /// <param name="albumId"></param>
        /// <param name="curPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotoView(string photoId, string albumId, int curPage, int pageSize, string passport, out Result result)
        {
            string nameBase = string.Format("{0}_PhotoView_{1}_{2}_{3}", Command.C_ALBUM_PHOTO_VIEW_REQUEST, passport, photoId, albumId);
            string name = string.Format("{0}_{1}_{2}", nameBase, curPage, pageSize);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenPhotoView = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}getUserPhotoInfo?passport={1}photoId={2}&albumId={3}&curPage={4}&pageSize={5}", this.RequestAddress, passport, photoId, albumId, curPage, pageSize);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotoView, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotoView.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (curPage == 1)
                    {
                        DeleteCacheLike(nameBase);
                    }
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 7
0
        /// <summary>
        /// PhotosDel
        /// </summary>
        /// <param name="photoIds"></param>
        /// <param name="albumId"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotosDel(string photoIds, string albumId, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenPhotosDel = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}deleteUserPhotoInfo?passport={1}&photoIds={2}&albumId={3}", this.RequestAddress, passport, photoIds, albumId);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotosDel, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotosDel.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 8
0
        /// <summary>
        /// PhotoAdd
        /// </summary>
        /// <param name="photoDescription"></param>
        /// <param name="photoName"></param>
        /// <param name="mime"></param>
        /// <param name="oriFileName"></param>
        /// <param name="photoData"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotoAdd(string photoDescription, string photoName,string mime,string oriFileName,string photoData, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenPhotoAdd = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}addUserPhotoInfo?photoDescription={1}photoName&={2}mime&={3}oriFileName&={4}photoData&={5}passport={6}", this.RequestAddress, photoDescription, photoName, mime, oriFileName, photoData, passport);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotoAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotoAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 9
0
        /// <summary>
        /// CommentAdd
        /// </summary>
        /// <param name="photoId"></param>
        /// <param name="commentContent"></param>
        /// <param name="commentTime"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool CommentAdd(string photoId, string commentContent, string commentTime, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenCommentAdd = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}addUserPhotoComment?passport={1}&photoId={2}&commentContent={3}&commentTime={4}", this.RequestAddress, passport, photoId, commentContent, commentTime);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenCommentAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenCommentAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 10
0
        /// <summary>
        /// UserMsgsReply
        /// </summary>
        /// <param name="usermsgId"></param>
        /// <param name="usermsgReplying"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool UserMsgsReply(string usermsgId, string usermsgReplying, out Result result)
        {
            string name = string.Format("{0}_UserMsgsReply_{1}_{2}", Command.C_USERMSG_REPLY_REQUEST, usermsgId, usermsgReplying);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenUserMsgsReply = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}UserMsgsReply?usermsgId={1}&usermsgReplying={2}", this.RequestAddress, usermsgId, usermsgReplying);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenUserMsgsReply, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenUserMsgsReply.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 11
0
        /// <summary>
        /// Exist
        /// </summary>
        /// <param name="email"></param>
        /// <param name="mobile"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Exist(string email, string mobile, out Result result)
        {
            // 读缓存
            string name = string.Format("{0}_Exist_{1}_{2}", Command.C_USER_EXIST_CHECK_REQUEST, email, mobile);
            if (ReadCache(name, out result))
            {
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenExist = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}Exist?email={1}&mobile={2}", this.RequestAddress, email, mobile);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenExist, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenExist.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            result = resultTmp;
            if (null == result)
            {
                result = new Result();
            }
            return boolRtn;
        }
Esempio n. 12
0
        /// <summary>
        /// InfoUpdate
        /// </summary>
        /// <param name="sex"></param>
        /// <param name="age"></param>
        /// <param name="nickname"></param>
        /// <param name="homePageUrl"></param>
        /// <param name="note"></param>
        /// <param name="contryId"></param>
        /// <param name="privenceId"></param>
        /// <param name="cityId"></param>
        /// <param name="districtId"></param>
        /// <param name="streetId"></param>
        /// <param name="photo"></param>
        /// <param name="homeTel"></param>
        /// <param name="workTel"></param>
        /// <param name="otherTel"></param>
        /// <param name="fax"></param>
        /// <param name="otherEmail"></param>
        /// <param name="homeArea"></param>
        /// <param name="workArea"></param>
        /// <param name="otherArea"></param>
        /// <param name="qq"></param>
        /// <param name="msn"></param>
        /// <param name="otherIm"></param>
        /// <param name="brithday"></param>
        /// <param name="org"></param>
        /// <param name="title"></param>
        /// <param name="ring"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool InfoUpdate(string sex, int age, string nickname, string homePageUrl, string note, string contryId, string privenceId, string cityId, string districtId, string streetId, string photo, string homeTel, string workTel, string otherTel, string fax, string otherEmail, string homeArea, string workArea, string otherArea, string qq, string msn, string otherIm, string brithday, string org, string title, string ring, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenInfoUpdate = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}InfoUpdate?sex={1}&age={2}&nickname={3}&homePageUrl={4}&note={5}&contryId={6}&privenceId={7}&cityId={8}&districtId={9}&streetId={10}&photo={11}&homeTel={13}&workTel={14}&otherTel={15}&fax={16}&otherEmail={17}&&homeArea={18}&workArea={19}&otherArea={20}&qq={21}&msn={22}&otherIm={23}&brithday={24}&org={25}&title={26}&ring={27}", this.RequestAddress, sex, age, nickname, homePageUrl, note, contryId, privenceId, cityId, districtId, streetId, photo, homeTel, workTel, otherTel, fax, otherEmail, homeArea, workArea, otherArea, qq, msn, otherIm, brithday, org, title, ring);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenInfoUpdate, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenInfoUpdate.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 13
0
        /// <summary>
        /// SysAlertsReceive
        /// </summary>
        /// <param name="email"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool SysAlertsReceive(string email, out Result result)
        {
            string name = string.Format("{0}_SysAlertsReceive_{1}", Command.C_SYS_ALERTS_RECEIVE_REQUEST, email);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenSysAlertsReceive = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}SysAlertsReceive?email={1}", this.RequestAddress, email);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenSysAlertsReceive, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenSysAlertsReceive.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 14
0
 private void btnUpFile_Click(object sender, EventArgs e)
 {
     this.btnUpFile.Enabled = false;
     this.progressBar1.Value = 0;
     try
     {
         BeefWrapNet net = new BeefWrapNet();
         this.tokenUp = NetUtility.GetNextToken();
         // 异步上传
         net.HttpPostRequestAsync(upUrl, this.tokenUp, new RequestPreCallBack(RequestPreUp), new RequestWriteCallBack(RequestWriteUp), null, new MessageCallBack(MessageUp));
     }
     catch { }
     this.btnUpFile.Enabled = true;
 }
Esempio n. 15
0
        /// <summary>
        /// SignatureUpdate
        /// </summary>
        /// <param name="email"></param>
        /// <param name="signature"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool SignatureUpdate(string email, string signature, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenSignatureUpdate = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}SignatureUpdate?email={1}&signature={2}", this.RequestAddress, email, signature);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenSignatureUpdate, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenSignatureUpdate.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 16
0
        /// <summary>
        /// Register
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="imei"></param>
        /// <param name="email"></param>
        /// <param name="pwd"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Register(string mobile, string imei, string email, string pwd, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenRegister = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}Register?mobile={1}&imei={2}&email={3}&pwd={4}", this.RequestAddress, mobile, imei, email, pwd);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenRegister, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenRegister.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 17
0
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="email"></param>
        /// <param name="pwd"></param>
        /// <param name="expires"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Login(string email, string pwd, int expires, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenLogin = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}Login?email={1}&pwd={2}&expires={3}", this.RequestAddress, email, pwd, expires);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenLogin, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenLogin.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 18
0
        /// <summary>
        /// LocateSync
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="mcc"></param>
        /// <param name="mnc"></param>
        /// <param name="lac"></param>
        /// <param name="cid"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool LocateSync(string mobile, string mcc, string mnc, string lac, string cid, out Result result)
        {
            string name = string.Format("{0}_LocateSync_{1}_{2}_{3}_{4}_{5}", Command.C_USER_LOCATE_SYNC_REQUEST, mobile, mcc, mnc, lac, cid);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenLocateSync = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}LocateSync?mobile={1}&mcc={2}&mnc={3}&lac={4}&cid={5}", this.RequestAddress, mobile, mcc, mnc, lac, cid);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenLocateSync, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenLocateSync.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 19
0
        /// <summary>
        /// UserMsgsDel
        /// </summary>
        /// <param name="usermsgIds"></param>
        /// <param name="srcEmail"></param>
        /// <param name="distEmail"></param>
        /// <param name="email"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool UserMsgsDel(string usermsgIds, string srcEmail, string distEmail, string email, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenUserMsgsDel = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}UserMsgsDel?usermsgIds={1}&srcEmail={2}&distEmail={3}&email={4}", this.RequestAddress, usermsgIds, srcEmail, distEmail, email);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenUserMsgsDel, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenUserMsgsDel.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 20
0
 private void btnTestSync_Click(object sender, EventArgs e)
 {
     this.btnTestSync.Enabled = false;
     try
     {
         BeefWrapNet net = new BeefWrapNet();
         this.tokenRW = NetUtility.GetNextToken();
         // 同步请求
         net.HttpPostRequest(url + @"/app", this.tokenRW, new RequestPreCallBack(RequestPreRW), new RequestWriteCallBack(RequestWriteRW), new ResponseReadCallBack(ResponseReadRW), new MessageCallBack(MessageRW));
     }
     catch { }
     this.btnTestSync.Enabled = true;
 }
Esempio n. 21
0
        /// <summary>
        /// InnerMsgPictureSend
        /// </summary>
        /// <param name="innermsgPictures"></param>
        /// <param name="innermsgNo"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool InnerMsgPictureSend(string innermsgPictures, string innermsgNo, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();
            tokenInnerMsgPictureSend = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}InnerMsgPictureSend?innermsgPictures={1}&innermsgNo={2}", this.RequestAddress, innermsgPictures, innermsgNo);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenInnerMsgPictureSend, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenInnerMsgPictureSend.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }
Esempio n. 22
0
        /// <summary>
        /// AppHotList
        /// </summary>
        /// <param name="curPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool AppHotList(int curPage, int pageSize, out Result result)
        {
            string nameBase = string.Format("{0}_AppHotList", Command.C_APP_HOT_LIST_REQUEST);
            string name = string.Format("{0}_{1}_{2}", nameBase, curPage, pageSize);
            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return true;
            }

            BeefWrapNet net = new BeefWrapNet();
            tokenAppHotList = NetUtility.GetNextToken();

            // 同步请求
            string url = string.Format("{0}AppHotList?curPage={1}&pageSize={2}", this.RequestAddress, curPage, pageSize);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAppHotList, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAppHotList.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (curPage == 1)
                    {
                        DeleteCacheLike(nameBase);
                    }
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return boolRtn;
        }