1

Я пытаюсь реализовать Twitter в мобильной игре, которую я разрабатываю, и с трудностями с использованием доступных библиотек. Может кто-нибудь объяснить, как я использую библиотеку, такую ​​как nTwitter на .net compact framework 3.5 и windows mobile 6 professional SDK Заранее благодарю за любую помощь TomWindows Mobile 6 и твиттер

ответ

0

Twitter можно контролировать с помощью разрешенных веб-запросов. Для этого вы можете использовать System.Net.HttpWebRequest из .NET Framework.

В приведенном ниже примере показано, как опубликовать статус Twitter:

public void SubmitUserStatus(string username, string password, string tweet) 
{ 
    // encode the username/password 
    string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + password)); 
    // determine what we want to upload as a status 
    byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + tweet); 
    // connect with the update page 
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml"); 
    // set the method to POST 
    request.Method = "POST"; 
    request.ServicePoint.Expect100Continue = false; 
    // set the authorisation levels 
    request.Headers.Add("Authorization", "Basic " + user); 
    request.ContentType = "application/x-www-form-urlencoded"; 
    // set the length of the content 
    request.ContentLength = bytes.Length; 
    // set up the stream 
    Stream reqStream = request.GetRequestStream(); 
    // write to the stream 
    reqStream.Write(bytes, 0, bytes.Length); 
    // close the stream 
    reqStream.Close(); 
} 

Источник: http://weblogs.asp.net/wallym/archive/2009/03/25/twitter-api-submit-a-post-in-c.aspx

Кроме того, я бы рекомендовал посмотреть на эту страницу для готовых библиотек: http://dev.twitter.com/pages/libraries#csharp

Смежные вопросы