-Changed portable assembly to .NET 4.5, Silverlight 5, Win8, WP8
-Fixed incorrect namespace when converting XML to JSON
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1876,6 +1876,32 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
Assert.AreEqual(@"<item action=""update"" itemid=""1"" description=""temp""><elements action=""none"" id=""2"" /><elements action=""none"" id=""3"" /></item>", xmldoc.InnerXml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SerializingXmlNamespaceScope()
|
||||
{
|
||||
var xmlString = @"<root xmlns=""http://www.example.com/ns"">
|
||||
<a/>
|
||||
<bns:b xmlns:bns=""http://www.example.com/ns""/>
|
||||
<c/>
|
||||
</root>";
|
||||
|
||||
#if !NET20
|
||||
var xml = XElement.Parse(xmlString);
|
||||
|
||||
var json1 = JsonConvert.SerializeObject(xml);
|
||||
|
||||
Assert.AreEqual(@"{""root"":{""@xmlns"":""http://www.example.com/ns"",""a"":null,""bns:b"":{""@xmlns:bns"":""http://www.example.com/ns""},""c"":null}}", json1);
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE)
|
||||
var xml1 = new XmlDocument();
|
||||
xml1.LoadXml(xmlString);
|
||||
|
||||
var json2 = JsonConvert.SerializeObject(xml1);
|
||||
|
||||
Assert.AreEqual(@"{""root"":{""@xmlns"":""http://www.example.com/ns"",""a"":null,""bns:b"":{""@xmlns:bns"":""http://www.example.com/ns""},""c"":null}}", json2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -636,7 +636,7 @@ now brown cow?", '"', true);
|
||||
return (T)converter.ReadJson(reader, typeof(T), null, null);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
[Test]
|
||||
public void Async()
|
||||
{
|
||||
|
||||
@@ -44,6 +44,93 @@ namespace Newtonsoft.Json.Tests
|
||||
[TestFixture]
|
||||
public class JsonTextReaderTest : TestFixtureBase
|
||||
{
|
||||
[Test]
|
||||
public void UnescapeDoubleQuotes()
|
||||
{
|
||||
string json = @"{""recipe_id"":""12"",""recipe_name"":""Apocalypse Leather Armors"",""recipe_text"":""#C16------------------------------\r\n#C12Ingredients #C20\r\n#C16------------------------------\r\n\r\na piece of Leather Armor\r\n( ie #L \""Enhanced Leather Armor Boots\"" \""85644\"" )\r\n<img src=rdb:\/\/13264>\r\n\r\n#L \""Hacker Tool\"" \""87814\""\r\n<img src=rdb:\/\/99282>\r\n\r\n#L \""Clanalizer\"" \""208313\""\r\n<img src=rdb:\/\/156479>\r\n\r\n#C16------------------------------\r\n#C12Recipe #C16\r\n#C16------------------------------#C20\r\n\r\nHacker Tool\r\n#C15+#C20\r\na piece of Leather Armor\r\n#C15=#C20\r\n<img src=rdb:\/\/13264>\r\na piece of Hacked Leather Armor\r\n( ie : #L \""Hacked Leather Armor Boots\"" \""245979\"" )\r\n#C16Skills: | BE |#C20\r\n\r\n#C14------------------------------#C20\r\n\r\nClanalizer\r\n#C15+#C20\r\na piece of Hacked Leather Armor\r\n#C15=#C20\r\n<img src=rdb:\/\/13264>\r\na piece of Apocalypse Leather Armor\r\n( ie : #L \""Apocalypse Leather Armor Boots\"" \""245966\"" )\r\n#C16Skills: | ?? |#C20\r\n\r\n#C16------------------------------\r\n#C12Details#C16\r\n#C16------------------------------#C20\r\n\r\n#L \""Apocalypse Leather Armor Boots\"" \""245967\""\r\n#L \""Apocalypse Leather Armor Gloves\"" \""245969\""\r\n#L \""Apocalypse Leather Armor Helmet\"" \""245975\""\r\n#L \""Apocalypse Leather Armor Pants\"" \""245971\""\r\n#L \""Apocalypse Leather Armor Sleeves\"" \""245973\""\r\n#L \""Apocalypse Leather Body Armor\"" \""245965\""\r\n\r\n#C16------------------------------\r\n#C12Comments#C16\r\n#C16------------------------------#C20\r\n\r\nNice froob armor.. but ugleh!\r\n\r\n"",""recipe_author"":null}";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.String, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.String, reader.TokenType);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||
Assert.AreEqual("recipe_text", reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.String, reader.TokenType);
|
||||
|
||||
Assert.AreEqual(@"#C16------------------------------
|
||||
#C12Ingredients #C20
|
||||
#C16------------------------------
|
||||
|
||||
a piece of Leather Armor
|
||||
( ie #L ""Enhanced Leather Armor Boots"" ""85644"" )
|
||||
<img src=rdb://13264>
|
||||
|
||||
#L ""Hacker Tool"" ""87814""
|
||||
<img src=rdb://99282>
|
||||
|
||||
#L ""Clanalizer"" ""208313""
|
||||
<img src=rdb://156479>
|
||||
|
||||
#C16------------------------------
|
||||
#C12Recipe #C16
|
||||
#C16------------------------------#C20
|
||||
|
||||
Hacker Tool
|
||||
#C15+#C20
|
||||
a piece of Leather Armor
|
||||
#C15=#C20
|
||||
<img src=rdb://13264>
|
||||
a piece of Hacked Leather Armor
|
||||
( ie : #L ""Hacked Leather Armor Boots"" ""245979"" )
|
||||
#C16Skills: | BE |#C20
|
||||
|
||||
#C14------------------------------#C20
|
||||
|
||||
Clanalizer
|
||||
#C15+#C20
|
||||
a piece of Hacked Leather Armor
|
||||
#C15=#C20
|
||||
<img src=rdb://13264>
|
||||
a piece of Apocalypse Leather Armor
|
||||
( ie : #L ""Apocalypse Leather Armor Boots"" ""245966"" )
|
||||
#C16Skills: | ?? |#C20
|
||||
|
||||
#C16------------------------------
|
||||
#C12Details#C16
|
||||
#C16------------------------------#C20
|
||||
|
||||
#L ""Apocalypse Leather Armor Boots"" ""245967""
|
||||
#L ""Apocalypse Leather Armor Gloves"" ""245969""
|
||||
#L ""Apocalypse Leather Armor Helmet"" ""245975""
|
||||
#L ""Apocalypse Leather Armor Pants"" ""245971""
|
||||
#L ""Apocalypse Leather Armor Sleeves"" ""245973""
|
||||
#L ""Apocalypse Leather Body Armor"" ""245965""
|
||||
|
||||
#C16------------------------------
|
||||
#C12Comments#C16
|
||||
#C16------------------------------#C20
|
||||
|
||||
Nice froob armor.. but ugleh!
|
||||
|
||||
", reader.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SurrogatePairValid()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -1441,7 +1441,8 @@ Parameter name: arrayIndex",
|
||||
Assert.AreEqual(2, (int)o["Test1"]);
|
||||
}
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
[Test]
|
||||
public void CollectionChanged()
|
||||
{
|
||||
@@ -1742,6 +1743,7 @@ Parameter name: arrayIndex",
|
||||
Assert.AreEqual(false, prop4.ShouldSerializeValue(o));
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void ParseEmptyObjectWithComment()
|
||||
{
|
||||
@@ -1930,5 +1932,29 @@ Parameter name: arrayIndex",
|
||||
|
||||
Assert.IsFalse(a.TryGetValue(null, StringComparison.Ordinal, out v));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void sdfsdf()
|
||||
{
|
||||
string json = @"
|
||||
|
||||
|
||||
{
|
||||
""resultCount"":1,
|
||||
""results"": [
|
||||
{""kind"":""software"", ""features"":[], ""supportedDevices"":[""all""], ""isGameCenterEnabled"":false,
|
||||
""screenshotUrls"":[""http://a1483.phobos.apple.com/us/r1000/080/Purple/v4/97/93/25/9793257e-1508-631c-c867-7075fa4fd55a/mzl.vdfbnbtr.png"", ""http://a1052.phobos.apple.com/us/r1000/087/Purple/v4/8c/63/ec/8c63ecc0-4e1b-e8e5-d936-ac2ab3a5a09b/mzl.tcjeyxaz.png"", ""http://a955.phobos.apple.com/us/r1000/068/Purple/v4/b8/0f/3c/b80f3c4a-ef67-7c09-e7e0-71dd016b24eb/mzl.ytmcfche.png"", ""http://a139.phobos.apple.com/us/r1000/073/Purple/v4/85/22/78/852278c3-4c4f-1dd4-70a1-072722e233b6/mzl.lguhuzlo.png"", ""http://a1136.phobos.apple.com/us/r1000/091/Purple/v4/c7/25/52/c725526f-63d3-bb77-7cad-fce3a1725c1e/mzl.rrftrkgt.png""], ""ipadScreenshotUrls"":[], ""artworkUrl60"":""http://a1115.phobos.apple.com/us/r1000/119/Purple/v4/44/f8/a6/44f8a649-2a7f-05cb-bed1-9288f08f5e74/Icon.png"", ""artworkUrl512"":""http://a380.phobos.apple.com/us/r1000/062/Purple/v4/47/6e/ea/476eea43-10dd-17ae-e972-303e8008eac1/mzl.muprlqbf.png"", ""artistViewUrl"":""https://itunes.apple.com/us/artist/yellowpages.com-llc/id281970042?uo=4"", ""artistId"":281970042, ""artistName"":""YELLOWPAGES.COM LLC"", ""price"":0.00, ""version"":""3.9"",
|
||||
""description"":""Find what\u2019s around you in a flash! Whether you\u2019re looking for a great place to eat or to find cheap gas on the way, the YP app connects you with local businesses, deals and events to help you get things done.\n\n\u2022 Search over 18 million businesses by typing, speaking, or browsing popular categories including movie theaters, hotels, mechanics, dentists, and more.\n\u2022 Add personalized shortcuts for instant access to nearby businesses, deals, gas prices and events.\n\u2022 Craving a specific food? We'll look through over 300,000 menus to figure out who's got what you want.\n\u2022 Find the \u201cbest\u201d gas prices near you with our unique visual gas price search.\n\u2022 Save with thousands of local coupons and deals from businesses near you.*\n\u2022 Get important information before heading out including:\n - Ratings and reviews\n - Photos \u2013 plus upload photos to your favorite businesses!\n - Restaurant and service menus\n - Movie showtimes\n - Hours of operation\n - Phone numbers\n - Maps and directions \n\nWhatever you need\u2026 Wherever you are\u2026 the YP app covers you locally. What are you waiting for? Try it now! \n\n\n\n* Some restrictions may apply. Please call first to confirm the business will accept this coupon. Not all businesses accept mobile coupons."", ""currency"":""USD"", ""genres"":[""Travel"", ""Navigation""], ""genreIds"":[""6003"", ""6010""], ""releaseDate"":""2008-07-11T07:00:00Z"", ""sellerName"":""Yellowpages.com"", ""bundleId"":""com.yellowpages.ypmobile"", ""trackId"":284806204, ""trackName"":""YP Local Search & Gas Prices"", ""primaryGenreName"":""Travel"", ""primaryGenreId"":6003,
|
||||
""releaseNotes"":""\u2022 Support for full screen display on iPhone 5\n\u2022 Location Aware Autosuggest \u2013 based on your location, we'll suggest nearby businesses as you type to make searching faster\n\u2022 Crash and bug fixes to make the app more stable"", ""formattedPrice"":""Free"", ""wrapperType"":""software"", ""trackCensoredName"":""YP Local Search & Gas Prices"", ""languageCodesISO2A"":[""EN""], ""fileSizeBytes"":""8728406"", ""sellerUrl"":""http://www.yellowpages.com/products/ypmobile"", ""contentAdvisoryRating"":""4+"", ""averageUserRatingForCurrentVersion"":4.5, ""userRatingCountForCurrentVersion"":168, ""artworkUrl100"":""http://a380.phobos.apple.com/us/r1000/062/Purple/v4/47/6e/ea/476eea43-10dd-17ae-e972-303e8008eac1/mzl.muprlqbf.png"", ""trackViewUrl"":""https://itunes.apple.com/us/app/yp-local-search-gas-prices/id284806204?mt=8&uo=4"", ""trackContentRating"":""4+"", ""averageUserRating"":3.0, ""userRatingCount"":55022}]
|
||||
}
|
||||
|
||||
";
|
||||
|
||||
JObject o = JObject.Parse(json);
|
||||
|
||||
string s = (string)o["results"][0]["description"];
|
||||
|
||||
Assert.AreEqual("Find what’s around you in a flash! Whether you’re looking for a great place to eat or to find cheap gas on the way, the YP app connects you with local businesses, deals and events to help you get things done.\n\n• Search over 18 million businesses by typing, speaking, or browsing popular categories including movie theaters, hotels, mechanics, dentists, and more.\n• Add personalized shortcuts for instant access to nearby businesses, deals, gas prices and events.\n• Craving a specific food? We'll look through over 300,000 menus to figure out who's got what you want.\n• Find the “best” gas prices near you with our unique visual gas price search.\n• Save with thousands of local coupons and deals from businesses near you.*\n• Get important information before heading out including:\n - Ratings and reviews\n - Photos – plus upload photos to your favorite businesses!\n - Restaurant and service menus\n - Movie showtimes\n - Hours of operation\n - Phone numbers\n - Maps and directions \n\nWhatever you need… Wherever you are… the YP app covers you locally. What are you waiting for? Try it now! \n\n\n\n* Some restrictions may apply. Please call first to confirm the business will accept this coupon. Not all businesses accept mobile coupons.", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,7 @@ keyword such as type of business.""
|
||||
Assert.AreEqual(new DateTime(2000, 10, 15, 5, 5, 5, DateTimeKind.Utc), d);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
[Test]
|
||||
public void CovariantIJEnumerable()
|
||||
{
|
||||
@@ -865,7 +865,7 @@ keyword such as type of business.""
|
||||
Assert.AreEqual("hi!", (string)a[0]);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void ExceptionFromOverloadWithJValue()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
@@ -54,6 +54,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -63,6 +64,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -99,6 +101,7 @@
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
|
||||
@@ -73,4 +73,4 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.5.11.15823")]
|
||||
[assembly: AssemblyFileVersion("4.5.11.15906")]
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void DynamicCamelCasePropertyNames()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -97,6 +97,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(dynamicObject.ChildObject.Text, d.ChildObject.Text);
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
[Test]
|
||||
public void SerializeDynamicObjectWithObjectTracking()
|
||||
{
|
||||
@@ -145,6 +146,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual("Child text!", n.DynamicChildObject.Text);
|
||||
Assert.AreEqual(int.MinValue, n.DynamicChildObject.Integer);
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void NoPublicDefaultConstructor()
|
||||
|
||||
@@ -2123,7 +2123,7 @@ Path '', line 1, position 1.",
|
||||
});
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void CannotDeserializeArrayIntoDynamic()
|
||||
{
|
||||
@@ -3454,7 +3454,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || SILVERLIGHT)
|
||||
[Test]
|
||||
public void SerializeDeserializeXNodeProperties()
|
||||
{
|
||||
@@ -4318,7 +4318,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void SerializeExpandoObject()
|
||||
{
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || NET20 || NET35 || WINDOWS_PHONE)
|
||||
#if !(NET20 || NET35 || WINDOWS_PHONE)
|
||||
public class DictionaryDynamicObject : DynamicObject
|
||||
{
|
||||
public IDictionary<string, object> Values { get; private set; }
|
||||
|
||||
@@ -612,7 +612,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(@"Unexpected end when deserializing object. Path 'events2.code', line 1, position 49.", errors[1]);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void ErrorHandlingEndOfContentDynamic()
|
||||
{
|
||||
|
||||
@@ -1445,7 +1445,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(1, (int)j["MyProperty"]);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
[Test]
|
||||
public void PropertyItemTypeNameHandlingDynamic()
|
||||
{
|
||||
@@ -1651,7 +1651,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public TypeNameHandlingTestObject Data { get; set; }
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
public class PropertyItemTypeNameHandlingDynamic
|
||||
{
|
||||
[JsonProperty(ItemTypeNameHandling = TypeNameHandling.All)]
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if (!(SILVERLIGHT || PORTABLE) || WINDOWS_PHONE)
|
||||
#if (!(SILVERLIGHT) || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -41,7 +41,7 @@ using System.Linq;
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
#region XmlNodeWrappers
|
||||
#if !SILVERLIGHT && !NETFX_CORE
|
||||
#if !SILVERLIGHT && !NETFX_CORE && !PORTABLE
|
||||
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
|
||||
{
|
||||
private readonly XmlDocument _document;
|
||||
@@ -807,7 +807,7 @@ namespace Newtonsoft.Json.Converters
|
||||
if (value is XObject)
|
||||
return XContainerWrapper.WrapNode((XObject)value);
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE)
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
if (value is XmlNode)
|
||||
return new XmlNodeWrapper((XmlNode)value);
|
||||
#endif
|
||||
@@ -972,15 +972,20 @@ namespace Newtonsoft.Json.Converters
|
||||
}
|
||||
else
|
||||
{
|
||||
manager.PushScope();
|
||||
|
||||
string namespacePrefix = null;
|
||||
string namespaceUri = null;
|
||||
foreach (IXmlNode attribute in node.Attributes)
|
||||
{
|
||||
if (attribute.NamespaceUri == "http://www.w3.org/2000/xmlns/")
|
||||
{
|
||||
string prefix = (attribute.LocalName != "xmlns")
|
||||
? attribute.LocalName
|
||||
: string.Empty;
|
||||
namespacePrefix = (attribute.LocalName != "xmlns")
|
||||
? attribute.LocalName
|
||||
: string.Empty;
|
||||
namespaceUri = attribute.Value;
|
||||
|
||||
manager.AddNamespace(prefix, attribute.Value);
|
||||
manager.AddNamespace(namespacePrefix, namespaceUri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,6 +1016,11 @@ namespace Newtonsoft.Json.Converters
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
if (namespacePrefix != null)
|
||||
manager.RemoveNamespace(namespacePrefix, namespaceUri);
|
||||
|
||||
manager.PopScope();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1092,7 +1102,7 @@ namespace Newtonsoft.Json.Converters
|
||||
rootNode = document;
|
||||
}
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE)
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
if (typeof(XmlNode).IsAssignableFrom(objectType))
|
||||
{
|
||||
if (objectType != typeof (XmlDocument))
|
||||
@@ -1262,7 +1272,7 @@ namespace Newtonsoft.Json.Converters
|
||||
else if (reader.TokenType == JsonToken.Date)
|
||||
{
|
||||
DateTime d = Convert.ToDateTime(reader.Value, CultureInfo.InvariantCulture);
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
return XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind));
|
||||
#else
|
||||
return XmlConvert.ToString(d);
|
||||
@@ -1555,7 +1565,7 @@ namespace Newtonsoft.Json.Converters
|
||||
if (typeof(XObject).IsAssignableFrom(valueType))
|
||||
return true;
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE)
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
if (typeof(XmlNode).IsAssignableFrom(valueType))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Xml;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Text;
|
||||
#if !NET20 && (!SILVERLIGHT || WINDOWS_PHONE) && !PORTABLE
|
||||
#if !NET20 && (!SILVERLIGHT || WINDOWS_PHONE)
|
||||
using System.Xml.Linq;
|
||||
#endif
|
||||
#if NETFX_CORE
|
||||
@@ -833,7 +833,7 @@ namespace Newtonsoft.Json
|
||||
return sw.ToString();
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
/// <summary>
|
||||
/// Asynchronously serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
|
||||
/// </summary>
|
||||
@@ -1011,7 +1011,7 @@ namespace Newtonsoft.Json
|
||||
return jsonSerializer.Deserialize(new JsonTextReader(sr), type);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
/// <summary>
|
||||
/// Asynchronously deserializes the JSON to the specified .NET type.
|
||||
/// </summary>
|
||||
@@ -1106,7 +1106,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
/// <summary>
|
||||
/// Asynchronously populates the object with values from the JSON string.
|
||||
/// </summary>
|
||||
@@ -1204,7 +1204,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !NET20 && (!(SILVERLIGHT || PORTABLE) || WINDOWS_PHONE)
|
||||
#if !NET20 && (!(SILVERLIGHT) || WINDOWS_PHONE)
|
||||
/// <summary>
|
||||
/// Serializes the <see cref="XNode"/> to a JSON string.
|
||||
/// </summary>
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of token</typeparam>
|
||||
public interface IJEnumerable<
|
||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
||||
out
|
||||
#endif
|
||||
T> : IEnumerable<T> where T : JToken
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !PORTABLE
|
||||
using System.Collections.Specialized;
|
||||
#endif
|
||||
using System.Threading;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
@@ -47,7 +45,7 @@ namespace Newtonsoft.Json.Linq
|
||||
public abstract class JContainer : JToken, IList<JToken>
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
, ITypedList, IBindingList
|
||||
#elif !PORTABLE
|
||||
#else
|
||||
, INotifyCollectionChanged
|
||||
#endif
|
||||
, IList
|
||||
@@ -77,7 +75,7 @@ namespace Newtonsoft.Json.Linq
|
||||
remove { _addingNew -= value; }
|
||||
}
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
internal NotifyCollectionChangedEventHandler _collectionChanged;
|
||||
|
||||
/// <summary>
|
||||
@@ -159,7 +157,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
/// <summary>
|
||||
/// Raises the <see cref="CollectionChanged"/> event.
|
||||
/// </summary>
|
||||
@@ -356,7 +354,7 @@ namespace Newtonsoft.Json.Linq
|
||||
if (_listChanged != null)
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
if (_collectionChanged != null)
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
|
||||
#endif
|
||||
@@ -390,7 +388,7 @@ namespace Newtonsoft.Json.Linq
|
||||
if (_listChanged != null)
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
if (_collectionChanged != null)
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
|
||||
#endif
|
||||
@@ -454,7 +452,7 @@ namespace Newtonsoft.Json.Linq
|
||||
if (_listChanged != null)
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
if (_collectionChanged != null)
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, item, existing, index));
|
||||
#endif
|
||||
@@ -477,7 +475,7 @@ namespace Newtonsoft.Json.Linq
|
||||
if (_listChanged != null)
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
if (_collectionChanged != null)
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
#endif
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
#if !PORTABLE
|
||||
using System.Collections.Specialized;
|
||||
#endif
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
@@ -162,7 +160,7 @@ namespace Newtonsoft.Json.Linq
|
||||
if (_listChanged != null)
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
|
||||
#endif
|
||||
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE)
|
||||
#if SILVERLIGHT || !(NET20 || NET35)
|
||||
if (_collectionChanged != null)
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, childProperty, childProperty, IndexOfItem(childProperty)));
|
||||
#endif
|
||||
@@ -757,7 +755,7 @@ namespace Newtonsoft.Json.Linq
|
||||
#endregion
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
/// <summary>
|
||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
@@ -50,7 +50,7 @@ namespace Newtonsoft.Json.Linq
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
, ICloneable
|
||||
#endif
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
, IDynamicMetaObjectProvider
|
||||
#endif
|
||||
{
|
||||
@@ -1704,7 +1704,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return p.Evaluate(this, errorWhenNoMatch);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
/// <summary>
|
||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
@@ -304,7 +304,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return d1.CompareTo(d2);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
|
||||
{
|
||||
if (objA is string || objB is string)
|
||||
@@ -714,7 +714,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return _value.ToString();
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
/// <summary>
|
||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
<RootNamespace>Newtonsoft.Json</RootNamespace>
|
||||
<AssemblyName>Newtonsoft.Json</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile2</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>Profile158</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
||||
@@ -87,6 +87,6 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("4.5.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.5.11.15823")]
|
||||
[assembly: AssemblyFileVersion("4.5.11.15906")]
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace Newtonsoft.Json.Schema
|
||||
GenerateISerializableContract(type, (JsonISerializableContract) contract);
|
||||
break;
|
||||
#endif
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
case JsonContractType.Dynamic:
|
||||
#endif
|
||||
case JsonContractType.Linq:
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Globalization;
|
||||
@@ -100,10 +100,10 @@ namespace Newtonsoft.Json.Serialization
|
||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
||||
new EntityKeyMemberConverter(),
|
||||
#endif
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
new ExpandoObjectConverter(),
|
||||
#endif
|
||||
#if (!(SILVERLIGHT || PORTABLE) || WINDOWS_PHONE)
|
||||
#if (!(SILVERLIGHT) || WINDOWS_PHONE)
|
||||
new XmlNodeConverter(),
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
@@ -748,7 +748,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
/// <summary>
|
||||
/// Creates a <see cref="JsonDynamicContract"/> for the given type.
|
||||
/// </summary>
|
||||
@@ -817,7 +817,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return CreateISerializableContract(objectType);
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t))
|
||||
return CreateDynamicContract(objectType);
|
||||
#endif
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
if (IsTypeGenericCollectionInterface(UnderlyingType))
|
||||
CreatedType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
||||
#if !(PORTABLE || NET20 || NET35 || WINDOWS_PHONE)
|
||||
#if !(NET20 || NET35 || WINDOWS_PHONE)
|
||||
else if (IsTypeGenericSetnterface(UnderlyingType))
|
||||
CreatedType = ReflectionUtils.MakeGenericType(typeof(HashSet<>), CollectionItemType);
|
||||
#endif
|
||||
@@ -155,7 +155,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|| genericDefinition == typeof(IEnumerable<>));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NET20 || NET35 || WINDOWS_PHONE)
|
||||
#if !(NET20 || NET35 || WINDOWS_PHONE)
|
||||
private bool IsTypeGenericSetnterface(Type type)
|
||||
{
|
||||
if (!type.IsGenericType())
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
Primitive,
|
||||
String,
|
||||
Dictionary,
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
Dynamic,
|
||||
#endif
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
int IEqualityComparer<object>.GetHashCode(object obj)
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE)
|
||||
// put objects in a bucket based on their reference
|
||||
return RuntimeHelpers.GetHashCode(obj);
|
||||
#else
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.ComponentModel;
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
@@ -288,7 +288,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
||||
case JsonContractType.Serializable:
|
||||
#endif
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
case JsonContractType.Dynamic:
|
||||
#endif
|
||||
return @"JSON object (e.g. {""name"":""value""})";
|
||||
@@ -393,7 +393,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
targetDictionary = CreateNewDictionary(reader, dictionaryContract);
|
||||
|
||||
return PopulateDictionary(dictionaryContract.CreateWrapper(targetDictionary), reader, dictionaryContract, member, id);
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
case JsonContractType.Dynamic:
|
||||
JsonDynamicContract dynamicContract = (JsonDynamicContract) contract;
|
||||
return CreateDynamic(reader, dynamicContract, member, id);
|
||||
@@ -490,7 +490,7 @@ To fix this error either change the JSON to a {1} or change the deserialized typ
|
||||
TraceWriter.Trace(TraceLevel.Verbose, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, "Resolved type '{0}' to {1}.".FormatWith(CultureInfo.InvariantCulture, qualifiedTypeName, specifiedType)), null);
|
||||
|
||||
if (objectType != null
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
&& objectType != typeof (IDynamicMetaObjectProvider)
|
||||
#endif
|
||||
&& !objectType.IsAssignableFrom(specifiedType))
|
||||
@@ -616,7 +616,7 @@ To fix this error either change the JSON to a {1} or change the deserialized typ
|
||||
private bool HasDefinedType(Type type)
|
||||
{
|
||||
return (type != null && type != typeof (object) && !typeof (JToken).IsSubclassOf(type)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
&& type != typeof (IDynamicMetaObjectProvider)
|
||||
#endif
|
||||
);
|
||||
@@ -1204,7 +1204,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
private object CreateDynamic(JsonReader reader, JsonDynamicContract contract, JsonProperty member, string id)
|
||||
{
|
||||
IDynamicMetaObjectProvider newObject;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Diagnostics;
|
||||
@@ -152,7 +152,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
JsonDictionaryContract dictionaryContract = (JsonDictionaryContract) valueContract;
|
||||
SerializeDictionary(writer, dictionaryContract.CreateWrapper(value), dictionaryContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
case JsonContractType.Dynamic:
|
||||
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
@@ -710,7 +710,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
private void SerializeDynamic(JsonWriter writer, IDynamicMetaObjectProvider value, JsonDynamicContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
|
||||
{
|
||||
OnSerializing(writer, contract, value);
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static TimeSpan ParseTimeSpan(string input)
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || WINDOWS_PHONE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
return TimeSpan.Parse((string) input, CultureInfo.InvariantCulture);
|
||||
#else
|
||||
return TimeSpan.Parse((string)input);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE || PORTABLE)
|
||||
#if !(NET35 || NET20 || WINDOWS_PHONE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
@@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
MethodInfo createArgumentInfoMethod = csharpArgumentInfoType.GetMethod("Create", BindingFlags.Public | BindingFlags.Static, null, new[] { csharpArgumentInfoFlags, typeof(string) }, null);
|
||||
MethodInfo createArgumentInfoMethod = csharpArgumentInfoType.GetMethod("Create", new[] { csharpArgumentInfoFlags, typeof(string) });
|
||||
object arg = createArgumentInfoMethod.Invoke(null, new object[] { 0, null });
|
||||
a.SetValue(arg, i);
|
||||
}
|
||||
@@ -101,10 +101,10 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
Type csharpArgumentInfoTypeEnumerableType = typeof(IEnumerable<>).MakeGenericType(csharpArgumentInfoType);
|
||||
|
||||
MethodInfo getMemberMethod = binderType.GetMethod("GetMember", BindingFlags.Public | BindingFlags.Static, null, new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType }, null);
|
||||
MethodInfo getMemberMethod = binderType.GetMethod("GetMember", new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType });
|
||||
_getMemberCall = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(getMemberMethod);
|
||||
|
||||
MethodInfo setMemberMethod = binderType.GetMethod("SetMember", BindingFlags.Public | BindingFlags.Static, null, new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType }, null);
|
||||
MethodInfo setMemberMethod = binderType.GetMethod("SetMember", new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType });
|
||||
_setMemberCall = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(setMemberMethod);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user