Permalink
Browse files

Update Json.4.5.7

Correction of #19

Signed-off-by: rodrigopalhares <superpalhares@gmail.com>
  • Loading branch information...
1 parent 937e7c1 commit fc429ce1b81fd508256f6c1578af2bb23876d14c @rodrigopalhares rodrigopalhares committed Jul 11, 2012
Showing with 50,956 additions and 24 deletions.
  1. +2 −3 Twitterizer2.Async/Twitterizer2.Async.csproj
  2. +1 −1 Twitterizer2.Async/packages.config
  3. +2 −3 Twitterizer2.Streaming/Twitterizer2.Streaming.csproj
  4. +1 −1 Twitterizer2.Streaming/packages.config
  5. +2 −2 Twitterizer2.TestCases/Twitterizer2.TestCases.csproj
  6. +1 −1 Twitterizer2.TestCases/packages.config
  7. +29 −4 Twitterizer2/Core/SerializationHelper.cs
  8. +4 −1 Twitterizer2/Methods/Geo/Coordinate.cs
  9. +4 −1 Twitterizer2/Methods/Trends/TwitterTrendDictionary.cs
  10. +8 −2 Twitterizer2/Methods/Tweets/Entities/TwitterEntityCollection.cs
  11. +2 −4 Twitterizer2/Twitterizer2.csproj
  12. +1 −1 Twitterizer2/packages.config
  13. BIN packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.dll
  14. +8,204 −0 packages/Newtonsoft.Json.4.5.7/lib/net20/Newtonsoft.Json.xml
  15. BIN packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.dll
  16. +7,340 −0 packages/Newtonsoft.Json.4.5.7/lib/net35/Newtonsoft.Json.xml
  17. BIN packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.dll
  18. +7,583 −0 packages/Newtonsoft.Json.4.5.7/lib/net40/Newtonsoft.Json.xml
  19. BIN packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.dll
  20. +6,883 −0 packages/Newtonsoft.Json.4.5.7/lib/sl3-wp/Newtonsoft.Json.xml
  21. BIN packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.dll
  22. +6,883 −0 packages/Newtonsoft.Json.4.5.7/lib/sl4-windowsphone71/Newtonsoft.Json.xml
  23. BIN packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.dll
  24. +6,905 −0 packages/Newtonsoft.Json.4.5.7/lib/sl4/Newtonsoft.Json.xml
  25. BIN packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.dll
  26. +7,101 −0 packages/Newtonsoft.Json.4.5.7/lib/winrt45/Newtonsoft.Json.xml
@@ -60,9 +60,8 @@
<AssemblyOriginatorKeyFile>..\Twitterizer2\Twitterizer2.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=4.0.5.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Newtonsoft.Json.4.0.5\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="4.0.5" />
+ <package id="Newtonsoft.Json" version="4.5.7" />
</packages>
@@ -63,9 +63,8 @@
<AssemblyOriginatorKeyFile>..\Twitterizer2\Twitterizer2.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=4.0.5.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Newtonsoft.Json.4.0.5\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="4.0.5" />
+ <package id="Newtonsoft.Json" version="4.5.7" />
</packages>
@@ -64,9 +64,9 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=4.0.5.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Newtonsoft.Json.4.0.5\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="4.0.5" />
+ <package id="Newtonsoft.Json" version="4.5.7" />
<package id="NUnit" version="2.6.0.12054" />
</packages>
@@ -42,7 +42,7 @@ namespace Twitterizer.Core
/// The Serialization Helper class. Provides a simple interface for common serialization tasks.
/// </summary>
/// <typeparam name="T">The type of object to be deserialized</typeparam>
- internal static class SerializationHelper<T>
+ public static class SerializationHelper<T>
where T : ITwitterObject
{
/// <summary>
@@ -62,17 +62,42 @@ internal static class SerializationHelper<T>
/// A strongly typed object representing the deserialized data of type <typeparamref name="T"/>
/// </returns>
public static T Deserialize(byte[] webResponseData, DeserializationHandler deserializationHandler)
+ {
+ return Deserialize(Encoding.UTF8.GetString(webResponseData, 0, webResponseData.Length), deserializationHandler);
+ }
+
+ /// <summary>
+ /// Deserializes the specified web response.
+ /// </summary>
+ /// <param name="webResponseData">The web response data.</param>
+ /// <returns>
+ /// A strongly typed object representing the deserialized data of type <typeparamref name="T"/>
+ /// </returns>
+ public static T Deserialize(byte[] webResponseData)
+ {
+ return Deserialize(Encoding.UTF8.GetString(webResponseData, 0, webResponseData.Length), null);
+ }
+
+ /// <summary>
+ /// Deserializes the specified web response.
+ /// </summary>
+ /// <param name="webResponseData">The web response data.</param>
+ /// <param name="deserializationHandler">The deserialization handler.</param>
+ /// <returns>
+ /// A strongly typed object representing the deserialized data of type <typeparamref name="T"/>
+ /// </returns>
+ public static T Deserialize(string webResponseData, DeserializationHandler deserializationHandler)
{
T resultObject;
// Deserialize the results.
if (deserializationHandler == null)
{
- resultObject = JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(webResponseData, 0, webResponseData.Length));
+ resultObject = JsonConvert.DeserializeObject<T>(webResponseData);
}
else
{
- resultObject = deserializationHandler((JObject)JsonConvert.DeserializeObject(Encoding.UTF8.GetString(webResponseData, 0, webResponseData.Length)));
+ resultObject = deserializationHandler((JObject)JsonConvert.DeserializeObject(webResponseData));
}
return resultObject;
@@ -85,7 +110,7 @@ public static T Deserialize(byte[] webResponseData, DeserializationHandler deser
/// <returns>
/// A strongly typed object representing the deserialized data of type <typeparamref name="T"/>
/// </returns>
- public static T Deserialize(byte[] webResponseData)
+ public static T Deserialize(string webResponseData)
{
return Deserialize(webResponseData, null);
}
@@ -105,10 +105,13 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
return null;
}
+ if (reader.TokenType == JsonToken.StartArray)
+ reader.Read();
+
//int depth = reader.Depth + 1;
double count = 1;
- while (reader.Read() && reader.Depth >= startDepth)
+ while (reader.Read() && reader.Depth > startDepth)
{
if (new[] { JsonToken.StartArray, JsonToken.EndArray }.Contains(reader.TokenType))
continue;
@@ -98,7 +98,10 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
int initialDepth = reader.Depth;
- while (reader.Read() && reader.Depth >= initialDepth)
+ if (reader.TokenType == JsonToken.StartArray)
+ reader.Read();
+
+ while (reader.Read() && reader.Depth > initialDepth)
{
if (reader.TokenType == JsonToken.PropertyName && reader.Depth == 1)
{
@@ -92,7 +92,10 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
TwitterEntity entity = null;
try
{
- while (reader.Read() && reader.Depth >= startDepth)
+ if (reader.TokenType == JsonToken.StartArray)
+ reader.Read();
+
+ while (reader.Read() && reader.Depth > startDepth)
{
if (reader.TokenType == JsonToken.PropertyName && reader.Depth == startDepth + 1)
{
@@ -336,8 +339,11 @@ public TwitterMediaEntity parseMediaEntity(JsonReader reader)
int startDepth = reader.Depth;
+ if (reader.TokenType == JsonToken.StartArray)
+ reader.Read();
+
// Start looping through all of the child nodes
- while (reader.Read() && reader.Depth >= startDepth)
+ while (reader.Read() && reader.Depth > startDepth)
{
// If the current node isn't a property, skip it
if (reader.TokenType != JsonToken.PropertyName)
@@ -93,15 +93,13 @@
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=4.0.5.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Newtonsoft.Json.4.0.5\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="4.0.5" />
+ <package id="Newtonsoft.Json" version="4.5.7" />
</packages>
Binary file not shown.
Oops, something went wrong.

0 comments on commit fc429ce

Please sign in to comment.