using System; using System.Collections.Generic; using System.Linq; using System.Text; using TweetSharp; using Hammock; namespace TweetNow { class TweetManager { static public TwitterService initiate() { String _consumerKey = "*********"; String _consumerSecret = "*********"; String _accessToken = "***********************************"; String _accessTokenSecret = "********************************"; // Pass your credentials to the service TwitterService service = new TwitterService(_consumerKey, _consumerSecret); // Retrieve an OAuth Request Token service.AuthenticateWith(_accessToken, _accessTokenSecret); return service; } public static void sendTweet(String msg,String picname,TwitterService serv) { RestRequest request = serv.PrepareEchoRequest(); request.Path = "uploadAndPost.xml"; request.AddFile("media", "smile", "Images/"+picname, "image/jpeg"); //request.AddField("key", "*******************************"); request.AddField("key", "*********************************"); request.AddField("message", "Emote with a Pic!"); RestClient client = new RestClient { Authority = "http://api.twitpic.com/", VersionPath = "2" }; RestResponse response = client.Request(request); Console.WriteLine(response.Content); String str = response.Content; int first = str.IndexOf(""); int last = str.LastIndexOf(""); string str2 = str.Substring(first + 5, last - first - 5); serv.SendTweet(msg+" "+str2+" ."); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)