コード例 #1
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);
        }
コード例 #2
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);
            }
        }
コード例 #3
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;
        }
コード例 #4
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));
            }
        }
コード例 #5
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            textOutput.Text = "";

            List<Parameter> parameters = new List<Parameter>();
            OauthKey oauthKey = new OauthKey();
            oauthKey.customKey = appKey;
            oauthKey.customSecret = appSecret;
            oauthKey.tokenKey = accessKey;
            oauthKey.tokenSecret = accessSecret;

            bool getMethod = comboMethod.SelectedIndex == 0 ? true : false;

            /*http���������name������*/
            List<string> arryName = new List<string>();
            /*http���������value������*/
            List<string> arryValue = new List<string>();

            listViewHeader.GetColumnItem(1, arryName);
            listViewHeader.GetColumnItem(2, arryValue);

            /*����listview�õ���value����utf8����,�������������б�*/

            string ret;
            UTF8Encoding utf8 = new UTF8Encoding();
            if (0 == comboMethod.SelectedIndex)
            {
              statuses st = new statuses(oauthKey, "json");

              ret = st.home_timeline(Convert.ToInt32(arryValue[0]),
                                 Convert.ToInt32(arryValue[1]),
                                 Convert.ToInt32(arryValue[2]));
            }
            else
            {
                t twit = new t(oauthKey, "json");

               ret = twit.add_pic(utf8.GetString(utf8.GetBytes(arryValue[0])),
                             utf8.GetString(utf8.GetBytes(arryValue[1])),
                             utf8.GetString(utf8.GetBytes(arryValue[2])),
                             utf8.GetString(utf8.GetBytes(arryValue[3])),
                             utf8.GetString(utf8.GetBytes(arryValue[4]))
                            );

              //  ret = twit.add_pic("xxxx","127.0.0.1","","","E:\abc.jpg");
            }

            textOutput.Text = ret;
        }
コード例 #6
0
 /// <summary>构造函数 
 /// <see cref="friends"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public friends(OauthKey okey, string format)
     : base(okey, format)
 {
 }
コード例 #7
0
ファイル: user.cs プロジェクト: zhangchangyun1234/highwayns
 /// <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)
 {
 }
コード例 #8
0
 /// <summary>构造函数
 /// <see cref="friends"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public friends(OauthKey okey, string format) : base(okey, format)
 {
 }
コード例 #9
0
 /// <summary> 私信相关
 /// 构造函数 <see cref="@private"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public @private(OauthKey okey, string format) : base(okey, format)
 {
 }
コード例 #10
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)
 {
 }
コード例 #11
0
ファイル: tag.cs プロジェクト: zhangchangyun1234/highwayns
 /// <summary>
 /// 构造函数 <see cref="tag"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public tag(OauthKey okey, string format) : base(okey, format)
 {
 }
コード例 #12
0
ファイル: QQLogin.aspx.cs プロジェクト: noikiy/lihongtu
    private void Send()
    {
        string strRet = "";
        List<QWeiboSDK.Parameter> parameters = new List<QWeiboSDK.Parameter>();
        OauthKey oauthKey = new OauthKey();
        oauthKey.customKey = strAppKey;
        oauthKey.customSecret = strAppSecret;
        oauthKey.tokenKey = Session["accessToken"].ToString();
        oauthKey.tokenSecret = Session["accessSecret"].ToString();


    }
コード例 #13
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)
 {
 }
コード例 #14
0
ファイル: info.cs プロジェクト: zhangchangyun1234/highwayns
 /// <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)
 {
 }
コード例 #15
0
 public QWeiboApiBase(OauthKey authkey, string format)
 {
     this.oauthkey = authkey;
     this.format   = format;
 }
コード例 #16
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)
 {
 }
コード例 #17
0
 /// <summary> 私信相关
 /// 构造函数 <see cref="@private"/> class.
 /// </summary>
 /// <param name="okey">The okey.</param>
 /// <param name="format">The format.</param>
 /// <remarks></remarks>
 public @private(OauthKey okey, string format)
     : base(okey, format)
 {
 }
コード例 #18
0
ファイル: statuses.cs プロジェクト: yxandam/BabyPlan
 /// <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)
 {
 }
コード例 #19
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)
 {
 }
コード例 #20
0
ファイル: QQLogin.aspx.cs プロジェクト: noikiy/lihongtu
    private bool GetAccessToken(string customerKey, string customerSecret, string requestToken, string requestTokenSecrect, string verify)
    {
        string url = "https://open.t.qq.com/cgi-bin/access_token";
        List<QWeiboSDK.Parameter> parameters = new List<QWeiboSDK.Parameter>();

        OauthKey oauthKey = new OauthKey();
        oauthKey.customKey = customerKey;

        oauthKey.customSecret = customerSecret;

        oauthKey.tokenKey = requestToken;

        oauthKey.tokenSecret = requestTokenSecrect;

        oauthKey.verify = verify;

        QWeiboRequest request = new QWeiboRequest();

        return ParseToken(request.SyncRequest(url, "GET", oauthKey, parameters, null));

    }
コード例 #21
0
 public QWeiboApiBase(OauthKey authkey, string format)
 {
     this.oauthkey = authkey;
     this.format = format;
 }
コード例 #22
0
ファイル: QQLogin.aspx.cs プロジェクト: noikiy/lihongtu
    private bool GetRequestToken(string customerKey, string customerSecret)
    {
        string url = "https://open.t.qq.com/cgi-bin/request_token";
        List<QWeiboSDK.Parameter> parameters = new List<QWeiboSDK.Parameter>();
        OauthKey oauthKey = new OauthKey();
        oauthKey.customKey = customerKey;
        oauthKey.customSecret = customerSecret;
        oauthKey.callbackUrl = ConfigurationManager.AppSettings["CallbackUrl_QQ"];       //"http://localhost:20595";
        QWeiboRequest request = new QWeiboRequest();

        return ParseToken(request.SyncRequest(url, "GET", oauthKey, parameters, null));

    }
コード例 #23
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)
 {
 }
コード例 #24
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)
 {
 }
コード例 #25
0
        private bool GetRequestToken(string customKey, string customSecret)
        {
            string url = "https://open.t.qq.com/cgi-bin/request_token";
            List<Parameter> parameters = new List<Parameter>();
            OauthKey oauthKey = new OauthKey();
            oauthKey.customKey = customKey;
            oauthKey.customSecret = customSecret;
            oauthKey.callbackUrl = "http://www.qq.com";

            QWeiboRequest request = new QWeiboRequest();
            return ParseToken(request.SyncRequest(url, "GET", oauthKey, parameters, null));
        }