Esempio n. 1
0
 public bool getUserinfo()
 {
     try
     {
         client = new CBB.OAuth.RenRen.RenrenApiClient(
             platform.ApiKey,
             platform.ApiKeySecret,
             platform.RequestTokenUri,
             platform.CallbackUrl,
             platform.ACCESS_TOKEN,
             platform.APIUrl,
             platform.SessionUrl);
         string responseData = client.CallMethod("users.getInfo");
         if (responseData == "") return false;
         OAuth_Token = System.Web.HttpContext.Current.Session["accessToken"].ToString();
         OAuth_Token_Secret = System.Web.HttpContext.Current.Session["sessionKey"].ToString();
         JArray arr = JArray.Parse(responseData);
         if (arr.Count < 1) return false;
         JObject obj = arr[0] as JObject;
         this.ConnectID = obj["uid"].ToString();
         this.Sex = obj["sex"].ToString();
         this.ICONPath = obj["tinyurl"].ToString();
         this.Name = obj["name"].ToString();
         Enable = true;
     }
     catch
     {
         return false;
     }
     return true;
 }
Esempio n. 2
0
        public override string Connect(String addparams)
        {
            this.PlatformType = Platform.RenRen;
            client = new CBB.OAuth.RenRen.RenrenApiClient(
                platform.ApiKey,
                platform.ApiKeySecret,
                platform.RequestTokenUri,
                platform.CallbackUrl + addparams,
                platform.ACCESS_TOKEN,
                platform.APIUrl,
                platform.SessionUrl);

            client.GetAuthorizationCode();
            return "true";
        }
Esempio n. 3
0
        public string sendcontent(string url, string content, string picurl)
        {
            client = new CBB.OAuth.RenRen.RenrenApiClient(
                platform.ApiKey,
                platform.ApiKeySecret,
                platform.RequestTokenUri,
                platform.CallbackUrl,
                OAuth_Token_Secret,
                platform.APIUrl,
                platform.SessionUrl);

            System.Web.HttpContext.Current.Session["accessToken"] = OAuth_Token;
            System.Web.HttpContext.Current.Session["sessionKey"] = OAuth_Token_Secret;

            string title = content.Length > 20 ? content.Substring(0, 20) + ".." : content;
            List<CBB.OAuth.RenRen.APIUtility.APIParameter> paraList = new List<CBB.OAuth.RenRen.APIUtility.APIParameter>();
            paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("method", "feed.publish"));
            paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("template_id", "1"));
            paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("title_data", "{\"title\":\"" + title + "\",\"content\":\"" + content + "\"}"));
            paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("body_data", "{\"title\":\"" + title + "\",\"content\":\"" + content + "\"}"));
            paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("desc", content));
            if (picurl != "")
            {
                paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("attachment", "{\"src\":\"" + picurl + "\",\"href\":\"" + picurl + "\"}"));
            }
            if (content != "")
            {
                paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("action_links", "{\"href\":\"" + url + "\",\"text\":\"" + content + "\"}"));
            }
            else
            {
                paraList.Add(new CBB.OAuth.RenRen.APIUtility.APIParameter("action_links", "{\"href\":\"" + url + "\",\"text\":\"米柚\"}"));
            }

            string responseData = client.CallMethod(paraList);

            return responseData;
        }