Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs @ 273:a7420f05716a
Ticket #185: Nombre duplicado al loguearse en el administrador de VANs. Corregido el parche.
author | juanjose.montesdeocaarbos |
---|---|
date | Tue, 29 Nov 2011 07:56:23 -0300 |
parents | 37ddf81333d3 |
children |
comparison
equal
deleted
inserted
replaced
272:33e6ee3d1776 | 273:a7420f05716a |
---|---|
1 using System; | 1 using System; |
2 using System.Collections.Generic; | |
3 using System.Web.Script.Serialization; | |
2 using AltNetHispano.Agendas.Configurations; | 4 using AltNetHispano.Agendas.Configurations; |
3 | 5 |
4 namespace AltNetHispano.Agendas.Twitter | 6 namespace AltNetHispano.Agendas.Twitter |
5 { | 7 { |
6 public class OAuthTwitter | 8 public class OAuthTwitter |
38 return _twitterAdapter.GetAccessToken(ConsumerKey, ConsumerSecret, requestToken, verifier); | 40 return _twitterAdapter.GetAccessToken(ConsumerKey, ConsumerSecret, requestToken, verifier); |
39 } | 41 } |
40 | 42 |
41 public static string GetResponseContent(string response, string tagName) | 43 public static string GetResponseContent(string response, string tagName) |
42 { | 44 { |
43 var tagStart = "\"" + tagName + "\":"; | 45 var serializer = new JavaScriptSerializer(); |
44 var tagEnd = "\""; | 46 var responseDictionary = (Dictionary<string,object>)serializer.DeserializeObject(response); |
45 | 47 |
46 var start = response.IndexOf(tagStart) + tagStart.Length; | 48 return responseDictionary.ContainsKey(tagName) ? responseDictionary[tagName].ToString() : string.Empty; |
47 if (start > tagStart.Length) | |
48 { | |
49 var end = response.IndexOf(tagEnd, start+1); | |
50 if (end > 0) | |
51 { | |
52 return response.Substring(start + 1, end - start - 1); | |
53 } | |
54 } | |
55 return string.Empty; | |
56 } | 49 } |
57 } | 50 } |
58 } | 51 } |