Example #1
0
        //ͬ��http����
        public string SyncRequest(string url, string httpMethod, OauthKey key, List<Parameter> listParam, List<Parameter> listFile)
        {
            Oauth oauth = new Oauth();

            string queryString = null;
            string oauthUrl = oauth.GetOauthUrl(url, httpMethod, key.customKey, key.customSecret,
                key.tokenKey, key.tokenSecret, key.verify, key.callbackUrl, listParam, out queryString);

            SyncHttp http = new SyncHttp();
            if (httpMethod == "GET")
            {
                return http.HttpGet(oauthUrl, queryString);
            }
            else if ((listFile == null) || (listFile.Count == 0))
            {
                return http.HttpPost(oauthUrl, queryString);
            }
            else
            {
                return http.HttpPostWithFile(oauthUrl, queryString, listFile);
            }
        }
Example #2
0
        //�첽http����
        public bool AsyncRequest(string url, string httpMethod, OauthKey key, List<Parameter> listParam, List<Parameter> listFile,
            AsyncRequestCallback callback, out int callbkey)
        {
            Oauth oauth = new Oauth();

            string queryString = null;
            string oauthUrl = oauth.GetOauthUrl(url, httpMethod, key.customKey, key.customSecret,
                key.tokenKey, key.tokenSecret, key.verify, key.callbackUrl, listParam, out queryString);

            AsyncHttp http = new AsyncHttp();

            callbkey = GetKey();
            CallbackInfo callbackInfo = new CallbackInfo();
            callbackInfo.key = callbkey;
            callbackInfo.callback = callback;

            asyncRquestMap.Add(http, callbackInfo);

            bool bResult = false;

            if (httpMethod == "GET")
            {
                bResult = http.HttpGet(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback));
            }
            else if ((listFile == null) || (listFile.Count == 0))
            {
                bResult = http.HttpPost(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback));
            }
            else
            {
                bResult = http.HttpPostWithFile(oauthUrl, queryString, listFile, new AsyncHttpCallback(HttpCallback));
            }

            if (!bResult)
            {
                asyncRquestMap.Remove(http);
            }
            return bResult;
        }
Example #3
0
 /// <summary>
 /// 构造函数 <see cref="user"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public user(OauthKey okey, string format)
     : base(okey, format)
 {
 }
Example #4
0
 /// <summary> 时间线相关
 /// 构造函数<see cref="statuses"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public statuses(OauthKey okey, string format)
     : base(okey, format)
 {
 }
Example #5
0
 /// <summary>
 /// 构造函数<see cref="trends"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public trends(OauthKey okey, string format)
     : base(okey, format)
 {
 }
Example #6
0
 public QWeiboApiBase(OauthKey authkey, string format)
 {
     this.oauthkey = authkey;
     this.format = format;
 }
Example #7
0
 /// <summary> 数据收藏类的 构造函数
 ///  <see cref="fav"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public fav(OauthKey okey, string format)
     : base(okey, format)
 {
 }
Example #8
0
 /// <summary>数据更新相关 
 /// 构造函数 <see cref="info"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public info(OauthKey okey, string format)
     : base(okey, format)
 {
 }
Example #9
0
 /// <summary> 搜索相关 需要 合作伙伴权限
 /// 构造函数 <see cref="search"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public search(OauthKey okey, string format)
     : base(okey, format)
 {
 }