-Readded .NET 4, SL4, WP7, Win8 portable library
-Disable SL library build
This commit is contained in:
+2
-1
@@ -19,9 +19,10 @@
|
|||||||
$builds = @(
|
$builds = @(
|
||||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true},
|
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+sl5+windowsphone8+win8"; Framework="net-4.0"; Sign=$true},
|
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+sl5+windowsphone8+win8"; Framework="net-4.0"; Sign=$true},
|
||||||
|
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl4+wp7+win8"; Framework="net-4.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.WinRT"; TestsName = $null; Constants="NETFX_CORE"; FinalDir="WinRT"; NuGetDir = "netcore45"; Framework="net-4.5"; Sign=$true},
|
@{Name = "Newtonsoft.Json.WinRT"; TestsName = $null; Constants="NETFX_CORE"; FinalDir="WinRT"; NuGetDir = "netcore45"; Framework="net-4.5"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.WindowsPhone"; TestsName = $null; Constants="SILVERLIGHT;WINDOWS_PHONE"; FinalDir="WindowsPhone"; NuGetDir = "windowsphone8"; Framework="net-4.0"; Sign=$true},
|
@{Name = "Newtonsoft.Json.WindowsPhone"; TestsName = $null; Constants="SILVERLIGHT;WINDOWS_PHONE"; FinalDir="WindowsPhone"; NuGetDir = "windowsphone8"; Framework="net-4.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"; NuGetDir = "sl5"; Framework="net-4.0"; Sign=$true},
|
#@{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"; NuGetDir = "sl5"; Framework="net-4.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"; Sign=$true},
|
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"; Sign=$true},
|
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"; Sign=$true},
|
||||||
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"; Sign=$true}
|
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"; Sign=$true}
|
||||||
|
|||||||
+12
-12
@@ -2,33 +2,33 @@ Versions:
|
|||||||
|
|
||||||
Json.NET comes in different versions for the various .NET frameworks.
|
Json.NET comes in different versions for the various .NET frameworks.
|
||||||
|
|
||||||
|
-Net45:
|
||||||
|
.NET latest (4.5)
|
||||||
|
|
||||||
-Net40:
|
-Net40:
|
||||||
.NET latest (4.0 & 4.5)
|
.NET 4.0
|
||||||
|
|
||||||
-Net35:
|
-Net35:
|
||||||
.NET 3.5 SP1
|
.NET 3.5
|
||||||
|
|
||||||
-Net20:
|
-Net20:
|
||||||
.NET 2.0
|
.NET 2.0
|
||||||
|
|
||||||
-Silverlight:
|
|
||||||
Silverlight 4 & 5
|
|
||||||
|
|
||||||
-WindowsPhone:
|
-WindowsPhone:
|
||||||
Windows Phone 7 & 7.1
|
Windows Phone 8
|
||||||
|
|
||||||
-WinRT:
|
-WinRT:
|
||||||
Windows 8 Store, WinRT 4.5
|
Windows 8 Store
|
||||||
|
|
||||||
-Portable:
|
-Portable45:
|
||||||
.NET 4.0, Silverlight 4, Windows Phone 7, WinRT 4.5
|
.NET 4.5, Windows Phone 8, Windows 8 Store
|
||||||
|
|
||||||
|
-Portable40:
|
||||||
|
.NET 4.0, Windows Phone 7, Windows 8 Store, Silverlight 4
|
||||||
|
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
The Silverlight and Windows Phone builds are not strong-named.
|
|
||||||
Use the assemblies in the Signed sub-directories for the strong-named versions.
|
|
||||||
|
|
||||||
Microsoft stopped support for the Compact Framework in Visual Studio 2010.
|
Microsoft stopped support for the Compact Framework in Visual Studio 2010.
|
||||||
For a Compact Framework 3.5 build download Json.NET 3.5.
|
For a Compact Framework 3.5 build download Json.NET 3.5.
|
||||||
|
|
||||||
|
|||||||
@@ -1365,7 +1365,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
public class BigIntegerTestClass
|
public class BigIntegerTestClass
|
||||||
{
|
{
|
||||||
public BigInteger Blah { get; set; }
|
public BigInteger Blah { get; set; }
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
|||||||
Assert.AreEqual("10-00-00-00-09-30-00-C8-88-07-6B-DC-00-00-00-00", (BitConverter.ToString(ms.ToArray())));
|
Assert.AreEqual("10-00-00-00-09-30-00-C8-88-07-6B-DC-00-00-00-00", (BitConverter.ToString(ms.ToArray())));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void WriteBigInteger()
|
public void WriteBigInteger()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
|||||||
public byte[] NullByteArray { get; set; }
|
public byte[] NullByteArray { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeBinaryClass()
|
public void DeserializeBinaryClass()
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
public class SqlBinaryClass
|
public class SqlBinaryClass
|
||||||
{
|
{
|
||||||
public SqlBinary SqlBinary { get; set; }
|
public SqlBinary SqlBinary { get; set; }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
#if !NETFX_CORE
|
#if !NETFX_CORE
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
#if !NETFX_CORE
|
#if !NETFX_CORE
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Tests.Serialization;
|
using Newtonsoft.Json.Tests.Serialization;
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ now brown cow?", '"', true);
|
|||||||
value = null;
|
value = null;
|
||||||
Assert.AreEqual("null", JsonConvert.ToString(value));
|
Assert.AreEqual("null", JsonConvert.ToString(value));
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
value = DBNull.Value;
|
value = DBNull.Value;
|
||||||
Assert.AreEqual("null", JsonConvert.ToString(value));
|
Assert.AreEqual("null", JsonConvert.ToString(value));
|
||||||
#endif
|
#endif
|
||||||
@@ -636,7 +636,7 @@ now brown cow?", '"', true);
|
|||||||
return (T)converter.ReadJson(reader, typeof(T), null, null);
|
return (T)converter.ReadJson(reader, typeof(T), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void Async()
|
public void Async()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ namespace Newtonsoft.Json.Tests
|
|||||||
Assert.IsNotNull(validationEventArgs);
|
Assert.IsNotNull(validationEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void IntegerGreaterThanMaximumValue_BigInteger()
|
public void IntegerGreaterThanMaximumValue_BigInteger()
|
||||||
{
|
{
|
||||||
@@ -606,7 +606,7 @@ namespace Newtonsoft.Json.Tests
|
|||||||
Assert.IsNotNull(validationEventArgs);
|
Assert.IsNotNull(validationEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void BigIntegerDivisibleBy_Success()
|
public void BigIntegerDivisibleBy_Success()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ Parameter name: index",
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ITypedListGetItemProperties()
|
public void ITypedListGetItemProperties()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ Parameter name: arrayIndex",
|
|||||||
Assert.AreEqual(p4, l[1]);
|
Assert.AreEqual(p4, l[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void PropertyChanging()
|
public void PropertyChanging()
|
||||||
{
|
{
|
||||||
@@ -1243,7 +1243,7 @@ Parameter name: arrayIndex",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void IBindingListSortDirection()
|
public void IBindingListSortDirection()
|
||||||
{
|
{
|
||||||
@@ -1446,7 +1446,7 @@ Parameter name: arrayIndex",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void CollectionChanged()
|
public void CollectionChanged()
|
||||||
{
|
{
|
||||||
@@ -1576,7 +1576,7 @@ Parameter name: arrayIndex",
|
|||||||
Assert.AreEqual("Name2", value);
|
Assert.AreEqual("Name2", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void WriteObjectNullDBNullValue()
|
public void WriteObjectNullDBNullValue()
|
||||||
{
|
{
|
||||||
@@ -1632,7 +1632,7 @@ Parameter name: arrayIndex",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void NumberTooBigForInt64()
|
public void NumberTooBigForInt64()
|
||||||
{
|
{
|
||||||
@@ -1707,7 +1707,7 @@ Parameter name: arrayIndex",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void GetProperties()
|
public void GetProperties()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.AreEqual(p, p.Value.Parent);
|
Assert.AreEqual(p, p.Value.Parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ListChanged()
|
public void ListChanged()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
|
|
||||||
Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase)));
|
Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990";
|
string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990";
|
||||||
|
|
||||||
Assert.AreEqual(BigInteger.Parse(bigIntegerText), (BigInteger)(new JValue(bigIntegerText)));
|
Assert.AreEqual(BigInteger.Parse(bigIntegerText), (BigInteger)(new JValue(bigIntegerText)));
|
||||||
@@ -424,7 +424,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
#endif
|
#endif
|
||||||
ExceptionAssert.Throws<ArgumentException>("Can not convert Boolean to Uri.", () => { var i = (Uri)new JValue(true); });
|
ExceptionAssert.Throws<ArgumentException>("Can not convert Boolean to Uri.", () => { var i = (Uri)new JValue(true); });
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
ExceptionAssert.Throws<ArgumentException>("Can not convert Uri to BigInteger.", () => { var i = (BigInteger)new JValue(new Uri("http://www.google.com")); });
|
ExceptionAssert.Throws<ArgumentException>("Can not convert Uri to BigInteger.", () => { var i = (BigInteger)new JValue(new Uri("http://www.google.com")); });
|
||||||
ExceptionAssert.Throws<ArgumentException>("Can not convert Null to BigInteger.", () => { var i = (BigInteger)new JValue((object)null); });
|
ExceptionAssert.Throws<ArgumentException>("Can not convert Null to BigInteger.", () => { var i = (BigInteger)new JValue((object)null); });
|
||||||
ExceptionAssert.Throws<ArgumentException>("Can not convert Guid to BigInteger.", () => { var i = (BigInteger)new JValue(Guid.NewGuid()); });
|
ExceptionAssert.Throws<ArgumentException>("Can not convert Guid to BigInteger.", () => { var i = (BigInteger)new JValue(Guid.NewGuid()); });
|
||||||
@@ -488,7 +488,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null));
|
Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
Assert.IsTrue(JToken.DeepEquals(new JValue(new BigInteger(1)), (JValue)new BigInteger(1)));
|
Assert.IsTrue(JToken.DeepEquals(new JValue(new BigInteger(1)), (JValue)new BigInteger(1)));
|
||||||
Assert.IsTrue(JToken.DeepEquals(new JValue((BigInteger?)null), (JValue)(BigInteger?)null));
|
Assert.IsTrue(JToken.DeepEquals(new JValue((BigInteger?)null), (JValue)(BigInteger?)null));
|
||||||
#endif
|
#endif
|
||||||
@@ -926,7 +926,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.IsTrue(a.DeepEquals(a2));
|
Assert.IsTrue(a.DeepEquals(a2));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void Clone()
|
public void Clone()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.AreEqual("Pie", v.Value);
|
Assert.AreEqual("Pie", v.Value);
|
||||||
Assert.AreEqual(JTokenType.String, v.Type);
|
Assert.AreEqual(JTokenType.String, v.Type);
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
v.Value = DBNull.Value;
|
v.Value = DBNull.Value;
|
||||||
Assert.AreEqual(DBNull.Value, v.Value);
|
Assert.AreEqual(DBNull.Value, v.Value);
|
||||||
Assert.AreEqual(JTokenType.Null, v.Type);
|
Assert.AreEqual(JTokenType.Null, v.Type);
|
||||||
@@ -115,7 +115,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.AreEqual(g, v.Value);
|
Assert.AreEqual(g, v.Value);
|
||||||
Assert.AreEqual(JTokenType.Guid, v.Type);
|
Assert.AreEqual(JTokenType.Guid, v.Type);
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990");
|
BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990");
|
||||||
v.Value = i;
|
v.Value = i;
|
||||||
Assert.AreEqual(i, v.Value);
|
Assert.AreEqual(i, v.Value);
|
||||||
@@ -175,13 +175,13 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
v = new JValue(new Guid("B282ADE7-C520-496C-A448-4084F6803DE5"));
|
v = new JValue(new Guid("B282ADE7-C520-496C-A448-4084F6803DE5"));
|
||||||
Assert.AreEqual("b282ade7-c520-496c-a448-4084f6803de5", v.ToString(null, CultureInfo.InvariantCulture));
|
Assert.AreEqual("b282ade7-c520-496c-a448-4084f6803de5", v.ToString(null, CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"));
|
v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"));
|
||||||
Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture));
|
Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void JValueParse()
|
public void JValueParse()
|
||||||
{
|
{
|
||||||
@@ -456,7 +456,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue)));
|
Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ConvertsToInt32_BigInteger()
|
public void ConvertsToInt32_BigInteger()
|
||||||
{
|
{
|
||||||
@@ -593,7 +593,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
v = new JValue(new Uri("http://www.google.com"));
|
v = new JValue(new Uri("http://www.google.com"));
|
||||||
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
v = new JValue(new BigInteger(3));
|
v = new JValue(new BigInteger(3));
|
||||||
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
||||||
#endif
|
#endif
|
||||||
@@ -622,7 +622,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
|||||||
Assert.AreEqual("2013", v.ToString("yyyy"));
|
Assert.AreEqual("2013", v.ToString("yyyy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ToStringNewTypes()
|
public void ToStringNewTypes()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ keyword such as type of business.""
|
|||||||
Assert.AreEqual(new DateTime(2000, 10, 15, 5, 5, 5, DateTimeKind.Utc), d);
|
Assert.AreEqual(new DateTime(2000, 10, 15, 5, 5, 5, DateTimeKind.Utc), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void CovariantIJEnumerable()
|
public void CovariantIJEnumerable()
|
||||||
{
|
{
|
||||||
@@ -733,6 +733,19 @@ keyword such as type of business.""
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !NET20
|
||||||
|
[Test]
|
||||||
|
public void LinqCast()
|
||||||
|
{
|
||||||
|
JToken olist = JArray.Parse("[12,55]");
|
||||||
|
|
||||||
|
List<int> list1 = olist.AsEnumerable().Values<int>().ToList();
|
||||||
|
|
||||||
|
Assert.AreEqual(12, list1[0]);
|
||||||
|
Assert.AreEqual(55, list1[1]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ChildrenExtension()
|
public void ChildrenExtension()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ using System.Security;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("4.5.0.0")]
|
[assembly: AssemblyVersion("4.5.0.0")]
|
||||||
[assembly: AssemblyFileVersion("5.0.1.16001")]
|
[assembly: AssemblyFileVersion("5.0.1.16006")]
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
#if !NET20
|
#if !NET20
|
||||||
GenerateSchemaAndSerializeFromType(new NullableDateTimeTestClass());
|
GenerateSchemaAndSerializeFromType(new NullableDateTimeTestClass());
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
GenerateSchemaAndSerializeFromType(new DataSet());
|
GenerateSchemaAndSerializeFromType(new DataSet());
|
||||||
#endif
|
#endif
|
||||||
GenerateSchemaAndSerializeFromType(new object());
|
GenerateSchemaAndSerializeFromType(new object());
|
||||||
@@ -210,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
GenerateSchemaAndSerializeFromType("Hi");
|
GenerateSchemaAndSerializeFromType("Hi");
|
||||||
GenerateSchemaAndSerializeFromType(new DateTime(2000, 12, 29, 23, 59, 0, DateTimeKind.Utc));
|
GenerateSchemaAndSerializeFromType(new DateTime(2000, 12, 29, 23, 59, 0, DateTimeKind.Utc));
|
||||||
GenerateSchemaAndSerializeFromType(TimeSpan.FromTicks(1000000));
|
GenerateSchemaAndSerializeFromType(TimeSpan.FromTicks(1000000));
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
GenerateSchemaAndSerializeFromType(DBNull.Value);
|
GenerateSchemaAndSerializeFromType(DBNull.Value);
|
||||||
#endif
|
#endif
|
||||||
GenerateSchemaAndSerializeFromType(new JsonPropertyWithHandlingValues());
|
GenerateSchemaAndSerializeFromType(new JsonPropertyWithHandlingValues());
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
Assert.IsTrue(o.IsValid(schema));
|
Assert.IsTrue(o.IsValid(schema));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void Generate_DefaultValueAttributeTestClass()
|
public void Generate_DefaultValueAttributeTestClass()
|
||||||
{
|
{
|
||||||
@@ -310,7 +310,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
Assert.IsTrue(v.IsValid(schema));
|
Assert.IsTrue(v.IsValid(schema));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void GenerateSchemaForISerializable()
|
public void GenerateSchemaForISerializable()
|
||||||
{
|
{
|
||||||
@@ -325,7 +325,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void GenerateSchemaForDBNull()
|
public void GenerateSchemaForDBNull()
|
||||||
{
|
{
|
||||||
@@ -519,7 +519,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void GenerateSchemaSerializable()
|
public void GenerateSchemaSerializable()
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -102,7 +102,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
string json = o.ToString();
|
string json = o.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void MemberSearchFlags()
|
public void MemberSearchFlags()
|
||||||
{
|
{
|
||||||
@@ -177,7 +177,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DynamicCamelCasePropertyNames()
|
public void DynamicCamelCasePropertyNames()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}", startingWithB);
|
}", startingWithB);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeCompilerGeneratedMembers()
|
public void SerializeCompilerGeneratedMembers()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -100,7 +100,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
Assert.AreEqual(dynamicObject.ChildObject.Text, d.ChildObject.Text);
|
Assert.AreEqual(dynamicObject.ChildObject.Text, d.ChildObject.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !PORTABLE
|
#if !(PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeDynamicObjectWithObjectTracking()
|
public void SerializeDynamicObjectWithObjectTracking()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20 || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(NET35 || NET20 || SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|||||||
@@ -792,7 +792,7 @@ keyword such as type of business.""
|
|||||||
ConverableMembers c = JsonConvert.DeserializeObject<ConverableMembers>(json);
|
ConverableMembers c = JsonConvert.DeserializeObject<ConverableMembers>(json);
|
||||||
Assert.AreEqual("string", c.String);
|
Assert.AreEqual("string", c.String);
|
||||||
Assert.AreEqual(double.MaxValue, c.Double);
|
Assert.AreEqual(double.MaxValue, c.Double);
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
Assert.AreEqual(DBNull.Value, c.DBNull);
|
Assert.AreEqual(DBNull.Value, c.DBNull);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1611,7 +1611,7 @@ keyword such as type of business.""
|
|||||||
Assert.AreEqual("titleId", n.FidOrder[n.FidOrder.Count - 1]);
|
Assert.AreEqual("titleId", n.FidOrder[n.FidOrder.Count - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[MetadataType(typeof(OptInClassMetadata))]
|
[MetadataType(typeof(OptInClassMetadata))]
|
||||||
public class OptInClass
|
public class OptInClass
|
||||||
{
|
{
|
||||||
@@ -2162,7 +2162,7 @@ Path '', line 1, position 1.",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void CannotDeserializeArrayIntoDynamic()
|
public void CannotDeserializeArrayIntoDynamic()
|
||||||
{
|
{
|
||||||
@@ -3007,7 +3007,7 @@ Path '', line 1, position 2.",
|
|||||||
Assert.AreEqual("value", newModelStateDictionary["key"]);
|
Assert.AreEqual("value", newModelStateDictionary["key"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
public class ISerializableTestObject : ISerializable
|
public class ISerializableTestObject : ISerializable
|
||||||
{
|
{
|
||||||
internal string _stringValue;
|
internal string _stringValue;
|
||||||
@@ -3504,7 +3504,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET20 || SILVERLIGHT)
|
#if !(NET20 || SILVERLIGHT || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeDeserializeXNodeProperties()
|
public void SerializeDeserializeXNodeProperties()
|
||||||
{
|
{
|
||||||
@@ -3535,7 +3535,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeDeserializeXmlNodeProperties()
|
public void SerializeDeserializeXmlNodeProperties()
|
||||||
{
|
{
|
||||||
@@ -4391,7 +4391,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeExpandoObject()
|
public void SerializeExpandoObject()
|
||||||
{
|
{
|
||||||
@@ -5396,7 +5396,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeException1()
|
public void SerializeException1()
|
||||||
{
|
{
|
||||||
@@ -5526,7 +5526,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE)
|
#if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeConcurrentDictionary()
|
public void DeserializeConcurrentDictionary()
|
||||||
{
|
{
|
||||||
@@ -6474,7 +6474,7 @@ Parameter name: value",
|
|||||||
Assert.AreEqual("", s);
|
Assert.AreEqual("", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeAndDeserializeWithAttributes()
|
public void SerializeAndDeserializeWithAttributes()
|
||||||
{
|
{
|
||||||
@@ -6640,7 +6640,7 @@ Parameter name: value",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeException()
|
public void DeserializeException()
|
||||||
{
|
{
|
||||||
@@ -6678,7 +6678,7 @@ Parameter name: value",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AdditionalContentAfterFinish()
|
public void AdditionalContentAfterFinish()
|
||||||
{
|
{
|
||||||
ExceptionAssert.Throws<JsonException>(
|
ExceptionAssert.Throws<JsonException>(
|
||||||
@@ -6896,7 +6896,7 @@ Parameter name: value",
|
|||||||
Assert.AreEqual("[1.1,0.0,0.0]", json);
|
Assert.AreEqual("[1.1,0.0,0.0]", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || NET40 || SILVERLIGHT)
|
#if !(NET20 || NET35 || NET40 || SILVERLIGHT || PORTABLE40)
|
||||||
#if !PORTABLE
|
#if !PORTABLE
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeReadOnlyListWithBigInteger()
|
public void DeserializeReadOnlyListWithBigInteger()
|
||||||
@@ -6958,7 +6958,7 @@ Parameter name: value",
|
|||||||
obj = JsonConvert.DeserializeObject<MyTuple<int>>(json);
|
obj = JsonConvert.DeserializeObject<MyTuple<int>>(json);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
doStuff();
|
doStuff();
|
||||||
Assert.AreEqual(500, obj.Item1);
|
Assert.AreEqual(500, obj.Item1);
|
||||||
#else
|
#else
|
||||||
@@ -6991,7 +6991,7 @@ Parameter name: value",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || NET35 || NET20)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeTupleWithSerializableAttribute()
|
public void SerializeTupleWithSerializableAttribute()
|
||||||
{
|
{
|
||||||
@@ -7679,7 +7679,7 @@ Parameter name: value",
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(PORTABLE || NET35 || NET20 || SILVERLIGHT)
|
#if !(PORTABLE || NET35 || NET20 || SILVERLIGHT || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ReadTooLargeInteger()
|
public void ReadTooLargeInteger()
|
||||||
{
|
{
|
||||||
@@ -7773,7 +7773,7 @@ Parameter name: value",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(PORTABLE || NET20 || NET35)
|
#if !(NET20 || NET35 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void HashSetInterface()
|
public void HashSetInterface()
|
||||||
{
|
{
|
||||||
@@ -7846,7 +7846,7 @@ Parameter name: value",
|
|||||||
Assert.AreEqual(1234567890.123456m, d);
|
Assert.AreEqual(1234567890.123456m, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(PORTABLE || SILVERLIGHT || NETFX_CORE || WINDOWS_PHONE)
|
#if !(PORTABLE || SILVERLIGHT || NETFX_CORE || WINDOWS_PHONE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DontSerializeStaticFields()
|
public void DontSerializeStaticFields()
|
||||||
{
|
{
|
||||||
@@ -7880,7 +7880,7 @@ Parameter name: value",
|
|||||||
Assert.AreEqual("string!", l[0]);
|
Assert.AreEqual("string!", l[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeBigInteger()
|
public void SerializeBigInteger()
|
||||||
{
|
{
|
||||||
@@ -7894,7 +7894,7 @@ Parameter name: value",
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeReadOnlyListInterface()
|
public void DeserializeReadOnlyListInterface()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}", json);
|
}", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(PORTABLE || SILVERLIGHT || NETFX_CORE)
|
#if !(PORTABLE || SILVERLIGHT || NETFX_CORE || PORTABLE40)
|
||||||
public class MainClass : ISerializable
|
public class MainClass : ISerializable
|
||||||
{
|
{
|
||||||
public ChildClass Child { get; set; }
|
public ChildClass Child { get; set; }
|
||||||
@@ -210,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET20 || NET35)
|
#if !(NET20 || NET35 || PORTABLE40)
|
||||||
public class DictionaryDynamicObject : DynamicObject
|
public class DictionaryDynamicObject : DynamicObject
|
||||||
{
|
{
|
||||||
public IDictionary<string, object> Values { get; private set; }
|
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]);
|
Assert.AreEqual(@"Unexpected end when deserializing object. Path 'events2.code', line 1, position 49.", errors[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void ErrorHandlingEndOfContentDynamic()
|
public void ErrorHandlingEndOfContentDynamic()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TraceWriterTests : TestFixtureBase
|
public class TraceWriterTests : TestFixtureBase
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DiagnosticsTraceWriterTest()
|
public void DiagnosticsTraceWriterTest()
|
||||||
{
|
{
|
||||||
@@ -458,7 +458,7 @@ Newtonsoft.Json Error: 0 : Error!
|
|||||||
Assert.AreEqual("Finished deserializing System.Collections.Generic.List`1[System.Object]. Path '$values', line 17, position 4.", traceWriter.TraceRecords[9].Message);
|
Assert.AreEqual("Finished deserializing System.Collections.Generic.List`1[System.Object]. Path '$values', line 17, position 4.", traceWriter.TraceRecords[9].Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE || SILVERLIGHT)
|
#if !(NETFX_CORE || PORTABLE || SILVERLIGHT || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void DeserializeISerializable()
|
public void DeserializeISerializable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !PORTABLE
|
#if !(PORTABLE || PORTABLE40)
|
||||||
#if !(NET35 || NET20 || PORTABLE)
|
#if !(NET35 || NET20 || PORTABLE)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
#endif
|
#endif
|
||||||
@@ -1445,7 +1445,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
Assert.AreEqual(1, (int)j["MyProperty"]);
|
Assert.AreEqual(1, (int)j["MyProperty"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void PropertyItemTypeNameHandlingDynamic()
|
public void PropertyItemTypeNameHandlingDynamic()
|
||||||
{
|
{
|
||||||
@@ -1651,7 +1651,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
public TypeNameHandlingTestObject Data { get; set; }
|
public TypeNameHandlingTestObject Data { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
public class PropertyItemTypeNameHandlingDynamic
|
public class PropertyItemTypeNameHandlingDynamic
|
||||||
{
|
{
|
||||||
[JsonProperty(ItemTypeNameHandling = TypeNameHandling.All)]
|
[JsonProperty(ItemTypeNameHandling = TypeNameHandling.All)]
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
nonSerializedField = "Error"
|
nonSerializedField = "Error"
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || NET20 || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || NET20 || PORTABLE || PORTABLE40)
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream();
|
||||||
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(SerializableType));
|
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(SerializableType));
|
||||||
dataContractJsonSerializer.WriteObject(ms, serializableType);
|
dataContractJsonSerializer.WriteObject(ms, serializableType);
|
||||||
@@ -74,17 +74,17 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
string json = JsonConvert.SerializeObject(serializableType, new JsonSerializerSettings
|
string json = JsonConvert.SerializeObject(serializableType, new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
ContractResolver = new DefaultContractResolver
|
ContractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
IgnoreSerializableAttribute = false
|
IgnoreSerializableAttribute = false
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.AreEqual(expected, json);
|
Assert.AreEqual(expected, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeInheritedType()
|
public void SerializeInheritedType()
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#else
|
#else
|
||||||
[JsonObject(MemberSerialization.Fields)]
|
[JsonObject(MemberSerialization.Fields)]
|
||||||
@@ -144,7 +144,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
#else
|
#else
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#if !NETFX_CORE
|
#if !NETFX_CORE
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !PORTABLE
|
#if !(PORTABLE || PORTABLE40)
|
||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Collections.Generic;
|
using global::System.Collections.Generic;
|
||||||
using global::System.Runtime.Serialization.Formatters;
|
using global::System.Runtime.Serialization.Formatters;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
_writer.Close();
|
_writer.Close();
|
||||||
#else
|
#else
|
||||||
_writer.Dispose();
|
_writer.Dispose();
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
base.Close();
|
base.Close();
|
||||||
|
|
||||||
if (CloseInput && _reader != null)
|
if (CloseInput && _reader != null)
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
_reader.Close();
|
_reader.Close();
|
||||||
#else
|
#else
|
||||||
_reader.Dispose();
|
_reader.Dispose();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -360,7 +360,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
{
|
{
|
||||||
base.WriteValue(value);
|
base.WriteValue(value);
|
||||||
string s = null;
|
string s = null;
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
s = value.ToString(CultureInfo.InvariantCulture);
|
s = value.ToString(CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
s = value.ToString();
|
s = value.ToString();
|
||||||
@@ -462,7 +462,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
AddToken(new BsonString(value.ToString(), true));
|
AddToken(new BsonString(value.ToString(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a <see cref="BigInteger"/> value.
|
/// Writes a <see cref="BigInteger"/> value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if (!(SILVERLIGHT) || WINDOWS_PHONE)
|
#if (!(SILVERLIGHT) || WINDOWS_PHONE) && !PORTABLE40
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
#if !NET20
|
#if !(NET20 || PORTABLE40)
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
@@ -41,7 +41,7 @@ using System.Linq;
|
|||||||
namespace Newtonsoft.Json.Converters
|
namespace Newtonsoft.Json.Converters
|
||||||
{
|
{
|
||||||
#region XmlNodeWrappers
|
#region XmlNodeWrappers
|
||||||
#if !SILVERLIGHT && !NETFX_CORE && !PORTABLE
|
#if !SILVERLIGHT && !NETFX_CORE && !PORTABLE && !PORTABLE40
|
||||||
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
|
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
|
||||||
{
|
{
|
||||||
private readonly XmlDocument _document;
|
private readonly XmlDocument _document;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if SILVERLIGHT || PocketPC || NETFX_CORE || PORTABLE
|
#if SILVERLIGHT || PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
|
||||||
namespace System.Runtime.Serialization.Formatters
|
namespace System.Runtime.Serialization.Formatters
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -26,10 +26,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
@@ -37,7 +37,7 @@ using Newtonsoft.Json.Utilities;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
#if !NET20 && (!SILVERLIGHT || WINDOWS_PHONE)
|
#if !NET20 && (!SILVERLIGHT || WINDOWS_PHONE) && !PORTABLE40
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ namespace Newtonsoft.Json
|
|||||||
return value.ToString(null, CultureInfo.InvariantCulture);
|
return value.ToString(null, CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the <see cref="BigInteger"/> to its JSON string representation.
|
/// Converts the <see cref="BigInteger"/> to its JSON string representation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -547,7 +547,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
string text = null;
|
string text = null;
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
text = value.ToString("D", CultureInfo.InvariantCulture);
|
text = value.ToString("D", CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
text = value.ToString("D");
|
text = value.ToString("D");
|
||||||
@@ -671,7 +671,7 @@ namespace Newtonsoft.Json
|
|||||||
return ToString((Uri) value);
|
return ToString((Uri) value);
|
||||||
case PrimitiveTypeCode.TimeSpan:
|
case PrimitiveTypeCode.TimeSpan:
|
||||||
return ToString((TimeSpan) value);
|
return ToString((TimeSpan) value);
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
case PrimitiveTypeCode.BigInteger:
|
case PrimitiveTypeCode.BigInteger:
|
||||||
return ToString((BigInteger) value);
|
return ToString((BigInteger) value);
|
||||||
#endif
|
#endif
|
||||||
@@ -929,7 +929,7 @@ namespace Newtonsoft.Json
|
|||||||
return sw.ToString();
|
return sw.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
|
/// Asynchronously serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1122,7 +1122,7 @@ namespace Newtonsoft.Json
|
|||||||
return jsonSerializer.Deserialize(new JsonTextReader(sr), type);
|
return jsonSerializer.Deserialize(new JsonTextReader(sr), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously deserializes the JSON to the specified .NET type.
|
/// Asynchronously deserializes the JSON to the specified .NET type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1217,7 +1217,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously populates the object with values from the JSON string.
|
/// Asynchronously populates the object with values from the JSON string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1236,7 +1236,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serializes the XML node to a JSON string.
|
/// Serializes the XML node to a JSON string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1315,7 +1315,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !NET20 && (!(SILVERLIGHT) || WINDOWS_PHONE)
|
#if !NET20 && (!(SILVERLIGHT) || WINDOWS_PHONE) && !PORTABLE40
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serializes the <see cref="XNode"/> to a JSON string.
|
/// Serializes the <see cref="XNode"/> to a JSON string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception thrown when an error occurs during Json serialization or deserialization.
|
/// The exception thrown when an error occurs during Json serialization or deserialization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#endif
|
#endif
|
||||||
public class JsonException : Exception
|
public class JsonException : Exception
|
||||||
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonException"/> class.
|
/// Initializes a new instance of the <see cref="JsonException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception thrown when an error occurs while reading Json text.
|
/// The exception thrown when an error occurs while reading Json text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#endif
|
#endif
|
||||||
public class JsonReaderException : JsonException
|
public class JsonReaderException : JsonException
|
||||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonReaderException"/> class.
|
/// Initializes a new instance of the <see cref="JsonReaderException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception thrown when an error occurs during Json serialization or deserialization.
|
/// The exception thrown when an error occurs during Json serialization or deserialization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#endif
|
#endif
|
||||||
public class JsonSerializationException : JsonException
|
public class JsonSerializationException : JsonException
|
||||||
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
|
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -1257,7 +1257,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
numberValue = BigInteger.Parse(number, CultureInfo.InvariantCulture);
|
numberValue = BigInteger.Parse(number, CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
// todo - validate number was a valid integer to make sure overflow was the reason for failure
|
// todo - validate number was a valid integer to make sure overflow was the reason for failure
|
||||||
@@ -1503,7 +1503,7 @@ namespace Newtonsoft.Json
|
|||||||
base.Close();
|
base.Close();
|
||||||
|
|
||||||
if (CloseInput && _reader != null)
|
if (CloseInput && _reader != null)
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
_reader.Close();
|
_reader.Close();
|
||||||
#else
|
#else
|
||||||
_reader.Dispose();
|
_reader.Dispose();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -143,7 +143,7 @@ namespace Newtonsoft.Json
|
|||||||
base.Close();
|
base.Close();
|
||||||
|
|
||||||
if (CloseOutput && _writer != null)
|
if (CloseOutput && _writer != null)
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
_writer.Close();
|
_writer.Close();
|
||||||
#else
|
#else
|
||||||
_writer.Dispose();
|
_writer.Dispose();
|
||||||
@@ -598,7 +598,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a <see cref="BigInteger"/> value.
|
/// Writes a <see cref="BigInteger"/> value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
@@ -735,7 +735,7 @@ namespace Newtonsoft.Json
|
|||||||
if (schema.DivisibleBy != null)
|
if (schema.DivisibleBy != null)
|
||||||
{
|
{
|
||||||
bool notDivisible;
|
bool notDivisible;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (value is BigInteger)
|
if (value is BigInteger)
|
||||||
{
|
{
|
||||||
// not that this will lose any decimal point on DivisibleBy
|
// not that this will lose any decimal point on DivisibleBy
|
||||||
@@ -749,7 +749,7 @@ namespace Newtonsoft.Json
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
notDivisible = !IsZero(Convert.ToInt64(value, CultureInfo.InvariantCulture) % schema.DivisibleBy.Value);
|
notDivisible = !IsZero(Convert.ToInt64(value, CultureInfo.InvariantCulture) % schema.DivisibleBy.Value);
|
||||||
|
|
||||||
if (notDivisible)
|
if (notDivisible)
|
||||||
RaiseError("Integer {0} is not evenly divisible by {1}.".FormatWith(CultureInfo.InvariantCulture, JsonConvert.ToString(value), schema.DivisibleBy), schema);
|
RaiseError("Integer {0} is not evenly divisible by {1}.".FormatWith(CultureInfo.InvariantCulture, JsonConvert.ToString(value), schema.DivisibleBy), schema);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
@@ -1231,7 +1231,7 @@ namespace Newtonsoft.Json
|
|||||||
InternalWriteValue(JsonToken.String);
|
InternalWriteValue(JsonToken.String);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a <see cref="BigInteger"/> value.
|
/// Writes a <see cref="BigInteger"/> value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1419,7 +1419,7 @@ namespace Newtonsoft.Json
|
|||||||
case PrimitiveTypeCode.TimeSpanNullable:
|
case PrimitiveTypeCode.TimeSpanNullable:
|
||||||
writer.WriteValue((value == null) ? (TimeSpan?)null : (TimeSpan)value);
|
writer.WriteValue((value == null) ? (TimeSpan?)null : (TimeSpan)value);
|
||||||
break;
|
break;
|
||||||
#if !(PORTABLE || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
||||||
case PrimitiveTypeCode.BigInteger:
|
case PrimitiveTypeCode.BigInteger:
|
||||||
writer.WriteValue((BigInteger)value);
|
writer.WriteValue((BigInteger)value);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The exception thrown when an error occurs while reading Json text.
|
/// The exception thrown when an error occurs while reading Json text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#endif
|
#endif
|
||||||
public class JsonWriterException : JsonException
|
public class JsonWriterException : JsonException
|
||||||
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonWriterException"/> class.
|
/// Initializes a new instance of the <see cref="JsonWriterException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of token</typeparam>
|
/// <typeparam name="T">The type of token</typeparam>
|
||||||
public interface IJEnumerable<
|
public interface IJEnumerable<
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40)
|
||||||
out
|
out
|
||||||
#endif
|
#endif
|
||||||
T> : IEnumerable<T> where T : JToken
|
T> : IEnumerable<T> where T : JToken
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
#if !PORTABLE40
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
#endif
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@@ -43,17 +45,17 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Represents a token that can contain other tokens.
|
/// Represents a token that can contain other tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class JContainer : JToken, IList<JToken>
|
public abstract class JContainer : JToken, IList<JToken>
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
, ITypedList, IBindingList
|
, ITypedList, IBindingList
|
||||||
#else
|
#elif PORTABLE
|
||||||
, INotifyCollectionChanged
|
, INotifyCollectionChanged
|
||||||
#endif
|
#endif
|
||||||
, IList
|
, IList
|
||||||
#if !(SILVERLIGHT || NET20 || NET35 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NET35 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
, INotifyCollectionChanged
|
, INotifyCollectionChanged
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
internal ListChangedEventHandler _listChanged;
|
internal ListChangedEventHandler _listChanged;
|
||||||
internal AddingNewEventHandler _addingNew;
|
internal AddingNewEventHandler _addingNew;
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
remove { _addingNew -= value; }
|
remove { _addingNew -= value; }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
internal NotifyCollectionChangedEventHandler _collectionChanged;
|
internal NotifyCollectionChangedEventHandler _collectionChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -123,7 +125,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return new List<JToken>();
|
return new List<JToken>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raises the <see cref="AddingNew"/> event.
|
/// Raises the <see cref="AddingNew"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -157,7 +159,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raises the <see cref="CollectionChanged"/> event.
|
/// Raises the <see cref="CollectionChanged"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -350,11 +352,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
ChildrenTokens.Insert(index, item);
|
ChildrenTokens.Insert(index, item);
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (_listChanged != null)
|
if (_listChanged != null)
|
||||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
|
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
if (_collectionChanged != null)
|
if (_collectionChanged != null)
|
||||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
|
||||||
#endif
|
#endif
|
||||||
@@ -384,11 +386,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
ChildrenTokens.RemoveAt(index);
|
ChildrenTokens.RemoveAt(index);
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (_listChanged != null)
|
if (_listChanged != null)
|
||||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
|
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
if (_collectionChanged != null)
|
if (_collectionChanged != null)
|
||||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
|
||||||
#endif
|
#endif
|
||||||
@@ -448,11 +450,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
existing.Previous = null;
|
existing.Previous = null;
|
||||||
existing.Next = null;
|
existing.Next = null;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
if (_listChanged != null)
|
if (_listChanged != null)
|
||||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
|
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
if (_collectionChanged != null)
|
if (_collectionChanged != null)
|
||||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, item, existing, index));
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, item, existing, index));
|
||||||
#endif
|
#endif
|
||||||
@@ -471,11 +473,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
ChildrenTokens.Clear();
|
ChildrenTokens.Clear();
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (_listChanged != null)
|
if (_listChanged != null)
|
||||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
if (_collectionChanged != null)
|
if (_collectionChanged != null)
|
||||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||||
#endif
|
#endif
|
||||||
@@ -745,7 +747,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
|
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -924,7 +926,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
#region IBindingList Members
|
#region IBindingList Members
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
void IBindingList.AddIndex(PropertyDescriptor property)
|
void IBindingList.AddIndex(PropertyDescriptor property)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
#if !PORTABLE40
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
#endif
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
#endif
|
#endif
|
||||||
@@ -50,10 +52,10 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
|
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
|
||||||
/// </example>
|
/// </example>
|
||||||
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
|
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
, ICustomTypeDescriptor
|
, ICustomTypeDescriptor
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
, INotifyPropertyChanging
|
, INotifyPropertyChanging
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -73,7 +75,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a property value is changing.
|
/// Occurs when a property value is changing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -156,11 +158,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
internal void InternalPropertyChanged(JProperty childProperty)
|
internal void InternalPropertyChanged(JProperty childProperty)
|
||||||
{
|
{
|
||||||
OnPropertyChanged(childProperty.Name);
|
OnPropertyChanged(childProperty.Name);
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (_listChanged != null)
|
if (_listChanged != null)
|
||||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
|
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
|
||||||
#endif
|
#endif
|
||||||
#if SILVERLIGHT || !(NET20 || NET35)
|
#if SILVERLIGHT || !(NET20 || NET35 || PORTABLE40)
|
||||||
if (_collectionChanged != null)
|
if (_collectionChanged != null)
|
||||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, childProperty, childProperty, IndexOfItem(childProperty)));
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, childProperty, childProperty, IndexOfItem(childProperty)));
|
||||||
#endif
|
#endif
|
||||||
@@ -168,7 +170,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
internal void InternalPropertyChanging(JProperty childProperty)
|
internal void InternalPropertyChanging(JProperty childProperty)
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
OnPropertyChanging(childProperty.Name);
|
OnPropertyChanging(childProperty.Name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -271,7 +273,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
OnPropertyChanging(propertyName);
|
OnPropertyChanging(propertyName);
|
||||||
#endif
|
#endif
|
||||||
Add(new JProperty(propertyName, value));
|
Add(new JProperty(propertyName, value));
|
||||||
@@ -584,7 +586,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || NET20)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE || NET20)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raises the <see cref="PropertyChanging"/> event with the provided arguments.
|
/// Raises the <see cref="PropertyChanging"/> event with the provided arguments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -596,7 +598,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
|
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
|
||||||
#region ICustomTypeDescriptor
|
#region ICustomTypeDescriptor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -755,7 +757,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
#endregion
|
#endregion
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
#endif
|
#endif
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -50,11 +50,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Represents an abstract JSON token.
|
/// Represents an abstract JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class JToken : IJEnumerable<JToken>, IJsonLineInfo
|
public abstract class JToken : IJEnumerable<JToken>, IJsonLineInfo
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
, ICloneable
|
, ICloneable
|
||||||
#endif
|
#endif
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
, IDynamicMetaObjectProvider
|
, IDynamicMetaObjectProvider
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
private JContainer _parent;
|
private JContainer _parent;
|
||||||
@@ -455,7 +455,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, BooleanTypes, false))
|
if (v == null || !ValidateToken(v, BooleanTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||||
#endif
|
#endif
|
||||||
@@ -497,7 +497,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, BooleanTypes, true))
|
if (v == null || !ValidateToken(v, BooleanTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||||
#endif
|
#endif
|
||||||
@@ -516,7 +516,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (long)(BigInteger)v.Value;
|
return (long)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -585,7 +585,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (decimal?)(BigInteger)v.Value;
|
return (decimal?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -607,7 +607,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (double?)(BigInteger)v.Value;
|
return (double?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -629,7 +629,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, CharTypes, true))
|
if (v == null || !ValidateToken(v, CharTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (char?)(BigInteger)v.Value;
|
return (char?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -648,7 +648,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (int)(BigInteger)v.Value;
|
return (int)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -667,7 +667,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (short)(BigInteger)v.Value;
|
return (short)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -687,7 +687,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (ushort)(BigInteger)v.Value;
|
return (ushort)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -707,7 +707,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, CharTypes, false))
|
if (v == null || !ValidateToken(v, CharTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (char)(BigInteger)v.Value;
|
return (char)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -726,7 +726,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (byte)(BigInteger)v.Value;
|
return (byte)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -748,7 +748,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (int?)(BigInteger)v.Value;
|
return (int?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -770,7 +770,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (short?)(BigInteger)v.Value;
|
return (short?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -793,7 +793,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (ushort?)(BigInteger)v.Value;
|
return (ushort?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -815,7 +815,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (byte?)(BigInteger)v.Value;
|
return (byte?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -856,7 +856,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (long?)(BigInteger)v.Value;
|
return (long?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -878,7 +878,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (float?)(BigInteger)v.Value;
|
return (float?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -897,7 +897,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (decimal)(BigInteger)v.Value;
|
return (decimal)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -920,7 +920,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (uint?)(BigInteger)v.Value;
|
return (uint?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -943,7 +943,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, true))
|
if (v == null || !ValidateToken(v, NumberTypes, true))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (ulong?)(BigInteger)v.Value;
|
return (ulong?)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -962,7 +962,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (double) (BigInteger) v.Value;
|
return (double) (BigInteger) v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -981,7 +981,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (float)(BigInteger)v.Value;
|
return (float)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -1007,7 +1007,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return null;
|
return null;
|
||||||
if (v.Value is byte[])
|
if (v.Value is byte[])
|
||||||
return Convert.ToBase64String((byte[]) v.Value);
|
return Convert.ToBase64String((byte[]) v.Value);
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return ((BigInteger)v.Value).ToString(CultureInfo.InvariantCulture);
|
return ((BigInteger)v.Value).ToString(CultureInfo.InvariantCulture);
|
||||||
#endif
|
#endif
|
||||||
@@ -1027,7 +1027,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (uint)(BigInteger)v.Value;
|
return (uint)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -1047,7 +1047,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (v == null || !ValidateToken(v, NumberTypes, false))
|
if (v == null || !ValidateToken(v, NumberTypes, false))
|
||||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return (ulong)(BigInteger)v.Value;
|
return (ulong)(BigInteger)v.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -1071,7 +1071,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
if (v.Value is string)
|
if (v.Value is string)
|
||||||
return Convert.FromBase64String(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
return Convert.FromBase64String(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (v.Value is BigInteger)
|
if (v.Value is BigInteger)
|
||||||
return ((BigInteger)v.Value).ToByteArray();
|
return ((BigInteger)v.Value).ToByteArray();
|
||||||
#endif
|
#endif
|
||||||
@@ -1170,7 +1170,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return (v.Value is Uri) ? (Uri)v.Value : new Uri(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
return (v.Value is Uri) ? (Uri)v.Value : new Uri(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs an explicit conversion from <see cref="Newtonsoft.Json.Linq.JToken"/> to <see cref="System.Numerics.BigInteger"/>.
|
/// Performs an explicit conversion from <see cref="Newtonsoft.Json.Linq.JToken"/> to <see cref="System.Numerics.BigInteger"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1415,7 +1415,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return new JValue(value);
|
return new JValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs an implicit conversion from <see cref="Nullable{BigInteger}"/> to <see cref="Newtonsoft.Json.Linq.JToken"/>.
|
/// Performs an implicit conversion from <see cref="Nullable{BigInteger}"/> to <see cref="Newtonsoft.Json.Linq.JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1489,7 +1489,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return new JValue(value);
|
return new JValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs an implicit conversion from <see cref="T:System.Numerics.BigInteger"/> to <see cref="Newtonsoft.Json.Linq.JToken"/>.
|
/// Performs an implicit conversion from <see cref="T:System.Numerics.BigInteger"/> to <see cref="Newtonsoft.Json.Linq.JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1714,7 +1714,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return (TimeSpan?)this;
|
return (TimeSpan?)this;
|
||||||
case PrimitiveTypeCode.TimeSpan:
|
case PrimitiveTypeCode.TimeSpan:
|
||||||
return (TimeSpan)this;
|
return (TimeSpan)this;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
case PrimitiveTypeCode.BigIntegerNullable:
|
case PrimitiveTypeCode.BigIntegerNullable:
|
||||||
return (BigInteger?)this;
|
return (BigInteger?)this;
|
||||||
case PrimitiveTypeCode.BigInteger:
|
case PrimitiveTypeCode.BigInteger:
|
||||||
@@ -1881,7 +1881,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return p.Evaluate(this, errorWhenNoMatch);
|
return p.Evaluate(this, errorWhenNoMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1907,7 +1907,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
object ICloneable.Clone()
|
object ICloneable.Clone()
|
||||||
{
|
{
|
||||||
return DeepClone();
|
return DeepClone();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
@@ -330,7 +330,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
{
|
{
|
||||||
base.WriteValue(value);
|
base.WriteValue(value);
|
||||||
string s = null;
|
string s = null;
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
s = value.ToString(CultureInfo.InvariantCulture);
|
s = value.ToString(CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
s = value.ToString();
|
s = value.ToString();
|
||||||
@@ -432,7 +432,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
AddValue(value, JsonToken.String);
|
AddValue(value, JsonToken.String);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes a <see cref="BigInteger"/> value.
|
/// Writes a <see cref="BigInteger"/> value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
#endif
|
#endif
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
private static int CompareBigInteger(BigInteger i1, object i2)
|
private static int CompareBigInteger(BigInteger i1, object i2)
|
||||||
{
|
{
|
||||||
int result = i1.CompareTo(ConvertUtils.ToBigInteger(i2));
|
int result = i1.CompareTo(ConvertUtils.ToBigInteger(i2));
|
||||||
@@ -231,7 +231,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
switch (valueType)
|
switch (valueType)
|
||||||
{
|
{
|
||||||
case JTokenType.Integer:
|
case JTokenType.Integer:
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (objA is BigInteger)
|
if (objA is BigInteger)
|
||||||
return CompareBigInteger((BigInteger)objA, objB);
|
return CompareBigInteger((BigInteger)objA, objB);
|
||||||
if (objB is BigInteger)
|
if (objB is BigInteger)
|
||||||
@@ -244,7 +244,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
else
|
else
|
||||||
return Convert.ToInt64(objA, CultureInfo.InvariantCulture).CompareTo(Convert.ToInt64(objB, CultureInfo.InvariantCulture));
|
return Convert.ToInt64(objA, CultureInfo.InvariantCulture).CompareTo(Convert.ToInt64(objB, CultureInfo.InvariantCulture));
|
||||||
case JTokenType.Float:
|
case JTokenType.Float:
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (objA is BigInteger)
|
if (objA is BigInteger)
|
||||||
return CompareBigInteger((BigInteger)objA, objB);
|
return CompareBigInteger((BigInteger)objA, objB);
|
||||||
if (objB is BigInteger)
|
if (objB is BigInteger)
|
||||||
@@ -347,7 +347,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return d1.CompareTo(d2);
|
return d1.CompareTo(d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
|
private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
|
||||||
{
|
{
|
||||||
if (objA is string || objB is string)
|
if (objA is string || objB is string)
|
||||||
@@ -359,7 +359,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (objA is BigInteger || objB is BigInteger)
|
if (objA is BigInteger || objB is BigInteger)
|
||||||
{
|
{
|
||||||
if (objA == null || objB == null)
|
if (objA == null || objB == null)
|
||||||
@@ -524,7 +524,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return JTokenType.Null;
|
return JTokenType.Null;
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
else if (value == DBNull.Value)
|
else if (value == DBNull.Value)
|
||||||
return JTokenType.Null;
|
return JTokenType.Null;
|
||||||
#endif
|
#endif
|
||||||
@@ -535,7 +535,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return JTokenType.Integer;
|
return JTokenType.Integer;
|
||||||
else if (value is Enum)
|
else if (value is Enum)
|
||||||
return JTokenType.Integer;
|
return JTokenType.Integer;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
else if (value is BigInteger)
|
else if (value is BigInteger)
|
||||||
return JTokenType.Integer;
|
return JTokenType.Integer;
|
||||||
#endif
|
#endif
|
||||||
@@ -637,12 +637,12 @@ namespace Newtonsoft.Json.Linq
|
|||||||
writer.WriteUndefined();
|
writer.WriteUndefined();
|
||||||
return;
|
return;
|
||||||
case JTokenType.Integer:
|
case JTokenType.Integer:
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (_value is BigInteger)
|
if (_value is BigInteger)
|
||||||
writer.WriteValue((BigInteger)_value);
|
writer.WriteValue((BigInteger)_value);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
writer.WriteValue(Convert.ToInt64(_value, CultureInfo.InvariantCulture));
|
writer.WriteValue(Convert.ToInt64(_value, CultureInfo.InvariantCulture));
|
||||||
return;
|
return;
|
||||||
case JTokenType.Float:
|
case JTokenType.Float:
|
||||||
if (_value is decimal)
|
if (_value is decimal)
|
||||||
@@ -802,7 +802,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return _value.ToString();
|
return _value.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -929,7 +929,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
if (_value is DateTimeOffset)
|
if (_value is DateTimeOffset)
|
||||||
return TypeCode.DateTime;
|
return TypeCode.DateTime;
|
||||||
#endif
|
#endif
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT)
|
#if !(NET20 || NET35 || PORTABLE40 || SILVERLIGHT)
|
||||||
if (_value is BigInteger)
|
if (_value is BigInteger)
|
||||||
return TypeCode.Object;
|
return TypeCode.Object;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ using System.Security;
|
|||||||
[assembly: AssemblyTitle("Json.NET Windows Phone")]
|
[assembly: AssemblyTitle("Json.NET Windows Phone")]
|
||||||
#elif SILVERLIGHT
|
#elif SILVERLIGHT
|
||||||
[assembly: AssemblyTitle("Json.NET Silverlight")]
|
[assembly: AssemblyTitle("Json.NET Silverlight")]
|
||||||
|
#elif PORTABLE40
|
||||||
|
[assembly: AssemblyTitle("Json.NET Portable .NET 4.0")]
|
||||||
#elif PORTABLE
|
#elif PORTABLE
|
||||||
[assembly: AssemblyTitle("Json.NET Portable")]
|
[assembly: AssemblyTitle("Json.NET Portable")]
|
||||||
#elif NETFX_CORE
|
#elif NETFX_CORE
|
||||||
@@ -70,7 +72,7 @@ using System.Security;
|
|||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
#if !PORTABLE
|
#if !(PORTABLE40 || PORTABLE)
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM componenets. If you need to access a type in this assembly from
|
// to COM componenets. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
@@ -90,6 +92,6 @@ using System.Security;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("4.5.0.0")]
|
[assembly: AssemblyVersion("4.5.0.0")]
|
||||||
[assembly: AssemblyFileVersion("5.0.1.16001")]
|
[assembly: AssemblyFileVersion("5.0.1.16006")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns detailed information about the schema exception.
|
/// Returns detailed information about the schema exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#endif
|
#endif
|
||||||
public class JsonSchemaException : JsonException
|
public class JsonSchemaException : JsonException
|
||||||
@@ -83,7 +83,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(WINDOWS_PHONE || SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
|
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
if (containerAttribute != null && !string.IsNullOrEmpty(containerAttribute.Description))
|
if (containerAttribute != null && !string.IsNullOrEmpty(containerAttribute.Description))
|
||||||
return containerAttribute.Description;
|
return containerAttribute.Description;
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(type);
|
DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(type);
|
||||||
if (descriptionAttribute != null)
|
if (descriptionAttribute != null)
|
||||||
return descriptionAttribute.Description;
|
return descriptionAttribute.Description;
|
||||||
|
|||||||
@@ -25,18 +25,18 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
#if !(NET35 || NET20 || SILVERLIGHT || PORTABLE)
|
#if !(NET35 || NET20 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
#endif
|
#endif
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
#endif
|
#endif
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
#endif
|
#endif
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
@@ -94,16 +94,16 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
private static readonly IList<JsonConverter> BuiltInConverters = new List<JsonConverter>
|
private static readonly IList<JsonConverter> BuiltInConverters = new List<JsonConverter>
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
new EntityKeyMemberConverter(),
|
new EntityKeyMemberConverter(),
|
||||||
#endif
|
#endif
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
new ExpandoObjectConverter(),
|
new ExpandoObjectConverter(),
|
||||||
#endif
|
#endif
|
||||||
#if (!(SILVERLIGHT) || WINDOWS_PHONE)
|
#if (!(SILVERLIGHT || PORTABLE40) || WINDOWS_PHONE)
|
||||||
new XmlNodeConverter(),
|
new XmlNodeConverter(),
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
new BinaryConverter(),
|
new BinaryConverter(),
|
||||||
new DataSetConverter(),
|
new DataSetConverter(),
|
||||||
new DataTableConverter(),
|
new DataTableConverter(),
|
||||||
@@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
get { return JsonTypeReflector.DynamicCodeGeneration; }
|
get { return JsonTypeReflector.DynamicCodeGeneration; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the default members search flags.
|
/// Gets or sets the default members search flags.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -373,7 +373,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
else if (contract.MemberSerialization == MemberSerialization.Fields)
|
else if (contract.MemberSerialization == MemberSerialization.Fields)
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
// mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object
|
// mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object
|
||||||
// note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust
|
// note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust
|
||||||
if (JsonTypeReflector.FullyTrusted)
|
if (JsonTypeReflector.FullyTrusted)
|
||||||
@@ -571,7 +571,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
if (onDeserialized != null)
|
if (onDeserialized != null)
|
||||||
{
|
{
|
||||||
// ConcurrentDictionary throws an error here so don't use its OnDeserialized - http://json.codeplex.com/discussions/257093
|
// ConcurrentDictionary throws an error here so don't use its OnDeserialized - http://json.codeplex.com/discussions/257093
|
||||||
#if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE)
|
#if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE || PORTABLE40)
|
||||||
if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>)))
|
if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>)))
|
||||||
contract.OnDeserializedCallbacks.AddRange(onDeserialized);
|
contract.OnDeserializedCallbacks.AddRange(onDeserialized);
|
||||||
#else
|
#else
|
||||||
@@ -715,7 +715,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return contract;
|
return contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="JsonISerializableContract"/> for the given type.
|
/// Creates a <see cref="JsonISerializableContract"/> for the given type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -738,7 +738,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="JsonDynamicContract"/> for the given type.
|
/// Creates a <see cref="JsonDynamicContract"/> for the given type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -802,12 +802,12 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
if (CanConvertToString(t))
|
if (CanConvertToString(t))
|
||||||
return CreateStringContract(objectType);
|
return CreateStringContract(objectType);
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t))
|
if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t))
|
||||||
return CreateISerializableContract(objectType);
|
return CreateISerializableContract(objectType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t))
|
if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t))
|
||||||
return CreateDynamicContract(objectType);
|
return CreateDynamicContract(objectType);
|
||||||
#endif
|
#endif
|
||||||
@@ -817,7 +817,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|
|
||||||
internal static bool CanConvertToString(Type type)
|
internal static bool CanConvertToString(Type type)
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
TypeConverter converter = ConvertUtils.GetConverter(type);
|
TypeConverter converter = ConvertUtils.GetConverter(type);
|
||||||
|
|
||||||
// use the objectType's TypeConverter if it has one and can convert to a string
|
// use the objectType's TypeConverter if it has one and can convert to a string
|
||||||
@@ -921,7 +921,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
// warning - this method use to cause errors with Intellitrace. Retest in VS Ultimate after changes
|
// warning - this method use to cause errors with Intellitrace. Retest in VS Ultimate after changes
|
||||||
IValueProvider valueProvider;
|
IValueProvider valueProvider;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
if (DynamicCodeGeneration)
|
if (DynamicCodeGeneration)
|
||||||
valueProvider = new DynamicValueProvider(member);
|
valueProvider = new DynamicValueProvider(member);
|
||||||
else
|
else
|
||||||
@@ -1018,10 +1018,10 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|
|
||||||
bool hasJsonIgnoreAttribute =
|
bool hasJsonIgnoreAttribute =
|
||||||
JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
|
JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null
|
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
if (memberSerialization != MemberSerialization.OptIn)
|
if (memberSerialization != MemberSerialization.OptIn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
Assembly assembly;
|
Assembly assembly;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
// look, I don't like using obsolete methods as much as you do but this is the only way
|
// look, I don't like using obsolete methods as much as you do but this is the only way
|
||||||
// Assembly.Load won't check the GAC for a partial name
|
// Assembly.Load won't check the GAC for a partial name
|
||||||
#pragma warning disable 618,612
|
#pragma warning disable 618,612
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using DiagnosticsTrace = System.Diagnostics.Trace;
|
using DiagnosticsTrace = System.Diagnostics.Trace;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if NET20
|
#if NET20
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|| ReflectionUtils.IsGenericDefinition(underlyingType, typeof(IList<>)))
|
|| ReflectionUtils.IsGenericDefinition(underlyingType, typeof(IList<>)))
|
||||||
CreatedType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
CreatedType = ReflectionUtils.MakeGenericType(typeof(List<>), CollectionItemType);
|
||||||
|
|
||||||
#if !(NET20 || NET35)
|
#if !(NET20 || NET35 || PORTABLE40)
|
||||||
if (ReflectionUtils.IsGenericDefinition(underlyingType, typeof(ISet<>)))
|
if (ReflectionUtils.IsGenericDefinition(underlyingType, typeof(ISet<>)))
|
||||||
CreatedType = ReflectionUtils.MakeGenericType(typeof(HashSet<>), CollectionItemType);
|
CreatedType = ReflectionUtils.MakeGenericType(typeof(HashSet<>), CollectionItemType);
|
||||||
#endif
|
#endif
|
||||||
@@ -119,7 +119,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
canDeserialize = true;
|
canDeserialize = true;
|
||||||
ShouldCreateWrapper = true;
|
ShouldCreateWrapper = true;
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof (IReadOnlyCollection<>), out tempCollectionType))
|
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof (IReadOnlyCollection<>), out tempCollectionType))
|
||||||
{
|
{
|
||||||
CollectionItemType = underlyingType.GetGenericArguments()[0];
|
CollectionItemType = underlyingType.GetGenericArguments()[0];
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
if (ReflectionUtils.IsGenericDefinition(UnderlyingType, typeof(IDictionary<,>)))
|
if (ReflectionUtils.IsGenericDefinition(UnderlyingType, typeof(IDictionary<,>)))
|
||||||
CreatedType = ReflectionUtils.MakeGenericType(typeof(Dictionary<,>), keyType, valueType);
|
CreatedType = ReflectionUtils.MakeGenericType(typeof(Dictionary<,>), keyType, valueType);
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IReadOnlyDictionary<,>), out _genericCollectionDefinitionType))
|
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IReadOnlyDictionary<,>), out _genericCollectionDefinitionType))
|
||||||
{
|
{
|
||||||
keyType = _genericCollectionDefinitionType.GetGenericArguments()[0];
|
keyType = _genericCollectionDefinitionType.GetGenericArguments()[0];
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
ConstructorParameters = new JsonPropertyCollection(UnderlyingType);
|
ConstructorParameters = new JsonPropertyCollection(UnderlyingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
#if !(NET20 || NET35)
|
#if !(NET20 || NET35)
|
||||||
[SecuritySafeCritical]
|
[SecuritySafeCritical]
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
#if !(PORTABLE || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
#endif
|
#endif
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
#if !(PORTABLE || NET35 || NET20 || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || SILVERLIGHT)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JsonSerializerProxy _internalSerializer;
|
private JsonSerializerProxy _internalSerializer;
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
private JsonFormatterConverter _formatterConverter;
|
private JsonFormatterConverter _formatterConverter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return _internalSerializer;
|
return _internalSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
private JsonFormatterConverter GetFormatterConverter()
|
private JsonFormatterConverter GetFormatterConverter()
|
||||||
{
|
{
|
||||||
if (_formatterConverter == null)
|
if (_formatterConverter == null)
|
||||||
@@ -276,7 +276,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType);
|
return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType);
|
||||||
case JsonToken.Null:
|
case JsonToken.Null:
|
||||||
case JsonToken.Undefined:
|
case JsonToken.Undefined:
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (objectType == typeof (DBNull))
|
if (objectType == typeof (DBNull))
|
||||||
return DBNull.Value;
|
return DBNull.Value;
|
||||||
#endif
|
#endif
|
||||||
@@ -443,12 +443,12 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|
|
||||||
return targetDictionary;
|
return targetDictionary;
|
||||||
}
|
}
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
case JsonContractType.Dynamic:
|
case JsonContractType.Dynamic:
|
||||||
JsonDynamicContract dynamicContract = (JsonDynamicContract) contract;
|
JsonDynamicContract dynamicContract = (JsonDynamicContract) contract;
|
||||||
return CreateDynamic(reader, dynamicContract, member, id);
|
return CreateDynamic(reader, dynamicContract, member, id);
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
case JsonContractType.Serializable:
|
case JsonContractType.Serializable:
|
||||||
JsonISerializableContract serializableContract = (JsonISerializableContract) contract;
|
JsonISerializableContract serializableContract = (JsonISerializableContract) contract;
|
||||||
return CreateISerializable(reader, serializableContract, id);
|
return CreateISerializable(reader, serializableContract, id);
|
||||||
@@ -540,7 +540,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);
|
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 (objectType != null
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
&& objectType != typeof (IDynamicMetaObjectProvider)
|
&& objectType != typeof (IDynamicMetaObjectProvider)
|
||||||
#endif
|
#endif
|
||||||
&& !objectType.IsAssignableFrom(specifiedType))
|
&& !objectType.IsAssignableFrom(specifiedType))
|
||||||
@@ -669,7 +669,7 @@ To fix this error either change the JSON to a {1} or change the deserialized typ
|
|||||||
private bool HasDefinedType(Type type)
|
private bool HasDefinedType(Type type)
|
||||||
{
|
{
|
||||||
return (type != null && type != typeof (object) && !typeof (JToken).IsSubclassOf(type)
|
return (type != null && type != typeof (object) && !typeof (JToken).IsSubclassOf(type)
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
&& type != typeof (IDynamicMetaObjectProvider)
|
&& type != typeof (IDynamicMetaObjectProvider)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -703,7 +703,7 @@ To fix this error either change the JSON to a {1} or change the deserialized typ
|
|||||||
return Enum.ToObject(contract.NonNullableUnderlyingType, value);
|
return Enum.ToObject(contract.NonNullableUnderlyingType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(PORTABLE || NET35 || NET20 || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || SILVERLIGHT)
|
||||||
if (value is BigInteger)
|
if (value is BigInteger)
|
||||||
return ConvertUtils.FromBigInteger((BigInteger)value, targetType);
|
return ConvertUtils.FromBigInteger((BigInteger)value, targetType);
|
||||||
#endif
|
#endif
|
||||||
@@ -1262,7 +1262,7 @@ To fix this error either change the JSON to a {1} or change the deserialized typ
|
|||||||
return underlyingList;
|
return underlyingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, string id)
|
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, string id)
|
||||||
{
|
{
|
||||||
Type objectType = contract.UnderlyingType;
|
Type objectType = contract.UnderlyingType;
|
||||||
@@ -1320,7 +1320,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
private object CreateDynamic(JsonReader reader, JsonDynamicContract contract, JsonProperty member, string id)
|
private object CreateDynamic(JsonReader reader, JsonDynamicContract contract, JsonProperty member, string id)
|
||||||
{
|
{
|
||||||
IDynamicMetaObjectProvider newObject;
|
IDynamicMetaObjectProvider newObject;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
#endif
|
#endif
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -148,12 +148,12 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
JsonDictionaryContract dictionaryContract = (JsonDictionaryContract) valueContract;
|
JsonDictionaryContract dictionaryContract = (JsonDictionaryContract) valueContract;
|
||||||
SerializeDictionary(writer, (value is IDictionary) ? (IDictionary) value : dictionaryContract.CreateWrapper(value), dictionaryContract, member, containerContract, containerProperty);
|
SerializeDictionary(writer, (value is IDictionary) ? (IDictionary) value : dictionaryContract.CreateWrapper(value), dictionaryContract, member, containerContract, containerProperty);
|
||||||
break;
|
break;
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
case JsonContractType.Dynamic:
|
case JsonContractType.Dynamic:
|
||||||
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
|
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
case JsonContractType.Serializable:
|
case JsonContractType.Serializable:
|
||||||
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty);
|
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty);
|
||||||
break;
|
break;
|
||||||
@@ -292,7 +292,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|
|
||||||
internal static bool TryConvertToString(object value, Type type, out string s)
|
internal static bool TryConvertToString(object value, Type type, out string s)
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
TypeConverter converter = ConvertUtils.GetConverter(type);
|
TypeConverter converter = ConvertUtils.GetConverter(type);
|
||||||
|
|
||||||
// use the objectType's TypeConverter if it has one and can convert to a string
|
// use the objectType's TypeConverter if it has one and can convert to a string
|
||||||
@@ -671,7 +671,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return writeMetadataObject;
|
return writeMetadataObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
#if !(NET20 || NET35)
|
#if !(NET20 || NET35)
|
||||||
[SecuritySafeCritical]
|
[SecuritySafeCritical]
|
||||||
#endif
|
#endif
|
||||||
@@ -709,7 +709,7 @@ To fix this error either change the environment to be fully trusted, change the
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
private void SerializeDynamic(JsonWriter writer, IDynamicMetaObjectProvider value, JsonDynamicContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
|
private void SerializeDynamic(JsonWriter writer, IDynamicMetaObjectProvider value, JsonDynamicContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
|
||||||
{
|
{
|
||||||
OnSerializing(writer, contract, value);
|
OnSerializing(writer, contract, value);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using System.ComponentModel;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
@@ -63,7 +63,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
public const string SpecifiedPostfix = "Specified";
|
public const string SpecifiedPostfix = "Specified";
|
||||||
|
|
||||||
private static readonly ThreadSafeStore<object, Type> JsonConverterTypeCache = new ThreadSafeStore<object, Type>(GetJsonConverterTypeFromAttribute);
|
private static readonly ThreadSafeStore<object, Type> JsonConverterTypeCache = new ThreadSafeStore<object, Type>(GetJsonConverterTypeFromAttribute);
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
private static readonly ThreadSafeStore<Type, Type> AssociatedMetadataTypesCache = new ThreadSafeStore<Type, Type>(GetAssociateMetadataTypeFromAttribute);
|
private static readonly ThreadSafeStore<Type, Type> AssociatedMetadataTypesCache = new ThreadSafeStore<Type, Type>(GetAssociateMetadataTypeFromAttribute);
|
||||||
|
|
||||||
private const string MetadataTypeAttributeTypeName =
|
private const string MetadataTypeAttributeTypeName =
|
||||||
@@ -108,7 +108,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return GetJsonContainerAttribute(type) as JsonDictionaryAttribute;
|
return GetJsonContainerAttribute(type) as JsonDictionaryAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
public static SerializableAttribute GetSerializableAttribute(Type type)
|
public static SerializableAttribute GetSerializableAttribute(Type type)
|
||||||
{
|
{
|
||||||
return CachedAttributeGetter<SerializableAttribute>.GetAttribute(type);
|
return CachedAttributeGetter<SerializableAttribute>.GetAttribute(type);
|
||||||
@@ -166,7 +166,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return MemberSerialization.OptIn;
|
return MemberSerialization.OptIn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (!ignoreSerializableAttribute)
|
if (!ignoreSerializableAttribute)
|
||||||
{
|
{
|
||||||
SerializableAttribute serializableAttribute = GetSerializableAttribute(objectType);
|
SerializableAttribute serializableAttribute = GetSerializableAttribute(objectType);
|
||||||
@@ -206,7 +206,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
public static TypeConverter GetTypeConverter(Type type)
|
public static TypeConverter GetTypeConverter(Type type)
|
||||||
{
|
{
|
||||||
#if !SILVERLIGHT
|
#if !SILVERLIGHT
|
||||||
@@ -222,7 +222,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
private static Type GetAssociatedMetadataType(Type type)
|
private static Type GetAssociatedMetadataType(Type type)
|
||||||
{
|
{
|
||||||
return AssociatedMetadataTypesCache.Get(type);
|
return AssociatedMetadataTypesCache.Get(type);
|
||||||
@@ -267,7 +267,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
T attribute;
|
T attribute;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
Type metadataType = GetAssociatedMetadataType(type);
|
Type metadataType = GetAssociatedMetadataType(type);
|
||||||
if (metadataType != null)
|
if (metadataType != null)
|
||||||
{
|
{
|
||||||
@@ -295,7 +295,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
T attribute;
|
T attribute;
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
Type metadataType = GetAssociatedMetadataType(memberInfo.DeclaringType);
|
Type metadataType = GetAssociatedMetadataType(memberInfo.DeclaringType);
|
||||||
if (metadataType != null)
|
if (metadataType != null)
|
||||||
{
|
{
|
||||||
@@ -366,7 +366,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
if (_dynamicCodeGeneration == null)
|
if (_dynamicCodeGeneration == null)
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
|
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
|
||||||
@@ -395,9 +395,9 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
if (_fullyTrusted == null)
|
if (_fullyTrusted == null)
|
||||||
{
|
{
|
||||||
#if (NETFX_CORE || SILVERLIGHT || PORTABLE)
|
#if (NETFX_CORE || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
_fullyTrusted = false;
|
_fullyTrusted = false;
|
||||||
#elif !(NET20 || NET35)
|
#elif !(NET20 || NET35 || PORTABLE40)
|
||||||
AppDomain appDomain = AppDomain.CurrentDomain;
|
AppDomain appDomain = AppDomain.CurrentDomain;
|
||||||
|
|
||||||
_fullyTrusted = appDomain.IsHomogenous && appDomain.IsFullyTrusted;
|
_fullyTrusted = appDomain.IsHomogenous && appDomain.IsFullyTrusted;
|
||||||
@@ -422,7 +422,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
if (DynamicCodeGeneration)
|
if (DynamicCodeGeneration)
|
||||||
return DynamicReflectionDelegateFactory.Instance;
|
return DynamicReflectionDelegateFactory.Instance;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if SILVERLIGHT || PocketPC || NETFX_CORE || PORTABLE
|
#if SILVERLIGHT || PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if (NETFX_CORE || SILVERLIGHT || PORTABLE)
|
#if (NETFX_CORE || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
|
|
||||||
namespace Newtonsoft.Json
|
namespace Newtonsoft.Json
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return true;
|
return true;
|
||||||
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IDictionary<,>)))
|
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IDictionary<,>)))
|
||||||
return true;
|
return true;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)))
|
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
@@ -36,7 +36,7 @@ using System.Reflection;
|
|||||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System.Data.SqlTypes;
|
using System.Data.SqlTypes;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -139,14 +139,14 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{ typeof(Guid?), PrimitiveTypeCode.GuidNullable },
|
{ typeof(Guid?), PrimitiveTypeCode.GuidNullable },
|
||||||
{ typeof(TimeSpan), PrimitiveTypeCode.TimeSpan },
|
{ typeof(TimeSpan), PrimitiveTypeCode.TimeSpan },
|
||||||
{ typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable },
|
{ typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable },
|
||||||
#if !(PORTABLE || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
||||||
{ typeof(BigInteger), PrimitiveTypeCode.BigInteger },
|
{ typeof(BigInteger), PrimitiveTypeCode.BigInteger },
|
||||||
{ typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable },
|
{ typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable },
|
||||||
#endif
|
#endif
|
||||||
{ typeof(Uri), PrimitiveTypeCode.Uri },
|
{ typeof(Uri), PrimitiveTypeCode.Uri },
|
||||||
{ typeof(string), PrimitiveTypeCode.String },
|
{ typeof(string), PrimitiveTypeCode.String },
|
||||||
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
|
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
|
||||||
#if !(PORTABLE || NETFX_CORE)
|
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
|
||||||
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
|
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -223,7 +223,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public static TimeSpan ParseTimeSpan(string input)
|
public static TimeSpan ParseTimeSpan(string input)
|
||||||
{
|
{
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
return TimeSpan.Parse((string) input, CultureInfo.InvariantCulture);
|
return TimeSpan.Parse((string) input, CultureInfo.InvariantCulture);
|
||||||
#else
|
#else
|
||||||
return TimeSpan.Parse((string)input);
|
return TimeSpan.Parse((string)input);
|
||||||
@@ -287,7 +287,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return o => call(null, o);
|
return o => call(null, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE || PORTABLE40)
|
||||||
internal static BigInteger ToBigInteger(object value)
|
internal static BigInteger ToBigInteger(object value)
|
||||||
{
|
{
|
||||||
if (value is BigInteger)
|
if (value is BigInteger)
|
||||||
@@ -392,14 +392,14 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return ParseTimeSpan((string) initialValue);
|
return ParseTimeSpan((string) initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE)
|
#if !(NET20 || NET35 || SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
if (targetType == typeof(BigInteger))
|
if (targetType == typeof(BigInteger))
|
||||||
return ToBigInteger(initialValue);
|
return ToBigInteger(initialValue);
|
||||||
if (initialValue is BigInteger)
|
if (initialValue is BigInteger)
|
||||||
return FromBigInteger((BigInteger)initialValue, targetType);
|
return FromBigInteger((BigInteger)initialValue, targetType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
// see if source or target types have a TypeConverter that converts between the two
|
// see if source or target types have a TypeConverter that converts between the two
|
||||||
TypeConverter toConverter = GetConverter(initialType);
|
TypeConverter toConverter = GetConverter(initialType);
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
// handle DBNull and INullable
|
// handle DBNull and INullable
|
||||||
if (initialValue == DBNull.Value)
|
if (initialValue == DBNull.Value)
|
||||||
{
|
{
|
||||||
@@ -433,7 +433,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
throw new Exception("Can not convert null {0} into non-nullable {1}.".FormatWith(CultureInfo.InvariantCulture, initialType, targetType));
|
throw new Exception("Can not convert null {0} into non-nullable {1}.".FormatWith(CultureInfo.InvariantCulture, initialType, targetType));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
if (initialValue is INullable)
|
if (initialValue is INullable)
|
||||||
return EnsureTypeAssignable(ToValue((INullable)initialValue), initialType, targetType);
|
return EnsureTypeAssignable(ToValue((INullable)initialValue), initialType, targetType);
|
||||||
#endif
|
#endif
|
||||||
@@ -520,7 +520,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, (initialType != null) ? initialType.ToString() : "{null}", targetType));
|
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, (initialType != null) ? initialType.ToString() : "{null}", targetType));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
public static object ToValue(INullable nullableValue)
|
public static object ToValue(INullable nullableValue)
|
||||||
{
|
{
|
||||||
if (nullableValue == null)
|
if (nullableValue == null)
|
||||||
@@ -540,7 +540,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
internal static TypeConverter GetConverter(Type t)
|
internal static TypeConverter GetConverter(Type t)
|
||||||
{
|
{
|
||||||
return JsonTypeReflector.GetTypeConverter(t);
|
return JsonTypeReflector.GetTypeConverter(t);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind)
|
public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind)
|
||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
private readonly IDictionary _dictionary;
|
private readonly IDictionary _dictionary;
|
||||||
private readonly IDictionary<TKey, TValue> _genericDictionary;
|
private readonly IDictionary<TKey, TValue> _genericDictionary;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
private readonly IReadOnlyDictionary<TKey, TValue> _readOnlyDictionary;
|
private readonly IReadOnlyDictionary<TKey, TValue> _readOnlyDictionary;
|
||||||
#endif
|
#endif
|
||||||
private object _syncRoot;
|
private object _syncRoot;
|
||||||
@@ -64,7 +64,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
_genericDictionary = dictionary;
|
_genericDictionary = dictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
public DictionaryWrapper(IReadOnlyDictionary<TKey, TValue> dictionary)
|
public DictionaryWrapper(IReadOnlyDictionary<TKey, TValue> dictionary)
|
||||||
{
|
{
|
||||||
ValidationUtils.ArgumentNotNull(dictionary, "dictionary");
|
ValidationUtils.ArgumentNotNull(dictionary, "dictionary");
|
||||||
@@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.Contains(key);
|
return _dictionary.Contains(key);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.ContainsKey(key);
|
return _readOnlyDictionary.ContainsKey(key);
|
||||||
#endif
|
#endif
|
||||||
@@ -101,7 +101,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.Keys.Cast<TKey>().ToList();
|
return _dictionary.Keys.Cast<TKey>().ToList();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Keys.ToList();
|
return _readOnlyDictionary.Keys.ToList();
|
||||||
#endif
|
#endif
|
||||||
@@ -124,7 +124,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
@@ -151,7 +151,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
@@ -169,7 +169,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.Values.Cast<TValue>().ToList();
|
return _dictionary.Values.Cast<TValue>().ToList();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Values.ToList();
|
return _readOnlyDictionary.Values.ToList();
|
||||||
#endif
|
#endif
|
||||||
@@ -184,7 +184,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return (TValue)_dictionary[key];
|
return (TValue)_dictionary[key];
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary[key];
|
return _readOnlyDictionary[key];
|
||||||
#endif
|
#endif
|
||||||
@@ -195,7 +195,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary[key] = value;
|
_dictionary[key] = value;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -208,7 +208,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
((IList)_dictionary).Add(item);
|
((IList)_dictionary).Add(item);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -220,7 +220,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary.Clear();
|
_dictionary.Clear();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -232,7 +232,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return ((IList)_dictionary).Contains(item);
|
return ((IList)_dictionary).Contains(item);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Contains(item);
|
return _readOnlyDictionary.Contains(item);
|
||||||
#endif
|
#endif
|
||||||
@@ -249,7 +249,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
array[arrayIndex++] = new KeyValuePair<TKey, TValue>((TKey)item.Key, (TValue)item.Value);
|
array[arrayIndex++] = new KeyValuePair<TKey, TValue>((TKey)item.Key, (TValue)item.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
@@ -267,7 +267,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.Count;
|
return _dictionary.Count;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Count;
|
return _readOnlyDictionary.Count;
|
||||||
#endif
|
#endif
|
||||||
@@ -282,7 +282,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.IsReadOnly;
|
return _dictionary.IsReadOnly;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@@ -314,7 +314,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
@@ -330,7 +330,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.Cast<DictionaryEntry>().Select(de => new KeyValuePair<TKey, TValue>((TKey)de.Key, (TValue)de.Value)).GetEnumerator();
|
return _dictionary.Cast<DictionaryEntry>().Select(de => new KeyValuePair<TKey, TValue>((TKey)de.Key, (TValue)de.Value)).GetEnumerator();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.GetEnumerator();
|
return _readOnlyDictionary.GetEnumerator();
|
||||||
#endif
|
#endif
|
||||||
@@ -347,7 +347,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary.Add(key, value);
|
_dictionary.Add(key, value);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -361,7 +361,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary[key];
|
return _dictionary[key];
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary[(TKey)key];
|
return _readOnlyDictionary[(TKey)key];
|
||||||
#endif
|
#endif
|
||||||
@@ -372,7 +372,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary[key] = value;
|
_dictionary[key] = value;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -426,7 +426,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary.GetEnumerator();
|
return _dictionary.GetEnumerator();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return new DictionaryEnumerator<TKey, TValue>(_readOnlyDictionary.GetEnumerator());
|
return new DictionaryEnumerator<TKey, TValue>(_readOnlyDictionary.GetEnumerator());
|
||||||
#endif
|
#endif
|
||||||
@@ -438,7 +438,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_genericDictionary != null)
|
if (_genericDictionary != null)
|
||||||
return _genericDictionary.ContainsKey((TKey)key);
|
return _genericDictionary.ContainsKey((TKey)key);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.ContainsKey((TKey)key);
|
return _readOnlyDictionary.ContainsKey((TKey)key);
|
||||||
#endif
|
#endif
|
||||||
@@ -452,7 +452,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_genericDictionary != null)
|
if (_genericDictionary != null)
|
||||||
return false;
|
return false;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@@ -467,7 +467,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_genericDictionary != null)
|
if (_genericDictionary != null)
|
||||||
return _genericDictionary.Keys.ToList();
|
return _genericDictionary.Keys.ToList();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Keys.ToList();
|
return _readOnlyDictionary.Keys.ToList();
|
||||||
#endif
|
#endif
|
||||||
@@ -480,7 +480,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary.Remove(key);
|
_dictionary.Remove(key);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -494,7 +494,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_genericDictionary != null)
|
if (_genericDictionary != null)
|
||||||
return _genericDictionary.Values.ToList();
|
return _genericDictionary.Values.ToList();
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary.Values.ToList();
|
return _readOnlyDictionary.Values.ToList();
|
||||||
#endif
|
#endif
|
||||||
@@ -507,7 +507,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
_dictionary.CopyTo(array, index);
|
_dictionary.CopyTo(array, index);
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
#endif
|
#endif
|
||||||
@@ -543,7 +543,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
if (_dictionary != null)
|
if (_dictionary != null)
|
||||||
return _dictionary;
|
return _dictionary;
|
||||||
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE)
|
#if !(NET40 || NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE40)
|
||||||
else if (_readOnlyDictionary != null)
|
else if (_readOnlyDictionary != null)
|
||||||
return _readOnlyDictionary;
|
return _readOnlyDictionary;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if NET20
|
#if NET20
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(NET35 || NET20)
|
#if !(NET35 || NET20 || PORTABLE40)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE)
|
#if !(SILVERLIGHT || NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE || NETFX_CORE)
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if !(PORTABLE || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
#endif
|
#endif
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -43,7 +43,7 @@ using Newtonsoft.Json.Serialization;
|
|||||||
|
|
||||||
namespace Newtonsoft.Json.Utilities
|
namespace Newtonsoft.Json.Utilities
|
||||||
{
|
{
|
||||||
#if NETFX_CORE || PORTABLE
|
#if (NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
internal enum MemberTypes
|
internal enum MemberTypes
|
||||||
{
|
{
|
||||||
Property,
|
Property,
|
||||||
@@ -52,7 +52,9 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
Method,
|
Method,
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if NETFX_CORE || PORTABLE
|
||||||
[Flags]
|
[Flags]
|
||||||
internal enum BindingFlags
|
internal enum BindingFlags
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
static ReflectionUtils()
|
static ReflectionUtils()
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||||
EmptyTypes = Type.EmptyTypes;
|
EmptyTypes = Type.EmptyTypes;
|
||||||
#else
|
#else
|
||||||
EmptyTypes = new Type[0];
|
EmptyTypes = new Type[0];
|
||||||
@@ -690,13 +692,18 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
if (provider is MemberInfo)
|
if (provider is MemberInfo)
|
||||||
return (T[])Attribute.GetCustomAttributes((MemberInfo)provider, typeof(T), inherit);
|
return (T[])Attribute.GetCustomAttributes((MemberInfo)provider, typeof(T), inherit);
|
||||||
|
|
||||||
|
#if !PORTABLE40
|
||||||
if (provider is Module)
|
if (provider is Module)
|
||||||
return (T[])Attribute.GetCustomAttributes((Module)provider, typeof(T), inherit);
|
return (T[])Attribute.GetCustomAttributes((Module)provider, typeof(T), inherit);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (provider is ParameterInfo)
|
if (provider is ParameterInfo)
|
||||||
return (T[])Attribute.GetCustomAttributes((ParameterInfo)provider, typeof(T), inherit);
|
return (T[])Attribute.GetCustomAttributes((ParameterInfo)provider, typeof(T), inherit);
|
||||||
|
|
||||||
|
#if !PORTABLE40
|
||||||
return (T[])((ICustomAttributeProvider)attributeProvider).GetCustomAttributes(typeof(T), inherit);
|
return (T[])((ICustomAttributeProvider)attributeProvider).GetCustomAttributes(typeof(T), inherit);
|
||||||
|
#endif
|
||||||
|
throw new Exception("Cannot get attributes from '{0}'.".FormatWith(CultureInfo.InvariantCulture, provider));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static T[] GetAttributes<T>(object provider, bool inherit) where T : Attribute
|
public static T[] GetAttributes<T>(object provider, bool inherit) where T : Attribute
|
||||||
@@ -954,7 +961,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return 0m;
|
return 0m;
|
||||||
case PrimitiveTypeCode.DateTime:
|
case PrimitiveTypeCode.DateTime:
|
||||||
return new DateTime();
|
return new DateTime();
|
||||||
#if !(PORTABLE || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
#if !(PORTABLE || PORTABLE40 || NET35 || NET20 || WINDOWS_PHONE || SILVERLIGHT)
|
||||||
case PrimitiveTypeCode.BigInteger:
|
case PrimitiveTypeCode.BigInteger:
|
||||||
return new BigInteger();
|
return new BigInteger();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public static bool IsHighSurrogate(char c)
|
public static bool IsHighSurrogate(char c)
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || PORTABLE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
return char.IsHighSurrogate(c);
|
return char.IsHighSurrogate(c);
|
||||||
#else
|
#else
|
||||||
return (c >= 55296 && c <= 56319);
|
return (c >= 55296 && c <= 56319);
|
||||||
@@ -191,7 +191,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public static bool IsLowSurrogate(char c)
|
public static bool IsLowSurrogate(char c)
|
||||||
{
|
{
|
||||||
#if !(SILVERLIGHT || PORTABLE)
|
#if !(SILVERLIGHT || PORTABLE40 || PORTABLE)
|
||||||
return char.IsLowSurrogate(c);
|
return char.IsLowSurrogate(c);
|
||||||
#else
|
#else
|
||||||
return (c >= 56320 && c <= 57343);
|
return (c >= 56320 && c <= 57343);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public static MemberTypes MemberType(this MemberInfo memberInfo)
|
public static MemberTypes MemberType(this MemberInfo memberInfo)
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
return memberInfo.MemberType;
|
return memberInfo.MemberType;
|
||||||
#else
|
#else
|
||||||
if (memberInfo is PropertyInfo)
|
if (memberInfo is PropertyInfo)
|
||||||
@@ -177,6 +177,41 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PORTABLE40
|
||||||
|
public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingFlags, object placeholder1, Type propertyType, IList<Type> indexParameters, object placeholder2)
|
||||||
|
{
|
||||||
|
IList<PropertyInfo> propertyInfos = type.GetProperties(bindingFlags);
|
||||||
|
|
||||||
|
return propertyInfos.Where(p =>
|
||||||
|
{
|
||||||
|
if (name != null && name != p.Name)
|
||||||
|
return false;
|
||||||
|
if (propertyType != null && propertyType != p.PropertyType)
|
||||||
|
return false;
|
||||||
|
if (indexParameters != null)
|
||||||
|
{
|
||||||
|
if (!p.GetIndexParameters().Select(ip => ip.ParameterType).SequenceEqual(indexParameters))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}).SingleOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<MemberInfo> GetMember(this Type type, string name, MemberTypes memberType, BindingFlags bindingFlags)
|
||||||
|
{
|
||||||
|
return type.GetMembers(bindingFlags).Where(m =>
|
||||||
|
{
|
||||||
|
if (name != null && name != m.Name)
|
||||||
|
return false;
|
||||||
|
if (m.MemberType() != memberType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (NETFX_CORE || PORTABLE)
|
#if (NETFX_CORE || PORTABLE)
|
||||||
public static MethodInfo GetBaseDefinition(this MethodInfo method)
|
public static MethodInfo GetBaseDefinition(this MethodInfo method)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user