示例#1
0
        /// <summary>
        /// ReTweet
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <param name="UserToFollow">TweetId</param>
        /// <returns>Returm True If ReTweet Success</returns>
        //public bool ReTweetStatus(oAuthTwitter OAuth, string TweetId)
        //{
        //    try
        //    {
        //        Twitter.Core.StatusMethods.Status status = new Twitter.Core.StatusMethods.Status();
        //        xmlResult = status.ReTweetStatus(OAuth, TweetId);
        //        return true;
        //    }
        //    catch
        //    {
        //        return false;
        //    }
        //}

        #endregion

        #region Search
        /// <summary>
        /// Search
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <param name="Count">SearchKey For Search</param>
        /// <returns>Return Search Result</returns>
        public List<search> GetSearchMethod(oAuthTwitter OAuth, string SearchKey,string pageindex)
        {
            search objSearch = new search();

            Twitter.Core.SearchMethods.Search search = new Twitter.Core.SearchMethods.Search();
            xmlResult = search.SearchMethod(OAuth, SearchKey, pageindex);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("entry");

            foreach (XmlNode xn in xmlNodeList)
            {
                XmlElement idElement = (XmlElement)xn;
                objSearch.id = idElement.GetElementsByTagName("id")[0].InnerText.Replace("tag:search.twitter.com,2005:", "");

                XmlElement idPostedTime = (XmlElement)xn;
                objSearch.PostedTime = idElement.GetElementsByTagName("published")[0].InnerText;

                XmlElement imageUrlElement = (XmlElement)xn;
                objSearch.content = imageUrlElement.GetElementsByTagName("content")[0].InnerText;

                XmlElement followersCountElement = (XmlElement)xn;
                objSearch.link = followersCountElement.GetElementsByTagName("updated")[0].NextSibling.Attributes["href"].InnerText;

                XmlElement friendCountElement = (XmlElement)xn;
                string name = friendCountElement.GetElementsByTagName("name")[0].InnerText;
                int FirstPoint = name.IndexOf("(");
                objSearch.authorObject.name = name.Substring(0, FirstPoint).Replace("(", "").Replace(" ", "");

                SearchMethod.Add(objSearch);
            }
            return SearchMethod;

        }
示例#2
0
        /// <summary>
        /// Search
        /// </summary>
        /// <param name="User">Twitter User And Password</param>
        /// <param name="Count">SearchKey For Search</param>
        /// <returns>Return Search Result</returns>
        public List<search> GetSearchMethod(TwitterUser User, string SearchKey)
        {
            search objSearch = new search();

            Twitter.Core.SearchMethods.Search search = new Twitter.Core.SearchMethods.Search();
            xmlResult = search.SearchMethod(User, SearchKey);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("entry");

            foreach (XmlNode xn in xmlNodeList)
            {
                XmlElement idElement = (XmlElement)xn;
                objSearch.id = idElement.GetElementsByTagName("id")[0].InnerText; 

                XmlElement imageUrlElement = (XmlElement)xn;
                objSearch.content = imageUrlElement.GetElementsByTagName("content")[0].InnerText;

                XmlElement followersCountElement = (XmlElement)xn;
                objSearch.link = followersCountElement.GetElementsByTagName("updated")[0].NextSibling.Attributes["href"].InnerText;

                XmlElement friendCountElement = (XmlElement)xn;
                objSearch.authorObject.name = friendCountElement.GetElementsByTagName("name")[0].InnerText;

                SearchMethod.Add(objSearch);
            }
            return SearchMethod;

        }