• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Authentication.oAuthTwitter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GlobusTwitterLib.Authentication.oAuthTwitter的典型用法代码示例。如果您正苦于以下问题:C# oAuthTwitter类的具体用法?C# oAuthTwitter怎么用?C# oAuthTwitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



oAuthTwitter类属于GlobusTwitterLib.Authentication命名空间,在下文中一共展示了oAuthTwitter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: getTwitterData

        public void getTwitterData(object UserId)
        {
            try
            {
                Guid userId = (Guid)UserId;
                oAuthTwitter OAuth = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
                TwitterAccountRepository objTwtRepo = new TwitterAccountRepository();

                ArrayList arrTwtAcc = objTwtRepo.getAllTwitterAccountsOfUser(userId);
                foreach (TwitterAccount itemTwt in arrTwtAcc)
                {
                    OAuth.AccessToken = itemTwt.OAuthToken;
                    OAuth.AccessTokenSecret = itemTwt.OAuthSecret;

                    getUserProile(OAuth, itemTwt.TwitterUserId, userId);
                    getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                    getUserFeed(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:25,代码来源:TwitterData.cs


示例2: FollowersStatus

 /// <summary>
 /// This Method Get All Followers Details of User
 /// </summary>
 /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">User Screen Name</param>
 /// <returns></returns>
 public XmlDocument FollowersStatus(oAuthTwitter oAuth, string ScreenName, string cursor)
 {
     string RequestUrl = Globals.FollowerStatusUrl + ScreenName + ".xml?cursor=" + cursor;
     string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:Users.cs


示例3: FriendsId

 /// <summary>
 /// This Method Will Get All Friends Id of User  
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">ScreenName Of Whom You Want To Get FriendsId</param>
 /// <returns>All Friends Id</returns>
 public XmlDocument FriendsId(oAuthTwitter OAuth, string ScreenName, SortedDictionary<string, string> strdic)
 {
     string RequestUrl = Globals.FriendsIdUrl + ScreenName;
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,strdic);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:SocialGraph.cs


示例4: PostScheduleMessage

        public override void PostScheduleMessage(dynamic data)
        {
            try
            {

                oAuthTwitter OAuthTwt = new oAuthTwitter();
                TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
                TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);


                OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
                OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
                OAuthTwt.ConsumerKeySecret = System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;


                #region For Testing
                // For Testing 

                //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                //OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7";
                //OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5";
                //OAuthTwt.TwitterScreenName = "";
                //OAuthTwt.TwitterUserId = ""; 
                #endregion

                TwitterUser twtuser = new TwitterUser();

                if (string.IsNullOrEmpty(data.ShareMessage))
                {
                    data.ShareMessage = "There is no data in Share Message !";
                }

                JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);

                
             
                Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
                ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
                schrepo.updateMessage(data.Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Log log = new Log();
                log.CreatedDate = DateTime.Now;
                log.Exception = ex.Message;
                log.Id = Guid.NewGuid();
                log.ModuleName = "TwitterScheduler";
                log.ProfileId = data.ProfileId;
                log.Status = false;
                LogRepository logRepo = new LogRepository();
                logRepo.AddLog(log);
            }

        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:60,代码来源:TwitterScheduler.cs


示例5: Rate_Limit_Status

        //#region OAuth
        ///// <summary>
        ///// This Method Will Check That User is Authenticated Or Not Using OAUTH
        ///// </summary>
        ///// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        ///// <returns>Return Xml Text With User Details</returns>
        //public XmlDocument Verify_Credentials(oAuthTwitter OAuth)
        //{
        //    string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, String.Empty);
        //    xmlResult.Load(new StringReader(response));
        //    return xmlResult;
        //}

        /// <summary>
        /// This method Will Check Rate Limit Of Account Using OAUTH
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <returns>Return Xml Text With User Details</returns>
        public XmlDocument Rate_Limit_Status(oAuthTwitter OAuth, SortedDictionary<string, string> strdic)
        {
            
            string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.RateLimitStatusUrl, strdic);
            xmlResult.Load(new StringReader(response));
            return xmlResult;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:25,代码来源:Account.cs


示例6: SearchMethodForTwtUser

 public JObject SearchMethodForTwtUser(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchTwtUserUrl + SearchKey + "&page=" + pageindex;
     JObject response = objTwitterWebRequest.PerformWebRequest(RequestUrl, "GET");
     return response;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:7,代码来源:Search.cs


示例7: FollowersId

 /// <summary>
 /// This Method Will Get All Followers Id of User  
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">ScreenName Of Whom You Want To Get Followers Id</param>
 /// <returns>All Followers Id</returns>
 public XmlDocument FollowersId(oAuthTwitter OAuth, string ScreenName)
 {
     string RequestUrl = Globals.FollowersIdUrl + ScreenName;
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:SocialGraph.cs


示例8: FollowAccount

        public static bool FollowAccount(string AccessToken,string AccessTokenSecret ,string Screen_name, string user_id) 
        {
            bool IsFollowed = false;
            oAuthTwitter oauth = new oAuthTwitter();

            oauth.AccessToken = AccessToken;
            oauth.AccessTokenSecret = AccessTokenSecret;
            oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
            oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
            string RequestUrl = "https://api.twitter.com/1.1/friendships/create.json";
            SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
            if (!string.IsNullOrEmpty(Screen_name)) 
            {
                strdic.Add("screen_name", Screen_name);
            }
            else if (!string.IsNullOrEmpty(user_id))
            {
                strdic.Add("user_id", user_id);
            }
            else 
            {
                return false;
            }
            strdic.Add("follow", "true");
            string response = oauth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
            if (!string.IsNullOrEmpty(response)) 
            {
                IsFollowed = true;
            }
            return IsFollowed;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:31,代码来源:TwitterHelper.cs


示例9: PostScheduleMessage

        public override void PostScheduleMessage(dynamic data)
        {
            try
            {

                oAuthTwitter OAuthTwt = new oAuthTwitter();
                TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
                TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);
                OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
                OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
                OAuthTwt.ConsumerKeySecret= System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                OAuthTwt.AccessTokenSecret= twtaccount.OAuthSecret;
                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                TwitterUser twtuser = new TwitterUser();
                JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);

                Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
                ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
                schrepo.updateMessage(data.Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:26,代码来源:TwitterScheduler.cs


示例10: SearchMethod

 /// <summary>
 /// This Method Will Get All Trends Of Twitter Using OAUTH
 /// </summary>
 /// <param name="User">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Json Text Of Trends</returns>
 public XmlDocument SearchMethod(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchUrl + SearchKey + "&page=" + pageindex; 
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl,string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:Search.cs


示例11: Verify_Credentials

 /// <summary>
 /// This Method Will Check That User is Authenticated Or Not Using OAUTH
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Return Xml Text With User Details</returns>
 public JArray Verify_Credentials(oAuthTwitter OAuth)
 {
     SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, strdic);
     //xmlResult.Load(new StringReader(response));
     if (!response.StartsWith("["))
         response = "[" + response + "]";
     return JArray.Parse(response);
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:14,代码来源:Account.cs


示例12: Post_Statuses_DestroyById

 /// <summary>
 /// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public JArray Post_Statuses_DestroyById(oAuthTwitter oAuth, string UserId)
 {
     SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
     string RequestUrl = Globals.StatusDestroyByIdUrl + UserId + ".json";
     string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
     if (!response.StartsWith("["))
         response = "[" + response + "]";
     return JArray.Parse(response);
 } 
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:15,代码来源:Tweet.cs


示例13: AuthenticateTwitter

        public void AuthenticateTwitter(object sender, EventArgs e)
        {
            oAuthTwitter OAuth = new oAuthTwitter();

            if (Request["oauth_token"] == null)
            {
                OAuth.AccessToken = string.Empty;
                OAuth.AccessTokenSecret = string.Empty;
                OAuth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                Response.Redirect(OAuth.AuthorizationLinkGet());
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:12,代码来源:Publishing.aspx.cs


示例14: Verify_Credentials

 /// <summary>
 /// This Method Will Check That User Is Authenticatde Or Not
 /// </summary>
 /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Return True If User Is Authenticated</returns>
 public bool Verify_Credentials(oAuthTwitter oAuth)
 {
     Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
     JArray obj = account.Verify_Credentials(oAuth);
    // XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
     foreach (var item in obj)
     {
         //XmlElement idElement = (XmlElement)xmlNode;
         //twitterUser.UserID = idElement.GetElementsByTagName("id")[0].InnerText;
         return true;
     }
     return false;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:18,代码来源:TwitterUserController.cs


示例15: CheckTwitterToken

 public bool CheckTwitterToken(oAuthTwitter objoAuthTwitter, string txtvalue)
 {
     bool CheckTwitterToken = false;
     //oAuthTwitter oAuthTwt = new oAuthTwitter();
     Users twtUser = new Users();
     try
     {
         JArray twtuserjson = twtUser.Get_Users_Search(objoAuthTwitter, txtvalue, "5");
         CheckTwitterToken = true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return CheckTwitterToken;
 }
开发者ID:utkarshx,项目名称:socioboard,代码行数:16,代码来源:AjaxHelper.aspx.cs


示例16: AuthenticateTwitter

        public void AuthenticateTwitter(object sender, EventArgs e)
        {
            TwitterHelper twthelper = new TwitterHelper();
            string twtredirecturl = twthelper.TwitterRedirect(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
            Response.Redirect(twtredirecturl);

            oAuthTwitter OAuth = new oAuthTwitter();

            if (Request["oauth_token"] == null)
            {
                OAuth.AccessToken = string.Empty;
                OAuth.AccessTokenSecret = string.Empty;
                OAuth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                this.TwitterOAuth.HRef = OAuth.AuthorizationLinkGet();
                Response.Redirect(OAuth.AuthorizationLinkGet());
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:17,代码来源:Home.aspx.cs


示例17: FollowersCount

 public int FollowersCount(oAuthTwitter oAuth, string screenname, SortedDictionary<string, string> strdic)
 {
     string RequestUrl = "https://api.twitter.com/1/users/lookup.xml?screen_name=" + screenname;
     string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, strdic);
     
     
     
     xmlResult.Load(new StringReader(response));
     TwitterUser twtUser = new TwitterUser();
     XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
     int count = 0;
     foreach (XmlNode xn in xmlNodeList)
     {
         XmlElement idElement = (XmlElement)xn;
         count = Convert.ToInt32(idElement.GetElementsByTagName("followers_count")[0].InnerText);
     }
     return count;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:18,代码来源:Users.cs


示例18: GetTwitterFeedsAPI

 public void GetTwitterFeedsAPI(string UserId, string TwitterId)
 {
     try
     {
         Guid userId = Guid.Parse(UserId);
         UserRepository userrepo = new UserRepository();
         TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
         TwitterAccount twtAcc = twtAccRepo.getUserInformation(userId, TwitterId);
         oAuthTwitter oAuth = new oAuthTwitter();
         oAuth.AccessToken = twtAcc.OAuthToken;
         oAuth.AccessTokenSecret = twtAcc.OAuthSecret;
         oAuth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
         oAuth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
         oAuth.TwitterUserId = twtAcc.TwitterUserId;
         oAuth.TwitterScreenName = twtAcc.TwitterScreenName;
         TwitterHelper twtHelper = new TwitterHelper();
         twtHelper.getUserFeed(oAuth, twtAcc, userId);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
开发者ID:utkarshx,项目名称:socioboard,代码行数:23,代码来源:TwitterService.asmx.cs


示例19: getresults

        public string getresults(string keyword)
        {
            User user = (User)Session["LoggedUser"];
            int i = 0;
            string searchRes = string.Empty;
            if (!string.IsNullOrEmpty(keyword))
            {
                DiscoverySearch dissearch = new DiscoverySearch();
                DiscoverySearchRepository dissearchrepo = new DiscoverySearchRepository();

                List<DiscoverySearch> discoveryList = dissearchrepo.getResultsFromKeyword(keyword);

                if (discoveryList.Count == 0)
                {

                    #region Twitter

                    try
                    {
                        oAuthTwitter oauth = new oAuthTwitter();
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
                        oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                        ArrayList alst = twtAccRepo.getAllTwitterAccounts();
                        foreach (TwitterAccount item in alst)
                        {
                            oauth.AccessToken = item.OAuthToken;
                            oauth.AccessTokenSecret = item.OAuthSecret;
                            oauth.TwitterUserId = item.TwitterUserId;
                            oauth.TwitterScreenName = item.TwitterScreenName;
                            break;
                        }

                        Search search = new Search();
                        JArray twitterSearchResult = search.Get_Search_Tweets(oauth, keyword);

                        foreach (var item in twitterSearchResult)
                        {
                            var results = item["statuses"];

                            foreach (var chile in results)
                            {
                                try
                                {
                                    dissearch.CreatedTime = SocioBoard.Helper.Extensions.ParseTwitterTime(chile["created_at"].ToString().TrimStart('"').TrimEnd('"')); ;
                                    dissearch.EntryDate = DateTime.Now;
                                    dissearch.FromId = chile["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.FromName = chile["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.ProfileImageUrl = chile["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.SearchKeyword = txtSearchText.Text;
                                    dissearch.Network = "twitter";
                                    dissearch.Message = chile["text"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.MessageId = chile["id_str"].ToString().TrimStart('"').TrimEnd('"');
                                    dissearch.Id = Guid.NewGuid();
                                    dissearch.UserId = user.Id;

                                    if (!dissearchrepo.isKeywordPresent(dissearch.SearchKeyword, dissearch.MessageId))
                                    {
                                        dissearchrepo.addNewSearchResult(dissearch);
                                    }

                                    searchRes += this.BindData(dissearch, i);

                                    i++;
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.StackTrace);
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                        Console.WriteLine(ex.StackTrace);
                    }
                    #endregion
                    #region Facebook
                    try
                    {
                        #region FacebookSearch
                        int j = 0;
                        string accesstoken = string.Empty;
                        FacebookAccountRepository fbAccRepo = new FacebookAccountRepository();
                        ArrayList asltFbAccount = fbAccRepo.getAllFacebookAccounts();
                        foreach (FacebookAccount item in asltFbAccount)
                        {
                            accesstoken = item.AccessToken;
                            break;
                        }

                        string facebookSearchUrl = "https://graph.facebook.com/search?q=" + txtSearchText.Text + " &type=post&access_token="+accesstoken;
                        var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl);
                        facerequest.Method = "GET";
                        string outputface = string.Empty;
                        using (var response = facerequest.GetResponse())
//.........这里部分代码省略.........
开发者ID:utkarshx,项目名称:socioboard,代码行数:101,代码来源:Discovery.aspx.cs


示例20: AddTwitterAccount

        public string AddTwitterAccount(string client_id, string client_secret, string redirect_uri, string UserId, string GroupId, string requestToken, string requestSecret, string requestVerifier)
        {
            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

                string ret = string.Empty;
                Users userinfo = new Users();
                oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
                OAuth.AccessToken = requestToken;
                OAuth.AccessTokenSecret = requestVerifier;
                OAuth.AccessTokenGet(requestToken, requestVerifier);
                JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

                if (profile != null)
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> Twitter profile : " + profile);
                }
                else
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> NULL Twitter profile : " + profile);
                }

                objTwitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
                TwitterUser twtuser;
                foreach (var item in profile)
                {
                    #region Add Twitter Account
                    try
                    {
                        objTwitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterAccount.Id = Guid.NewGuid();
                    objTwitterAccount.IsActive = true;
                    objTwitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    objTwitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        objTwitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        objTwitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            objTwitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        Console.WriteLine(er.StackTrace);

                    }

                    try
                    {
                        objTwitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    objTwitterAccount.UserId = Guid.Parse(UserId);
                    #endregion
                    if (!objTwitterAccountRepository.checkTwitterUserExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                    {
                        objTwitterAccountRepository.addTwitterkUser(objTwitterAccount);
                        #region Add TeamMemberProfile
                        Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
                        Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                        objTeamMemberProfile.Id = Guid.NewGuid();
//.........这里部分代码省略.........
开发者ID:leaspb,项目名称:socioboard-core,代码行数:101,代码来源:Twitter.asmx.cs



注:本文中的GlobusTwitterLib.Authentication.oAuthTwitter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GameClients.GameClient类代码示例发布时间:2022-05-26
下一篇:
C# Core.TwitterUser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap