changeset 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 33e6ee3d1776
children 72a96459f910
files Agendas/trunk/src/Agendas.Twitter/Agendas.Twitter.csproj Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs
diffstat 2 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Twitter/Agendas.Twitter.csproj	Fri Nov 18 23:09:58 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter/Agendas.Twitter.csproj	Tue Nov 29 07:56:23 2011 -0300
@@ -38,6 +38,7 @@
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Web" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
--- a/Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs	Fri Nov 18 23:09:58 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs	Tue Nov 29 07:56:23 2011 -0300
@@ -1,4 +1,6 @@
 using System;
+using System.Collections.Generic;
+using System.Web.Script.Serialization; 
 using AltNetHispano.Agendas.Configurations;
 
 namespace AltNetHispano.Agendas.Twitter
@@ -40,19 +42,10 @@
 
 		public static string GetResponseContent(string response, string tagName)
 		{
-			var tagStart = "\"" + tagName + "\":";
-			var tagEnd = "\"";
+			var serializer = new JavaScriptSerializer();
+			var responseDictionary = (Dictionary<string,object>)serializer.DeserializeObject(response);
 
-			var start = response.IndexOf(tagStart) + tagStart.Length;
-			if (start > tagStart.Length)
-			{
-				var end = response.IndexOf(tagEnd, start+1);
-				if (end > 0)
-				{
-					return response.Substring(start + 1, end - start - 1);
-				}
-			}
-			return string.Empty;
+			return responseDictionary.ContainsKey(tagName) ? responseDictionary[tagName].ToString() : string.Empty;
 		}
 	}
 }