Change ifdefs to be by feature, not by platform (#1146)
* First pass * Second pass * Third pass * Temporarily change build script to build only portable * Add portable features for release build * Add feature constants to build script * Add more feature constants to build script * Fix build issues * Fix build issues * Get rid of constants in build.ps1 * HAVE_NUMERICS -> HAVE_BIG_INTEGER * Remove HAVE_NULLABLE * Remove HAVE_NUMERICS from csprojs * Add missing ifdef * Add feature defines to pj * Re-enable netstd builds * Fix defines in pj * Trying to get better build outputs * Trying to get the build error * Use newer cli * Address review feedback; make netstd build work * Introduce HAVE_DB_NULL_TYPE * Adapt to upstream changes; address remaining review feedback * Adapt to upstream changes; address remaining review feedback * Rename some constants for constistency * Address review feedback * -Fixed build with signed assembly * Fix merge erorr * Address review feedback * Introduce HAVE_NON_SERIALIZED_ATTRIBUTE * HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
This commit is contained in:
committed by
James Newton-King
parent
eb96cb9f62
commit
b8e60c773b
+2
-1
@@ -16,4 +16,5 @@ _ReSharper.*
|
||||
*.lock.json
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
*.orig
|
||||
*.orig
|
||||
.DS_Store
|
||||
+19
-25
@@ -24,14 +24,14 @@
|
||||
$workingSourceDir = "$workingDir\Src"
|
||||
$nugetPath = "$buildDir\nuget.exe"
|
||||
$builds = @(
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; Constants="NETSTANDARD1_0"; FinalDir="netstandard1.0"; NuGetDir = "netstandard1.0"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; Constants="NETSTANDARD1_1"; FinalDir="netstandard1.1"; NuGetDir = "netstandard1.1"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+wpa81"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"},
|
||||
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET20"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"}
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; FinalDir="netstandard1.0"; NuGetDir = "netstandard1.0"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; FinalDir="netstandard1.1"; NuGetDir = "netstandard1.1"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+wpa81"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"},
|
||||
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -198,11 +198,11 @@ function MSBuildBuild($build)
|
||||
exec { & $nugetPath update -self }
|
||||
exec { & $nugetPath restore "$workingSourceDir\$name.sln" -verbosity detailed -configfile $workingSourceDir\nuget.config | Out-Default } "Error restoring $name"
|
||||
|
||||
$constants = GetConstants $build.Constants $signAssemblies
|
||||
$additionalConstants = switch($signAssemblies) { $true { "SIGNED" } default { "" } }
|
||||
|
||||
Write-Host
|
||||
Write-Host "Building $workingSourceDir\$name.sln" -ForegroundColor Green
|
||||
exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:CopyNuGetImplementations=true" "/p:Platform=Any CPU" "/p:PlatformTarget=AnyCPU" /p:OutputPath=bin\Release\$finalDir\ /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:VisualStudioVersion=14.0" /p:DefineConstants=`"$constants`" "$workingSourceDir\$name.sln" | Out-Default } "Error building $name"
|
||||
exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:CopyNuGetImplementations=true" "/p:Platform=Any CPU" "/p:PlatformTarget=AnyCPU" /p:OutputPath=bin\Release\$finalDir\ /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:VisualStudioVersion=14.0" "/p:AdditionalConstants=$additionalConstants" "$workingSourceDir\$name.sln" | Out-Default } "Error building $name"
|
||||
}
|
||||
|
||||
function EnsureNuGetExists()
|
||||
@@ -283,13 +283,6 @@ function GetNuGetVersion()
|
||||
return $nugetVersion
|
||||
}
|
||||
|
||||
function GetConstants($constants, $includeSigned)
|
||||
{
|
||||
$signed = switch($includeSigned) { $true { ";SIGNED" } default { "" } }
|
||||
|
||||
return "CODE_ANALYSIS;TRACE;$constants$signed"
|
||||
}
|
||||
|
||||
function GetVersion($majorVersion)
|
||||
{
|
||||
$now = [DateTime]::Now
|
||||
@@ -359,15 +352,16 @@ function Update-Project {
|
||||
[string] $sign
|
||||
)
|
||||
|
||||
$file = switch($sign) { $true { $signKeyPath } default { $null } }
|
||||
$file = switch($sign) { $true { $signKeyPath } default { $null } }
|
||||
$signed = switch($sign) { $true { ";SIGNED" } default { "" } }
|
||||
$constants = "CODE_ANALYSIS;TRACE$signed"
|
||||
$json = (Get-Content $projectPath) -join "`n" | ConvertFrom-Json
|
||||
$options = @{"warningsAsErrors" = $true; "xmlDoc" = $true; "keyFile" = $file; "define" = ($constants -split ";") }
|
||||
Add-Member -InputObject $json -MemberType NoteProperty -Name "buildOptions" -Value $options -Force
|
||||
|
||||
$json = (Get-Content $projectPath) -join "`n" | ConvertFrom-Json
|
||||
$options = @{"warningsAsErrors" = $true; "xmlDoc" = $true; "keyFile" = $file; "define" = ((GetConstants "dotnet" $sign) -split ";") }
|
||||
Add-Member -InputObject $json -MemberType NoteProperty -Name "buildOptions" -Value $options -Force
|
||||
|
||||
$json.version = GetNuGetVersion
|
||||
|
||||
ConvertTo-Json $json -Depth 10 | Set-Content $projectPath
|
||||
$json.version = GetNuGetVersion
|
||||
|
||||
ConvertTo-Json $json -Depth 10 | Set-Content $projectPath
|
||||
}
|
||||
|
||||
function Execute-Command($command) {
|
||||
|
||||
@@ -72,37 +72,28 @@
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Entity">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel.Web">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Bson
|
||||
|
||||
public void Close()
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_STREAM_READER_WRITER_CLOSE
|
||||
_writer.Close();
|
||||
#else
|
||||
_writer.Dispose();
|
||||
@@ -149,7 +149,7 @@ namespace Newtonsoft.Json.Bson
|
||||
|
||||
ticks = DateTimeUtils.ConvertDateTimeToJavaScriptTicks(dateTime, false);
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = (DateTimeOffset)value.Value;
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace Newtonsoft.Json.Bson
|
||||
|
||||
if (CloseInput)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_STREAM_READER_WRITER_CLOSE
|
||||
_reader?.Close();
|
||||
#else
|
||||
_reader?.Dispose();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -234,7 +234,7 @@ namespace Newtonsoft.Json.Bson
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
@@ -386,7 +386,7 @@ namespace Newtonsoft.Json.Bson
|
||||
{
|
||||
base.WriteValue(value);
|
||||
string s = null;
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
s = value.ToString(CultureInfo.InvariantCulture);
|
||||
#else
|
||||
s = value.ToString();
|
||||
@@ -436,7 +436,7 @@ namespace Newtonsoft.Json.Bson
|
||||
AddValue(value, BsonType.Date);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Writes a <see cref="DateTimeOffset"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
using System;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Globalization;
|
||||
@@ -37,7 +37,7 @@ namespace Newtonsoft.Json.Converters
|
||||
/// </summary>
|
||||
public class BinaryConverter : JsonConverter
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_LINQ
|
||||
private const string BinaryTypeName = "System.Data.Linq.Binary";
|
||||
private const string BinaryToArrayName = "ToArray";
|
||||
private ReflectionObject _reflectionObject;
|
||||
@@ -64,7 +64,7 @@ namespace Newtonsoft.Json.Converters
|
||||
|
||||
private byte[] GetByteArray(object value)
|
||||
{
|
||||
#if !(NET20)
|
||||
#if HAVE_LINQ
|
||||
if (value.GetType().AssignableToTypeName(BinaryTypeName))
|
||||
{
|
||||
EnsureReflectionObject(value.GetType());
|
||||
@@ -79,7 +79,7 @@ namespace Newtonsoft.Json.Converters
|
||||
throw new JsonSerializationException("Unexpected value type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, value.GetType()));
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_LINQ
|
||||
private void EnsureReflectionObject(Type t)
|
||||
{
|
||||
if (_reflectionObject == null)
|
||||
@@ -131,7 +131,7 @@ namespace Newtonsoft.Json.Converters
|
||||
? Nullable.GetUnderlyingType(objectType)
|
||||
: objectType;
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_LINQ
|
||||
if (t.AssignableToTypeName(BinaryTypeName))
|
||||
{
|
||||
EnsureReflectionObject(t);
|
||||
@@ -181,7 +181,7 @@ namespace Newtonsoft.Json.Converters
|
||||
/// </returns>
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_LINQ
|
||||
if (objectType.AssignableToTypeName(BinaryTypeName))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
using System;
|
||||
using System.Data;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -248,7 +248,7 @@ namespace Newtonsoft.Json.Converters
|
||||
// all fsharp objects have CompilationMappingAttribute
|
||||
// get the fsharp assembly from the attribute and initialize latebound methods
|
||||
object[] attributes;
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
attributes = objectType.GetCustomAttributes(true);
|
||||
#else
|
||||
attributes = objectType.GetTypeInfo().GetCustomAttributes(true).ToArray();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ENTITY_FRAMEWORK
|
||||
using System;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Newtonsoft.Json.Converters
|
||||
|
||||
text = dateTime.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else if (value is DateTimeOffset)
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = (DateTimeOffset)value;
|
||||
@@ -124,11 +124,9 @@ namespace Newtonsoft.Json.Converters
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
bool nullable = ReflectionUtils.IsNullableType(objectType);
|
||||
#if !NET20
|
||||
Type t = (nullable)
|
||||
? Nullable.GetUnderlyingType(objectType)
|
||||
: objectType;
|
||||
#endif
|
||||
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
{
|
||||
@@ -142,7 +140,7 @@ namespace Newtonsoft.Json.Converters
|
||||
|
||||
if (reader.TokenType == JsonToken.Date)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (t == typeof(DateTimeOffset))
|
||||
{
|
||||
return (reader.Value is DateTimeOffset) ? reader.Value : new DateTimeOffset((DateTime)reader.Value);
|
||||
@@ -170,7 +168,7 @@ namespace Newtonsoft.Json.Converters
|
||||
return null;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (t == typeof(DateTimeOffset))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_dateTimeFormat))
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Newtonsoft.Json.Converters
|
||||
DateTime utcDateTime = dateTime.ToUniversalTime();
|
||||
ticks = DateTimeUtils.ConvertDateTimeToJavaScriptTicks(utcDateTime);
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else if (value is DateTimeOffset)
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = (DateTimeOffset)value;
|
||||
@@ -111,16 +111,15 @@ namespace Newtonsoft.Json.Converters
|
||||
throw JsonSerializationException.Create(reader, "Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
Type t = (ReflectionUtils.IsNullableType(objectType))
|
||||
? Nullable.GetUnderlyingType(objectType)
|
||||
: objectType;
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (t == typeof(DateTimeOffset))
|
||||
{
|
||||
return new DateTimeOffset(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !PORTABLE40
|
||||
#if !(PORTABLE || NET20 || NET35) || NETSTANDARD1_1
|
||||
#if (HAVE_XML_DOCUMENT || HAVE_XLINQ)
|
||||
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System;
|
||||
@@ -32,7 +33,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !(NET20 || PORTABLE40)
|
||||
#if HAVE_XLINQ
|
||||
using System.Xml.Linq;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -40,7 +41,7 @@ using Newtonsoft.Json.Utilities;
|
||||
namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
#region XmlNodeWrappers
|
||||
#if !DOTNET && !PORTABLE && !PORTABLE40
|
||||
#if HAVE_XML_DOCUMENT
|
||||
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
|
||||
{
|
||||
private readonly XmlDocument _document;
|
||||
@@ -403,7 +404,7 @@ namespace Newtonsoft.Json.Converters
|
||||
#endregion
|
||||
|
||||
#region XNodeWrappers
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
internal class XDeclarationWrapper : XObjectWrapper, IXmlDeclaration
|
||||
{
|
||||
internal XDeclaration Declaration { get; private set; }
|
||||
@@ -1045,14 +1046,14 @@ namespace Newtonsoft.Json.Converters
|
||||
|
||||
private IXmlNode WrapXml(object value)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
XObject xObject = value as XObject;
|
||||
if (xObject != null)
|
||||
{
|
||||
return XContainerWrapper.WrapNode(xObject);
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_XML_DOCUMENT
|
||||
XmlNode node = value as XmlNode;
|
||||
if (node != null)
|
||||
{
|
||||
@@ -1428,7 +1429,7 @@ namespace Newtonsoft.Json.Converters
|
||||
IXmlDocument document = null;
|
||||
IXmlNode rootNode = null;
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
if (typeof(XObject).IsAssignableFrom(objectType))
|
||||
{
|
||||
if (objectType != typeof(XDocument) && objectType != typeof(XElement))
|
||||
@@ -1441,7 +1442,7 @@ namespace Newtonsoft.Json.Converters
|
||||
rootNode = document;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_XML_DOCUMENT
|
||||
if (typeof(XmlNode).IsAssignableFrom(objectType))
|
||||
{
|
||||
if (objectType != typeof(XmlDocument))
|
||||
@@ -1480,7 +1481,7 @@ namespace Newtonsoft.Json.Converters
|
||||
DeserializeNode(reader, document, manager, rootNode);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
if (objectType == typeof(XElement))
|
||||
{
|
||||
XElement element = (XElement)document.DocumentElement.WrappedNode;
|
||||
@@ -1653,7 +1654,7 @@ namespace Newtonsoft.Json.Converters
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.Integer)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (reader.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)reader.Value).ToString(CultureInfo.InvariantCulture);
|
||||
@@ -1681,7 +1682,7 @@ namespace Newtonsoft.Json.Converters
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.Date)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (reader.Value is DateTimeOffset)
|
||||
{
|
||||
return XmlConvert.ToString((DateTimeOffset)reader.Value);
|
||||
@@ -1743,7 +1744,7 @@ namespace Newtonsoft.Json.Converters
|
||||
{
|
||||
element.SetAttributeNode(document.CreateAttribute("json:Array", JsonNamespaceUri, "true"));
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
// linq to xml doesn't automatically include prefixes via the namespace manager
|
||||
if (element is XElementWrapper)
|
||||
{
|
||||
@@ -2065,13 +2066,13 @@ namespace Newtonsoft.Json.Converters
|
||||
/// </returns>
|
||||
public override bool CanConvert(Type valueType)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_XLINQ
|
||||
if (typeof(XObject).IsAssignableFrom(valueType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_XML_DOCUMENT
|
||||
if (typeof(XmlNode).IsAssignableFrom(valueType))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Newtonsoft.Json
|
||||
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="DateTime"/>.
|
||||
/// </summary>
|
||||
DateTime = 1,
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Date formatted strings, e.g. <c>"\/Date(1198908717056)\/"</c> and <c>"2012-03-21T05:40Z"</c>, are parsed to <see cref="DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#if DOTNET || PORTABLE40 || PORTABLE
|
||||
#if !HAVE_BINARY_SERIALIZATION
|
||||
|
||||
namespace System.Runtime.Serialization.Formatters
|
||||
{
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_TPL
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -38,7 +38,7 @@ using System.Xml;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Text;
|
||||
#if !(NET20 || PORTABLE40)
|
||||
#if HAVE_XLINQ
|
||||
using System.Xml.Linq;
|
||||
|
||||
#endif
|
||||
@@ -127,7 +127,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Converts the <see cref="DateTimeOffset"/> to its JSON string representation.
|
||||
/// </summary>
|
||||
@@ -238,7 +238,7 @@ namespace Newtonsoft.Json
|
||||
return value.ToString(null, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
private static string ToStringInternal(BigInteger value)
|
||||
{
|
||||
return value.ToString(null, CultureInfo.InvariantCulture);
|
||||
@@ -366,7 +366,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
string text;
|
||||
string qc;
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
text = value.ToString("D", CultureInfo.InvariantCulture);
|
||||
qc = quoteChar.ToString(CultureInfo.InvariantCulture);
|
||||
#else
|
||||
@@ -496,11 +496,11 @@ namespace Newtonsoft.Json
|
||||
return ToString((DateTime)value);
|
||||
case PrimitiveTypeCode.Decimal:
|
||||
return ToString((decimal)value);
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_DB_NULL_TYPE_CODE
|
||||
case PrimitiveTypeCode.DBNull:
|
||||
return Null;
|
||||
#endif
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
return ToString((DateTimeOffset)value);
|
||||
#endif
|
||||
@@ -510,7 +510,7 @@ namespace Newtonsoft.Json
|
||||
return ToString((Uri)value);
|
||||
case PrimitiveTypeCode.TimeSpan:
|
||||
return ToString((TimeSpan)value);
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
return ToStringInternal((BigInteger)value);
|
||||
#endif
|
||||
@@ -661,7 +661,7 @@ namespace Newtonsoft.Json
|
||||
return sw.ToString();
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_TPL
|
||||
/// <summary>
|
||||
/// Asynchronously serializes the specified object to a JSON string.
|
||||
/// Serialization will happen on a new thread.
|
||||
@@ -864,7 +864,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_TPL
|
||||
/// <summary>
|
||||
/// Asynchronously deserializes the JSON to the specified .NET type.
|
||||
/// Deserialization will happen on a new thread.
|
||||
@@ -969,7 +969,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_TPL
|
||||
/// <summary>
|
||||
/// Asynchronously populates the object with values from the JSON string using <see cref="JsonSerializerSettings"/>.
|
||||
/// </summary>
|
||||
@@ -991,7 +991,7 @@ namespace Newtonsoft.Json
|
||||
#endregion
|
||||
|
||||
#region Xml
|
||||
#if !(PORTABLE40 || PORTABLE || DOTNET)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Serializes the <see cref="XmlNode"/> to a JSON string.
|
||||
/// </summary>
|
||||
@@ -1071,7 +1071,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !NET20 && !PORTABLE40
|
||||
#if HAVE_XLINQ
|
||||
/// <summary>
|
||||
/// Serializes the <see cref="XNode"/> to a JSON string.
|
||||
/// </summary>
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// The exception thrown when an error occurs during JSON serialization or deserialization.
|
||||
/// </summary>
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
public class JsonException : Exception
|
||||
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonException"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -27,12 +27,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -193,7 +193,7 @@ namespace Newtonsoft.Json
|
||||
set
|
||||
{
|
||||
if (value < DateParseHandling.None ||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
value > DateParseHandling.DateTimeOffset
|
||||
#else
|
||||
value > DateParseHandling.DateTime
|
||||
@@ -629,7 +629,7 @@ namespace Newtonsoft.Json
|
||||
if (!(Value is double))
|
||||
{
|
||||
double d;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
d = (double)(BigInteger)Value;
|
||||
@@ -689,7 +689,7 @@ namespace Newtonsoft.Json
|
||||
case JsonToken.Integer:
|
||||
case JsonToken.Float:
|
||||
bool b;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
b = (BigInteger)Value != 0;
|
||||
@@ -796,7 +796,7 @@ namespace Newtonsoft.Json
|
||||
case JsonToken.EndArray:
|
||||
return null;
|
||||
case JsonToken.Date:
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (Value is DateTimeOffset)
|
||||
{
|
||||
SetToken(JsonToken.Date, ((DateTimeOffset)Value).DateTime, false);
|
||||
@@ -838,7 +838,7 @@ namespace Newtonsoft.Json
|
||||
throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// The exception thrown when an error occurs while reading JSON text.
|
||||
/// </summary>
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
public class JsonReaderException : JsonException
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonReaderException"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// The exception thrown when an error occurs during JSON serialization or deserialization.
|
||||
/// </summary>
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
public class JsonSerializationException : JsonException
|
||||
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -23,12 +23,12 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
@@ -41,7 +41,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
// It's not safe to perform the async methods here in a derived class as if the synchronous equivalent
|
||||
// has been overriden then the asychronous method will no longer be doing the same operation
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40) // Double-check this isn't included inappropriately.
|
||||
#if HAVE_ASYNC // Double-check this isn't included inappropriately.
|
||||
private readonly bool _safeAsync;
|
||||
#endif
|
||||
|
||||
@@ -1397,7 +1397,7 @@ namespace Newtonsoft.Json
|
||||
case '9':
|
||||
await ParseNumberAsync(ReadType.Read, cancellationToken).ConfigureAwait(false);
|
||||
bool b;
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
b = (BigInteger)Value != 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -42,7 +42,7 @@ namespace Newtonsoft.Json
|
||||
ReadAsString,
|
||||
ReadAsDecimal,
|
||||
ReadAsDateTime,
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
ReadAsDateTimeOffset,
|
||||
#endif
|
||||
ReadAsDouble,
|
||||
@@ -83,7 +83,7 @@ namespace Newtonsoft.Json
|
||||
_reader = reader;
|
||||
_lineNumber = 1;
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
_safeAsync = GetType() == typeof(JsonTextReader);
|
||||
#endif
|
||||
}
|
||||
@@ -178,7 +178,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
dateParseHandling = DateParseHandling.DateTime;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else if (readType == ReadType.ReadAsDateTimeOffset)
|
||||
{
|
||||
dateParseHandling = DateParseHandling.DateTimeOffset;
|
||||
@@ -198,7 +198,7 @@ namespace Newtonsoft.Json
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else
|
||||
{
|
||||
DateTimeOffset dt;
|
||||
@@ -694,7 +694,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
|
||||
return ReadDateTimeString((string)Value);
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case ReadType.ReadAsDateTimeOffset:
|
||||
if (Value is DateTimeOffset)
|
||||
{
|
||||
@@ -764,7 +764,7 @@ namespace Newtonsoft.Json
|
||||
case '9':
|
||||
ParseNumber(ReadType.Read);
|
||||
bool b;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
b = (BigInteger)Value != 0;
|
||||
@@ -965,7 +965,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
@@ -2071,7 +2071,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
else if (parseResult == ParseResult.Overflow)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
string number = _stringReference.ToString();
|
||||
|
||||
if (number.Length > MaximumJavascriptIntegerCharacterLength)
|
||||
@@ -2132,7 +2132,7 @@ namespace Newtonsoft.Json
|
||||
return JsonReaderException.Create(this, message, ex);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
// By using the BigInteger type in a separate method,
|
||||
// the runtime can execute the ParseNumber even if
|
||||
// the System.Numerics.BigInteger.Parse method is
|
||||
@@ -2485,7 +2485,7 @@ namespace Newtonsoft.Json
|
||||
|
||||
if (CloseInput)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_STREAM_READER_WRITER_CLOSE
|
||||
_reader?.Close();
|
||||
#else
|
||||
_reader?.Dispose();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -23,12 +23,12 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
@@ -40,7 +40,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
// It's not safe to perform the async methods here in a derived class as if the synchronous equivalent
|
||||
// has been overriden then the asychronous method will no longer be doing the same operation.
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40) // Double-check this isn't included inappropriately.
|
||||
#if HAVE_ASYNC // Double-check this isn't included inappropriately.
|
||||
private readonly bool _safeAsync;
|
||||
#endif
|
||||
|
||||
@@ -882,7 +882,7 @@ namespace Newtonsoft.Json
|
||||
await InternalWriteValueAsync(JsonToken.String, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await _writer.WriteAsync(_quoteChar).ConfigureAwait(false);
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
await _writer.WriteAsync(value.ToString("D", CultureInfo.InvariantCulture), cancellationToken).ConfigureAwait(false);
|
||||
#else
|
||||
await _writer.WriteAsync(value.ToString("D"), cancellationToken).ConfigureAwait(false);
|
||||
@@ -970,7 +970,7 @@ namespace Newtonsoft.Json
|
||||
return value == null ? DoWriteNullAsync(cancellationToken) : WriteIntegerValueAsync(value.GetValueOrDefault(), cancellationToken);
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
internal Task WriteValueAsync(BigInteger value, CancellationToken cancellationToken)
|
||||
{
|
||||
return WriteValueInternalAsync(JsonToken.Integer, value.ToString(CultureInfo.InvariantCulture), cancellationToken);
|
||||
@@ -993,7 +993,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
return WriteNullAsync(cancellationToken);
|
||||
}
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
return WriteValueAsync((BigInteger)value, cancellationToken);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -162,7 +162,7 @@ namespace Newtonsoft.Json
|
||||
|
||||
UpdateCharEscapeFlags();
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
_safeAsync = GetType() == typeof(JsonTextWriter);
|
||||
#endif
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace Newtonsoft.Json
|
||||
|
||||
if (CloseOutput)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_STREAM_READER_WRITER_CLOSE
|
||||
_writer?.Close();
|
||||
#else
|
||||
_writer?.Dispose();
|
||||
@@ -388,7 +388,7 @@ namespace Newtonsoft.Json
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
@@ -676,7 +676,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Writes a <see cref="DateTimeOffset"/> value.
|
||||
/// </summary>
|
||||
@@ -721,7 +721,7 @@ namespace Newtonsoft.Json
|
||||
|
||||
string text = null;
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
text = value.ToString("D", CultureInfo.InvariantCulture);
|
||||
#else
|
||||
text = value.ToString("D");
|
||||
@@ -741,7 +741,7 @@ namespace Newtonsoft.Json
|
||||
InternalWriteValue(JsonToken.String);
|
||||
|
||||
string text;
|
||||
#if (NET35 || NET20)
|
||||
#if !HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE
|
||||
text = value.ToString();
|
||||
#else
|
||||
text = value.ToString(null, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -34,7 +34,7 @@ using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -490,7 +490,7 @@ namespace Newtonsoft.Json
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
@@ -714,7 +714,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
IEnumerable<string> unmatchedRequiredProperties = requiredProperties.Where(kv => !kv.Value).Select(kv => kv.Key);
|
||||
RaiseError("Required properties are missing from object: {0}.".FormatWith(CultureInfo.InvariantCulture, string.Join(", ", unmatchedRequiredProperties
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_STRING_JOIN_WITH_ENUMERABLE
|
||||
.ToArray()
|
||||
#endif
|
||||
)), schema);
|
||||
@@ -852,7 +852,7 @@ namespace Newtonsoft.Json
|
||||
if (schema.DivisibleBy != null)
|
||||
{
|
||||
bool notDivisible;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
// not that this will lose any decimal point on DivisibleBy
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -23,12 +23,12 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
@@ -612,7 +612,7 @@ namespace Newtonsoft.Json
|
||||
case JsonToken.Integer:
|
||||
ValidationUtils.ArgumentNotNull(value, nameof(value));
|
||||
return
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
value is BigInteger ? WriteValueAsync((BigInteger)value, cancellationToken) :
|
||||
#endif
|
||||
WriteValueAsync(Convert.ToInt64(value, CultureInfo.InvariantCulture), cancellationToken);
|
||||
@@ -1652,7 +1652,7 @@ namespace Newtonsoft.Json
|
||||
return writer.WriteValueAsync((TimeSpan)value, cancellationToken);
|
||||
case PrimitiveTypeCode.TimeSpanNullable:
|
||||
return writer.WriteValueAsync(value == null ? (TimeSpan?)null : (TimeSpan)value, cancellationToken);
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
|
||||
// this will call to WriteValueAsync(object)
|
||||
@@ -1668,12 +1668,12 @@ namespace Newtonsoft.Json
|
||||
return writer.WriteValueAsync((string)value, cancellationToken);
|
||||
case PrimitiveTypeCode.Bytes:
|
||||
return writer.WriteValueAsync((byte[])value, cancellationToken);
|
||||
#if !(PORTABLE || DOTNET)
|
||||
#if HAVE_DB_NULL_TYPE_CODE
|
||||
case PrimitiveTypeCode.DBNull:
|
||||
return writer.WriteNullAsync(cancellationToken);
|
||||
#endif
|
||||
default:
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
IConvertible convertable = value as IConvertible;
|
||||
if (convertable != null)
|
||||
{
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -532,7 +532,7 @@ namespace Newtonsoft.Json
|
||||
break;
|
||||
case JsonToken.Integer:
|
||||
ValidationUtils.ArgumentNotNull(value, nameof(value));
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
WriteValue((BigInteger)value);
|
||||
@@ -587,7 +587,7 @@ namespace Newtonsoft.Json
|
||||
break;
|
||||
case JsonToken.Date:
|
||||
ValidationUtils.ArgumentNotNull(value, nameof(value));
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (value is DateTimeOffset)
|
||||
{
|
||||
WriteValue((DateTimeOffset)value);
|
||||
@@ -1049,7 +1049,7 @@ namespace Newtonsoft.Json
|
||||
InternalWriteValue(JsonToken.Date);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Writes a <see cref="DateTimeOffset"/> value.
|
||||
/// </summary>
|
||||
@@ -1306,7 +1306,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Writes a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/> value.
|
||||
/// </summary>
|
||||
@@ -1401,7 +1401,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
// this is here because adding a WriteValue(BigInteger) to JsonWriter will
|
||||
// mean the user has to add a reference to System.Numerics.dll
|
||||
if (value is BigInteger)
|
||||
@@ -1533,7 +1533,7 @@ namespace Newtonsoft.Json
|
||||
case PrimitiveTypeCode.DateTimeNullable:
|
||||
writer.WriteValue((value == null) ? (DateTime?)null : (DateTime)value);
|
||||
break;
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
writer.WriteValue((DateTimeOffset)value);
|
||||
break;
|
||||
@@ -1559,7 +1559,7 @@ namespace Newtonsoft.Json
|
||||
case PrimitiveTypeCode.TimeSpanNullable:
|
||||
writer.WriteValue((value == null) ? (TimeSpan?)null : (TimeSpan)value);
|
||||
break;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
// this will call to WriteValue(object)
|
||||
writer.WriteValue((BigInteger)value);
|
||||
@@ -1578,13 +1578,13 @@ namespace Newtonsoft.Json
|
||||
case PrimitiveTypeCode.Bytes:
|
||||
writer.WriteValue((byte[])value);
|
||||
break;
|
||||
#if !(PORTABLE || DOTNET)
|
||||
#if HAVE_DB_NULL_TYPE_CODE
|
||||
case PrimitiveTypeCode.DBNull:
|
||||
writer.WriteNull();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
IConvertible convertible = value as IConvertible;
|
||||
if (convertible != null)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// The exception thrown when an error occurs while writing JSON text.
|
||||
/// </summary>
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
public class JsonWriterException : JsonException
|
||||
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonWriterException"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of token.</typeparam>
|
||||
public interface IJEnumerable<
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_VARIANT_TYPE_PARAMETERS
|
||||
out
|
||||
#endif
|
||||
T> : IEnumerable<T> where T : JToken
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !PORTABLE40
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
using System.Collections.Specialized;
|
||||
#endif
|
||||
using System.Threading;
|
||||
@@ -33,7 +33,7 @@ using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -45,16 +45,16 @@ namespace Newtonsoft.Json.Linq
|
||||
/// <summary>
|
||||
/// Represents a token that can contain other tokens.
|
||||
/// </summary>
|
||||
public abstract partial class JContainer : JToken, IList<JToken>
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
public abstract partial class JContainer : JToken, IList<JToken>
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
, ITypedList, IBindingList
|
||||
#endif
|
||||
, IList
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
, INotifyCollectionChanged
|
||||
#endif
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
internal ListChangedEventHandler _listChanged;
|
||||
internal AddingNewEventHandler _addingNew;
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Newtonsoft.Json.Linq
|
||||
remove { _addingNew -= value; }
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
internal NotifyCollectionChangedEventHandler _collectionChanged;
|
||||
|
||||
/// <summary>
|
||||
@@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Linq
|
||||
protected abstract IList<JToken> ChildrenTokens { get; }
|
||||
|
||||
private object _syncRoot;
|
||||
#if !(PORTABLE40)
|
||||
#if (HAVE_COMPONENT_MODEL || HAVE_INOTIFY_COLLECTION_CHANGED)
|
||||
private bool _busy;
|
||||
#endif
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
internal void CheckReentrancy()
|
||||
{
|
||||
#if !(PORTABLE40)
|
||||
#if (HAVE_COMPONENT_MODEL || HAVE_INOTIFY_COLLECTION_CHANGED)
|
||||
if (_busy)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot change {0} during a collection change event.".FormatWith(CultureInfo.InvariantCulture, GetType()));
|
||||
@@ -132,7 +132,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return new List<JToken>();
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
/// <summary>
|
||||
/// Raises the <see cref="AddingNew"/> event.
|
||||
/// </summary>
|
||||
@@ -164,7 +164,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
/// <summary>
|
||||
/// Raises the <see cref="CollectionChanged"/> event.
|
||||
/// </summary>
|
||||
@@ -384,13 +384,13 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
children.Insert(index, item);
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
if (_listChanged != null)
|
||||
{
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
if (_collectionChanged != null)
|
||||
{
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
|
||||
@@ -432,13 +432,13 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
children.RemoveAt(index);
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
if (_listChanged != null)
|
||||
{
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
if (_collectionChanged != null)
|
||||
{
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
|
||||
@@ -512,13 +512,13 @@ namespace Newtonsoft.Json.Linq
|
||||
existing.Previous = null;
|
||||
existing.Next = null;
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
if (_listChanged != null)
|
||||
{
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
if (_collectionChanged != null)
|
||||
{
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, item, existing, index));
|
||||
@@ -541,13 +541,13 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
children.Clear();
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
if (_listChanged != null)
|
||||
{
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
if (_collectionChanged != null)
|
||||
{
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
@@ -875,7 +875,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
|
||||
{
|
||||
return string.Empty;
|
||||
@@ -1048,7 +1048,7 @@ namespace Newtonsoft.Json.Linq
|
||||
#endregion
|
||||
|
||||
#region IBindingList Members
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
void IBindingList.AddIndex(PropertyDescriptor property)
|
||||
{
|
||||
}
|
||||
@@ -1151,7 +1151,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
break;
|
||||
case MergeArrayHandling.Union:
|
||||
#if !NET20
|
||||
#if HAVE_HASH_SET
|
||||
HashSet<JToken> items = new HashSet<JToken>(target, EqualityComparer);
|
||||
|
||||
foreach (JToken item in content)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
@@ -25,23 +25,22 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
using System.Collections.ObjectModel;
|
||||
#if !PORTABLE40
|
||||
using System.Collections.Specialized;
|
||||
#endif
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Linq
|
||||
@@ -53,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" />
|
||||
/// </example>
|
||||
public partial class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
, ICustomTypeDescriptor
|
||||
#endif
|
||||
#if !(NET20 || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_INOTIFY_PROPERTY_CHANGING
|
||||
, INotifyPropertyChanging
|
||||
#endif
|
||||
{
|
||||
@@ -76,7 +75,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#if !(NET20 || PORTABLE || PORTABLE40)
|
||||
#if HAVE_INOTIFY_PROPERTY_CHANGING
|
||||
/// <summary>
|
||||
/// Occurs when a property value is changing.
|
||||
/// </summary>
|
||||
@@ -208,13 +207,13 @@ namespace Newtonsoft.Json.Linq
|
||||
internal void InternalPropertyChanged(JProperty childProperty)
|
||||
{
|
||||
OnPropertyChanged(childProperty.Name);
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
if (_listChanged != null)
|
||||
{
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
|
||||
}
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||
if (_collectionChanged != null)
|
||||
{
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, childProperty, childProperty, IndexOfItem(childProperty)));
|
||||
@@ -224,7 +223,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
internal void InternalPropertyChanging(JProperty childProperty)
|
||||
{
|
||||
#if !(NET20 || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_INOTIFY_PROPERTY_CHANGING
|
||||
OnPropertyChanging(childProperty.Name);
|
||||
#endif
|
||||
}
|
||||
@@ -333,7 +332,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !(NET20 || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_INOTIFY_PROPERTY_CHANGING
|
||||
OnPropertyChanging(propertyName);
|
||||
#endif
|
||||
Add(new JProperty(propertyName, value));
|
||||
@@ -705,7 +704,7 @@ namespace Newtonsoft.Json.Linq
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE || NET20)
|
||||
#if HAVE_INOTIFY_PROPERTY_CHANGING
|
||||
/// <summary>
|
||||
/// Raises the <see cref="PropertyChanging"/> event with the provided arguments.
|
||||
/// </summary>
|
||||
@@ -716,7 +715,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
|
||||
|
||||
#region ICustomTypeDescriptor
|
||||
@@ -790,7 +789,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
/// <summary>
|
||||
/// Returns the <see cref="DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq.JsonPath;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -39,7 +39,7 @@ using Newtonsoft.Json.Utilities;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Collections;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -52,10 +52,10 @@ namespace Newtonsoft.Json.Linq
|
||||
/// Represents an abstract JSON token.
|
||||
/// </summary>
|
||||
public abstract partial class JToken : IJEnumerable<JToken>, IJsonLineInfo
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ICLONEABLE
|
||||
, ICloneable
|
||||
#endif
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
, IDynamicMetaObjectProvider
|
||||
#endif
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
private static readonly JTokenType[] BooleanTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean };
|
||||
private static readonly JTokenType[] NumberTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean };
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
private static readonly JTokenType[] BigIntegerTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes };
|
||||
#endif
|
||||
private static readonly JTokenType[] StringTypes = new[] { JTokenType.Date, JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes, JTokenType.Guid, JTokenType.TimeSpan, JTokenType.Uri };
|
||||
@@ -492,7 +492,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||
@@ -502,7 +502,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return Convert.ToBoolean(v.Value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Performs an explicit conversion from <see cref="Newtonsoft.Json.Linq.JToken"/> to <see cref="System.DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
@@ -548,7 +548,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||
@@ -571,7 +571,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (long)(BigInteger)v.Value;
|
||||
@@ -599,7 +599,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (v.Value is DateTimeOffset)
|
||||
{
|
||||
return ((DateTimeOffset)v.Value).DateTime;
|
||||
@@ -609,7 +609,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (v.Value != null) ? (DateTime?)Convert.ToDateTime(v.Value, CultureInfo.InvariantCulture) : null;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Performs an explicit conversion from <see cref="JToken"/> to <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
|
||||
/// </summary>
|
||||
@@ -665,7 +665,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (decimal?)(BigInteger)v.Value;
|
||||
@@ -693,7 +693,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (double?)(BigInteger)v.Value;
|
||||
@@ -721,7 +721,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (char?)(BigInteger)v.Value;
|
||||
@@ -744,7 +744,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (int)(BigInteger)v.Value;
|
||||
@@ -767,7 +767,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (short)(BigInteger)v.Value;
|
||||
@@ -791,7 +791,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ushort)(BigInteger)v.Value;
|
||||
@@ -815,7 +815,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (char)(BigInteger)v.Value;
|
||||
@@ -838,7 +838,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (byte)(BigInteger)v.Value;
|
||||
@@ -862,7 +862,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (sbyte)(BigInteger)v.Value;
|
||||
@@ -890,7 +890,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (int?)(BigInteger)v.Value;
|
||||
@@ -918,7 +918,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (short?)(BigInteger)v.Value;
|
||||
@@ -947,7 +947,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ushort?)(BigInteger)v.Value;
|
||||
@@ -975,7 +975,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (byte?)(BigInteger)v.Value;
|
||||
@@ -1004,7 +1004,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (sbyte?)(BigInteger)v.Value;
|
||||
@@ -1027,7 +1027,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to DateTime.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (v.Value is DateTimeOffset)
|
||||
{
|
||||
return ((DateTimeOffset)v.Value).DateTime;
|
||||
@@ -1055,7 +1055,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (long?)(BigInteger)v.Value;
|
||||
@@ -1083,7 +1083,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (float?)(BigInteger)v.Value;
|
||||
@@ -1106,7 +1106,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (decimal)(BigInteger)v.Value;
|
||||
@@ -1135,7 +1135,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (uint?)(BigInteger)v.Value;
|
||||
@@ -1164,7 +1164,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ulong?)(BigInteger)v.Value;
|
||||
@@ -1187,7 +1187,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (double)(BigInteger)v.Value;
|
||||
@@ -1210,7 +1210,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (float)(BigInteger)v.Value;
|
||||
@@ -1249,7 +1249,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return Convert.ToBase64String(bytes);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)v.Value).ToString(CultureInfo.InvariantCulture);
|
||||
@@ -1273,7 +1273,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (uint)(BigInteger)v.Value;
|
||||
@@ -1297,7 +1297,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ulong)(BigInteger)v.Value;
|
||||
@@ -1329,7 +1329,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return Convert.FromBase64String(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)v.Value).ToByteArray();
|
||||
@@ -1467,7 +1467,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (v.Value is Uri) ? (Uri)v.Value : new Uri(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
private static BigInteger ToBigInteger(JToken value)
|
||||
{
|
||||
JValue v = EnsureValue(value);
|
||||
@@ -1508,7 +1508,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return new JValue(value);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Performs an implicit conversion from <see cref="DateTimeOffset"/> to <see cref="JToken"/>.
|
||||
/// </summary>
|
||||
@@ -1592,7 +1592,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return new JValue(value);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Performs an implicit conversion from <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/> to <see cref="JToken"/>.
|
||||
/// </summary>
|
||||
@@ -2028,7 +2028,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (DateTime?)this;
|
||||
case PrimitiveTypeCode.DateTime:
|
||||
return (DateTime)this;
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffsetNullable:
|
||||
return (DateTimeOffset?)this;
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
@@ -2046,7 +2046,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (TimeSpan?)this;
|
||||
case PrimitiveTypeCode.TimeSpan:
|
||||
return (TimeSpan)this;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigIntegerNullable:
|
||||
return ToBigIntegerNullable(this);
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
@@ -2355,7 +2355,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return p.Evaluate(this, this, errorWhenNoMatch);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
/// <summary>
|
||||
/// Returns the <see cref="DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
@@ -2381,7 +2381,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_ICLONEABLE
|
||||
object ICloneable.Clone()
|
||||
{
|
||||
return DeepClone();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -220,7 +220,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
@@ -382,7 +382,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
base.WriteValue(value);
|
||||
string s = null;
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
s = value.ToString(CultureInfo.InvariantCulture);
|
||||
#else
|
||||
s = value.ToString();
|
||||
@@ -432,7 +432,7 @@ namespace Newtonsoft.Json.Linq
|
||||
AddValue(value, JsonToken.Date);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Writes a <see cref="DateTimeOffset"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if !PORTABLE || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Threading;
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return writer.WriteValueAsync((ulong)_value, cancellationToken);
|
||||
}
|
||||
|
||||
#if !(PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (_value is BigInteger)
|
||||
{
|
||||
return writer.WriteValueAsync((BigInteger)_value, cancellationToken);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -28,13 +28,12 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Linq
|
||||
@@ -43,7 +42,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// Represents a value in JSON (string, integer, date, etc).
|
||||
/// </summary>
|
||||
public partial class JValue : JToken, IEquatable<JValue>, IFormattable, IComparable, IComparable<JValue>
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
, IConvertible
|
||||
#endif
|
||||
{
|
||||
@@ -129,7 +128,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JValue"/> class with the given value.
|
||||
/// </summary>
|
||||
@@ -220,7 +219,7 @@ namespace Newtonsoft.Json.Linq
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
private static int CompareBigInteger(BigInteger i1, object i2)
|
||||
{
|
||||
int result = i1.CompareTo(ConvertUtils.ToBigInteger(i2));
|
||||
@@ -265,7 +264,7 @@ namespace Newtonsoft.Json.Linq
|
||||
switch (valueType)
|
||||
{
|
||||
case JTokenType.Integer:
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (objA is BigInteger)
|
||||
{
|
||||
return CompareBigInteger((BigInteger)objA, objB);
|
||||
@@ -288,7 +287,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return Convert.ToInt64(objA, CultureInfo.InvariantCulture).CompareTo(Convert.ToInt64(objB, CultureInfo.InvariantCulture));
|
||||
}
|
||||
case JTokenType.Float:
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (objA is BigInteger)
|
||||
{
|
||||
return CompareBigInteger((BigInteger)objA, objB);
|
||||
@@ -312,14 +311,14 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
return b1.CompareTo(b2);
|
||||
case JTokenType.Date:
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (objA is DateTime)
|
||||
{
|
||||
#endif
|
||||
DateTime date1 = (DateTime)objA;
|
||||
DateTime date2;
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (objB is DateTimeOffset)
|
||||
{
|
||||
date2 = ((DateTimeOffset)objB).DateTime;
|
||||
@@ -331,7 +330,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
|
||||
return date1.CompareTo(date2);
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -410,7 +409,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return d1.CompareTo(d2);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_EXPRESSIONS
|
||||
private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
|
||||
{
|
||||
if (objA is string || objB is string)
|
||||
@@ -422,7 +421,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (objA is BigInteger || objB is BigInteger)
|
||||
{
|
||||
if (objA == null || objB == null)
|
||||
@@ -607,7 +606,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return JTokenType.Null;
|
||||
}
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
else if (value == DBNull.Value)
|
||||
{
|
||||
return JTokenType.Null;
|
||||
@@ -626,7 +625,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return JTokenType.Integer;
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
else if (value is BigInteger)
|
||||
{
|
||||
return JTokenType.Integer;
|
||||
@@ -640,7 +639,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return JTokenType.Date;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
else if (value is DateTimeOffset)
|
||||
{
|
||||
return JTokenType.Date;
|
||||
@@ -762,7 +761,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
writer.WriteValue((ulong)_value);
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
else if (_value is BigInteger)
|
||||
{
|
||||
writer.WriteValue((BigInteger)_value);
|
||||
@@ -798,7 +797,7 @@ namespace Newtonsoft.Json.Linq
|
||||
writer.WriteValue(Convert.ToBoolean(_value, CultureInfo.InvariantCulture));
|
||||
return;
|
||||
case JTokenType.Date:
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (_value is DateTimeOffset)
|
||||
{
|
||||
writer.WriteValue((DateTimeOffset)_value);
|
||||
@@ -950,7 +949,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
/// <summary>
|
||||
/// Returns the <see cref="DynamicMetaObject"/> responsible for binding operations performed on this object.
|
||||
/// </summary>
|
||||
@@ -1073,7 +1072,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return Compare(_valueType, _value, obj._value);
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
TypeCode IConvertible.GetTypeCode()
|
||||
{
|
||||
if (_value == null)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -40,7 +40,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
|
||||
if (errorWhenNoMatch)
|
||||
{
|
||||
throw new JsonException("Properties {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, string.Join(", ", Names.Select(n => "'" + n + "'")
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_STRING_JOIN_WITH_ENUMERABLE
|
||||
.ToArray()
|
||||
#endif
|
||||
), t.GetType().Name));
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -208,7 +208,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
|
||||
case JTokenType.Date:
|
||||
using (StringWriter writer = StringUtils.CreateStringWriter(64))
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (value.Value is DateTimeOffset)
|
||||
{
|
||||
DateTimeUtils.WriteDateTimeOffsetString(writer, (DateTimeOffset)value.Value, DateFormatHandling.IsoDateFormat, null, CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<DefineConstants>NET20;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_FULL_REFLECTION;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_MEMORY_BARRIER;
|
||||
HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TRACE_WRITER;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XML_DOCUMENT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -49,7 +51,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Net20\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Net20\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET20</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\Net20\Newtonsoft.Json.xml</DocumentationFile>
|
||||
@@ -63,7 +65,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Net20\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Net20\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;NET20</DefineConstants>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Net20\Newtonsoft.Json.xml</DocumentationFile>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<DefineConstants>NET35;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_FULL_REFLECTION;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_LINQ;HAVE_MEMORY_BARRIER; HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -51,7 +52,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Net35\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Net35\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;NET35</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\Net35\Newtonsoft.Json.xml</DocumentationFile>
|
||||
@@ -66,7 +67,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Net35\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Net35\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;NET35</DefineConstants>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Net35\Newtonsoft.Json.xml</DocumentationFile>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<DefineConstants>NET40;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TPL;HAVE_TRACE_WRITER;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -51,7 +52,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Net40\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Net40\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET40;CODE_ANALYSIS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\Net40\Newtonsoft.Json.xml</DocumentationFile>
|
||||
@@ -66,7 +67,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Net40\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Net40\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;NET40;CODE_ANALYSIS</DefineConstants>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Net40\Newtonsoft.Json.xml</DocumentationFile>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TPL;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_INOTIFY_COLLECTION_CHANGED</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -20,7 +21,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Portable\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Portable\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
@@ -31,8 +32,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Portable\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Portable\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;PORTABLE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants><ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Portable\Newtonsoft.Json.xml</DocumentationFile>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<DefineConstants>PORTABLE40;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -25,7 +26,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Portable40\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Portable40\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;PORTABLE40</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
@@ -36,7 +37,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Portable40\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Portable40\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;PORTABLE40</DefineConstants>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Portable40\Newtonsoft.Json.xml</DocumentationFile>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
<AssemblyName>Newtonsoft.Json</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_IMMUTABLE_COLLECTIONS;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;
|
||||
HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TPL;HAVE_TRACE_WRITER;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -18,7 +20,7 @@
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\Net45\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\Net45\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\Net45\Newtonsoft.Json.xml</DocumentationFile>
|
||||
@@ -31,7 +33,7 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\Net45\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\Net45\</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
|
||||
<DefineConstants>TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Net45\Newtonsoft.Json.xml</DocumentationFile>
|
||||
@@ -274,7 +276,7 @@
|
||||
<EmbeddedResource Include="Dynamic.snk" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
|
||||
@@ -32,7 +32,7 @@ using System.Security;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
#if NETSTANDARD1_0
|
||||
#if NETSTANDARD1_0
|
||||
[assembly: AssemblyTitle("Json.NET .NET Standard 1.0")]
|
||||
#elif NETSTANDARD1_1
|
||||
[assembly: AssemblyTitle("Json.NET .NET Standard 1.1")]
|
||||
@@ -74,7 +74,7 @@ using System.Security;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COM_ATTRIBUTES
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Schema
|
||||
/// JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details.
|
||||
/// </note>
|
||||
/// </summary>
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
[Serializable]
|
||||
#endif
|
||||
[Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")]
|
||||
@@ -88,7 +88,7 @@ namespace Newtonsoft.Json.Schema
|
||||
{
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -193,7 +193,7 @@ namespace Newtonsoft.Json.Schema
|
||||
return containerAttribute.Description;
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(type);
|
||||
return descriptionAttribute?.Description;
|
||||
#else
|
||||
@@ -354,14 +354,14 @@ namespace Newtonsoft.Json.Schema
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
case JsonContractType.Serializable:
|
||||
CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);
|
||||
CurrentSchema.Id = GetTypeId(type, false);
|
||||
GenerateISerializableContract(type, (JsonISerializableContract)contract);
|
||||
break;
|
||||
#endif
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
case JsonContractType.Dynamic:
|
||||
#endif
|
||||
case JsonContractType.Linq:
|
||||
@@ -419,7 +419,7 @@ namespace Newtonsoft.Json.Schema
|
||||
}
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
private void GenerateISerializableContract(Type type, JsonISerializableContract contract)
|
||||
{
|
||||
CurrentSchema.AllowAdditionalProperties = true;
|
||||
@@ -468,7 +468,7 @@ namespace Newtonsoft.Json.Schema
|
||||
case PrimitiveTypeCode.Empty:
|
||||
case PrimitiveTypeCode.Object:
|
||||
return schemaType | JsonSchemaType.String;
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_DB_NULL_TYPE_CODE
|
||||
case PrimitiveTypeCode.DBNull:
|
||||
return schemaType | JsonSchemaType.Null;
|
||||
#endif
|
||||
@@ -484,7 +484,7 @@ namespace Newtonsoft.Json.Schema
|
||||
case PrimitiveTypeCode.UInt32:
|
||||
case PrimitiveTypeCode.Int64:
|
||||
case PrimitiveTypeCode.UInt64:
|
||||
#if !(PORTABLE || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
#endif
|
||||
return schemaType | JsonSchemaType.Integer;
|
||||
@@ -494,7 +494,7 @@ namespace Newtonsoft.Json.Schema
|
||||
return schemaType | JsonSchemaType.Float;
|
||||
// convert to string?
|
||||
case PrimitiveTypeCode.DateTime:
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
#endif
|
||||
return schemaType | JsonSchemaType.String;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -76,7 +76,7 @@ namespace Newtonsoft.Json.Schema
|
||||
public static string GetId(IEnumerable<JsonSchema> schemata)
|
||||
{
|
||||
return string.Join("-", schemata.Select(s => s.InternalId).OrderBy(id => id, StringComparer.Ordinal)
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_STRING_JOIN_WITH_ENUMERABLE
|
||||
.ToArray()
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -26,25 +26,25 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if HAVE_CONCURRENT_COLLECTIONS
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_CAS
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -107,21 +107,21 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
private static readonly JsonConverter[] BuiltInConverters =
|
||||
{
|
||||
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ENTITY_FRAMEWORK
|
||||
new EntityKeyMemberConverter(),
|
||||
#endif
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
new ExpandoObjectConverter(),
|
||||
#endif
|
||||
#if !(PORTABLE40)
|
||||
#if (HAVE_XML_DOCUMENT || HAVE_XLINQ)
|
||||
new XmlNodeConverter(),
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
new BinaryConverter(),
|
||||
new DataSetConverter(),
|
||||
new DataTableConverter(),
|
||||
#endif
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
new DiscriminatedUnionConverter(),
|
||||
#endif
|
||||
new KeyValuePairConverter(),
|
||||
@@ -166,7 +166,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
/// </value>
|
||||
public bool SerializeCompilerGeneratedMembers { get; set; }
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to ignore the <see cref="ISerializable"/> interface when serializing and deserializing types.
|
||||
/// </summary>
|
||||
@@ -195,7 +195,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
/// </summary>
|
||||
public DefaultContractResolver()
|
||||
{
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
IgnoreSerializableAttribute = true;
|
||||
#endif
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
protected virtual List<MemberInfo> GetSerializableMembers(Type objectType)
|
||||
{
|
||||
bool ignoreSerializableAttribute;
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
ignoreSerializableAttribute = IgnoreSerializableAttribute;
|
||||
#else
|
||||
ignoreSerializableAttribute = true;
|
||||
@@ -292,7 +292,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
if (memberSerialization != MemberSerialization.Fields)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType);
|
||||
#endif
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
serializableMembers.Add(member);
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
else if (dataContractAttribute != null && JsonTypeReflector.GetAttribute<DataMemberAttribute>(member) != null)
|
||||
{
|
||||
serializableMembers.Add(member);
|
||||
@@ -337,7 +337,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
Type match;
|
||||
// don't include EntityKey on entities objects... this is a bit hacky
|
||||
if (objectType.AssignableToTypeName("System.Data.Objects.DataClasses.EntityObject", out match))
|
||||
@@ -362,7 +362,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return serializableMembers;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
private bool ShouldSerializeEntityMember(MemberInfo memberInfo)
|
||||
{
|
||||
PropertyInfo propertyInfo = memberInfo as PropertyInfo;
|
||||
@@ -389,7 +389,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
InitializeContract(contract);
|
||||
|
||||
bool ignoreSerializableAttribute;
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
ignoreSerializableAttribute = IgnoreSerializableAttribute;
|
||||
#else
|
||||
ignoreSerializableAttribute = true;
|
||||
@@ -432,7 +432,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
else if (contract.MemberSerialization == MemberSerialization.Fields)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CAS
|
||||
// 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
|
||||
if (JsonTypeReflector.FullyTrusted)
|
||||
@@ -775,7 +775,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
contract.IsReference = containerAttribute._isReference;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
else
|
||||
{
|
||||
DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(contract.NonNullableUnderlyingType);
|
||||
@@ -908,14 +908,14 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
private static bool ShouldSkipDeserialized(Type t)
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if HAVE_CONCURRENT_COLLECTIONS
|
||||
// ConcurrentDictionary throws an error in its OnDeserialized so ignore - http://json.codeplex.com/discussions/257093
|
||||
if (t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(ConcurrentDictionary<,>))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
|
||||
{
|
||||
return true;
|
||||
@@ -927,7 +927,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
private static bool ShouldSkipSerializing(Type t)
|
||||
{
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
|
||||
{
|
||||
return true;
|
||||
@@ -1072,7 +1072,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return contract;
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
/// <summary>
|
||||
/// Creates a <see cref="JsonISerializableContract"/> for the given type.
|
||||
/// </summary>
|
||||
@@ -1095,7 +1095,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
/// <summary>
|
||||
/// Creates a <see cref="JsonDynamicContract"/> for the given type.
|
||||
/// </summary>
|
||||
@@ -1186,21 +1186,21 @@ namespace Newtonsoft.Json.Serialization
|
||||
return CreateStringContract(objectType);
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t))
|
||||
{
|
||||
return CreateISerializableContract(objectType);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t))
|
||||
{
|
||||
return CreateDynamicContract(objectType);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
// tested last because it is not possible to automatically deserialize custom IConvertible types
|
||||
if (IsIConvertible(t))
|
||||
{
|
||||
@@ -1218,7 +1218,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return (typeCode != PrimitiveTypeCode.Empty && typeCode != PrimitiveTypeCode.Object);
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
internal static bool IsIConvertible(Type t)
|
||||
{
|
||||
if (typeof(IConvertible).IsAssignableFrom(t)
|
||||
@@ -1233,7 +1233,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
internal static bool CanConvertToString(Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
TypeConverter converter = ConvertUtils.GetConverter(type);
|
||||
|
||||
// use the objectType's TypeConverter if it has one and can convert to a string
|
||||
@@ -1417,7 +1417,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
private void SetPropertySettingsFromAttributes(JsonProperty property, object attributeProvider, string name, Type declaringType, MemberSerialization memberSerialization, out bool allowNonPublicAccess)
|
||||
{
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(declaringType);
|
||||
|
||||
MemberInfo memberInfo = attributeProvider as MemberInfo;
|
||||
@@ -1443,7 +1443,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
mappedName = propertyAttribute.PropertyName;
|
||||
hasSpecifiedName = true;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
else if (dataMemberAttribute?.Name != null)
|
||||
{
|
||||
mappedName = dataMemberAttribute.Name;
|
||||
@@ -1512,7 +1512,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
property.ItemConverter = null;
|
||||
property.ItemReferenceLoopHandling = null;
|
||||
property.ItemTypeNameHandling = null;
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
if (dataMemberAttribute != null)
|
||||
{
|
||||
property._required = (dataMemberAttribute.IsRequired) ? Required.AllowNull : Required.Default;
|
||||
@@ -1535,7 +1535,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
|
||||
// automatically ignore extension data dictionary property if it is public
|
||||
|| JsonTypeReflector.GetAttribute<JsonExtensionDataAttribute>(attributeProvider) != null
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_NON_SERIALIZED_ATTRIBUTE
|
||||
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null
|
||||
#endif
|
||||
;
|
||||
@@ -1544,7 +1544,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
bool hasIgnoreDataMemberAttribute = false;
|
||||
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
|
||||
hasIgnoreDataMemberAttribute = (JsonTypeReflector.GetAttribute<IgnoreDataMemberAttribute>(attributeProvider) != null);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
assembly = Assembly.Load(assemblyName);
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE || DOTNET)
|
||||
#if HAVE_APP_DOMAIN
|
||||
if (assembly == null)
|
||||
{
|
||||
// will find assemblies loaded with Assembly.LoadFile outside of the main directory
|
||||
@@ -194,12 +194,12 @@ namespace Newtonsoft.Json.Serialization
|
||||
/// <param name="assemblyName">Specifies the <see cref="Assembly"/> name of the serialized object.</param>
|
||||
/// <param name="typeName">Specifies the <see cref="System.Type"/> name of the serialized object.</param>
|
||||
public
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_SERIALIZATION_BINDER_BIND_TO_NAME
|
||||
override
|
||||
#endif
|
||||
void BindToName(Type serializedType, out string assemblyName, out string typeName)
|
||||
{
|
||||
#if (DOTNET || PORTABLE)
|
||||
#if !HAVE_FULL_REFLECTION
|
||||
assemblyName = serializedType.GetTypeInfo().Assembly.FullName;
|
||||
typeName = serializedType.FullName;
|
||||
#else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(PORTABLE40 || PORTABLE || DOTNET)
|
||||
#if HAVE_TRACE_WRITER
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using DiagnosticsTrace = System.Diagnostics.Trace;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE || DOTNET)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
@@ -24,9 +24,10 @@
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -167,7 +167,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
CreatedType = typeof(List<>).MakeGenericType(CollectionItemType);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_ISET
|
||||
if (ReflectionUtils.IsGenericDefinition(underlyingType, typeof(ISet<>)))
|
||||
{
|
||||
CreatedType = typeof(HashSet<>).MakeGenericType(CollectionItemType);
|
||||
@@ -178,7 +178,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
canDeserialize = true;
|
||||
ShouldCreateWrapper = true;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IReadOnlyCollection<>), out tempCollectionType))
|
||||
{
|
||||
CollectionItemType = tempCollectionType.GetGenericArguments()[0];
|
||||
@@ -206,7 +206,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
_parameterizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(underlyingType, CollectionItemType);
|
||||
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
if (!HasParameterizedCreatorInternal && underlyingType.Name == FSharpUtils.FSharpListTypeName)
|
||||
{
|
||||
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
|
||||
@@ -253,7 +253,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || NET40)
|
||||
#if HAVE_IMMUTABLE_COLLECTIONS
|
||||
Type immutableCreatedType;
|
||||
ObjectConstructor<object> immutableParameterizedCreator;
|
||||
if (ImmutableCollectionsUtils.TryBuildImmutableForArrayContract(underlyingType, CollectionItemType, out immutableCreatedType, out immutableParameterizedCreator))
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Reflection;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
|
||||
@@ -142,11 +142,11 @@ namespace Newtonsoft.Json.Serialization
|
||||
CreatedType = typeof(Dictionary<,>).MakeGenericType(keyType, valueType);
|
||||
}
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
IsReadOnlyOrFixedSize = ReflectionUtils.InheritsGenericDefinition(underlyingType, typeof(ReadOnlyDictionary<,>));
|
||||
#endif
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IReadOnlyDictionary<,>), out _genericCollectionDefinitionType))
|
||||
{
|
||||
keyType = _genericCollectionDefinitionType.GetGenericArguments()[0];
|
||||
@@ -177,7 +177,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType),
|
||||
typeof(IDictionary<,>).MakeGenericType(keyType, valueType));
|
||||
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
if (!HasParameterizedCreatorInternal && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
|
||||
{
|
||||
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
|
||||
@@ -205,7 +205,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || NET40)
|
||||
#if HAVE_IMMUTABLE_COLLECTIONS
|
||||
Type immutableCreatedType;
|
||||
ObjectConstructor<object> immutableParameterizedCreator;
|
||||
if (ImmutableCollectionsUtils.TryBuildImmutableForDictionaryContract(underlyingType, DictionaryKeyType, DictionaryValueType, out immutableCreatedType, out immutableParameterizedCreator))
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ namespace Newtonsoft.Json.Serialization
|
||||
Properties = new JsonPropertyCollection(UnderlyingType);
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
#if HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE
|
||||
[SecuritySafeCritical]
|
||||
#endif
|
||||
internal object GetUninitializedObject()
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
[typeof(bool)] = ReadType.ReadAsBoolean,
|
||||
[typeof(string)] = ReadType.ReadAsString,
|
||||
[typeof(DateTime)] = ReadType.ReadAsDateTime,
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
[typeof(DateTimeOffset)] = ReadType.ReadAsDateTimeOffset,
|
||||
#endif
|
||||
[typeof(float)] = ReadType.ReadAsDouble,
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -27,20 +27,20 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.ComponentModel;
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -319,7 +319,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType);
|
||||
case JsonToken.Null:
|
||||
case JsonToken.Undefined:
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
if (objectType == typeof(DBNull))
|
||||
{
|
||||
return DBNull.Value;
|
||||
@@ -351,10 +351,10 @@ namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
case JsonContractType.Object:
|
||||
case JsonContractType.Dictionary:
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
case JsonContractType.Serializable:
|
||||
#endif
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
case JsonContractType.Dynamic:
|
||||
#endif
|
||||
return @"JSON object (e.g. {""name"":""value""})";
|
||||
@@ -563,12 +563,12 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
return targetDictionary;
|
||||
}
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
case JsonContractType.Dynamic:
|
||||
JsonDynamicContract dynamicContract = (JsonDynamicContract)contract;
|
||||
return CreateDynamic(reader, dynamicContract, member, id);
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
case JsonContractType.Serializable:
|
||||
JsonISerializableContract serializableContract = (JsonISerializableContract)contract;
|
||||
return CreateISerializable(reader, serializableContract, member, id);
|
||||
@@ -801,7 +801,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
|
||||
if (objectType != null
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
&& objectType != typeof(IDynamicMetaObjectProvider)
|
||||
#endif
|
||||
&& !objectType.IsAssignableFrom(specifiedType))
|
||||
@@ -924,7 +924,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
private bool HasNoDefinedType(JsonContract contract)
|
||||
{
|
||||
return (contract == null || contract.UnderlyingType == typeof(object) || contract.ContractType == JsonContractType.Linq
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
|| contract.UnderlyingType == typeof(IDynamicMetaObjectProvider)
|
||||
#endif
|
||||
);
|
||||
@@ -966,7 +966,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
return ConvertUtils.FromBigInteger((BigInteger)value, contract.NonNullableUnderlyingType);
|
||||
@@ -1356,7 +1356,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
case PrimitiveTypeCode.DateTimeOffsetNullable:
|
||||
{
|
||||
@@ -1676,7 +1676,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return underlyingList;
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, string id)
|
||||
{
|
||||
Type objectType = contract.UnderlyingType;
|
||||
@@ -1766,7 +1766,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
private object CreateDynamic(JsonReader reader, JsonDynamicContract contract, JsonProperty member, string id)
|
||||
{
|
||||
IDynamicMetaObjectProvider newObject;
|
||||
@@ -1900,7 +1900,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
if (TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Info)
|
||||
{
|
||||
string parameters = string.Join(", ", contract.CreatorParameters.Select(p => p.PropertyName)
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_STRING_JOIN_WITH_ENUMERABLE
|
||||
.ToArray()
|
||||
#endif
|
||||
);
|
||||
@@ -2250,7 +2250,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
case ReadType.ReadAsDateTime:
|
||||
reader.ReadAsDateTime();
|
||||
break;
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case ReadType.ReadAsDateTimeOffset:
|
||||
reader.ReadAsDateTimeOffset();
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Diagnostics;
|
||||
@@ -37,7 +37,7 @@ using System.Security;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Runtime.Serialization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -193,12 +193,12 @@ namespace Newtonsoft.Json.Serialization
|
||||
JsonDictionaryContract dictionaryContract = (JsonDictionaryContract)valueContract;
|
||||
SerializeDictionary(writer, (value is IDictionary) ? (IDictionary)value : dictionaryContract.CreateWrapper(value), dictionaryContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
case JsonContractType.Dynamic:
|
||||
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
case JsonContractType.Serializable:
|
||||
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty);
|
||||
break;
|
||||
@@ -379,7 +379,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
internal static bool TryConvertToString(object value, Type type, out string s)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
TypeConverter converter = ConvertUtils.GetConverter(type);
|
||||
|
||||
// use the objectType's TypeConverter if it has one and can convert to a string
|
||||
@@ -846,8 +846,8 @@ namespace Newtonsoft.Json.Serialization
|
||||
return writeMetadataObject;
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
#if HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE
|
||||
[SecuritySafeCritical]
|
||||
#endif
|
||||
private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
|
||||
@@ -892,7 +892,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
private void SerializeDynamic(JsonWriter writer, IDynamicMetaObjectProvider value, JsonDynamicContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
|
||||
{
|
||||
OnSerializing(writer, contract, value);
|
||||
@@ -1144,9 +1144,9 @@ namespace Newtonsoft.Json.Serialization
|
||||
DateTimeUtils.WriteDateTimeString(sw, dt, writer.DateFormatHandling, writer.DateFormatString, writer.Culture);
|
||||
return sw.ToString();
|
||||
}
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
case PrimitiveTypeCode.DateTimeOffsetNullable:
|
||||
case PrimitiveTypeCode.DateTimeOffsetNullable:
|
||||
{
|
||||
escape = false;
|
||||
StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -29,11 +29,11 @@ using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_CAS
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -69,7 +69,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return CachedAttributeGetter<T>.GetAttribute(attributeProvider);
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
public static DataContractAttribute GetDataContractAttribute(Type type)
|
||||
{
|
||||
// DataContractAttribute does not have inheritance
|
||||
@@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return objectAttribute.MemberSerialization;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
DataContractAttribute dataContractAttribute = GetDataContractAttribute(objectType);
|
||||
if (dataContractAttribute != null)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_BINARY_SERIALIZATION
|
||||
if (!ignoreSerializableAttribute)
|
||||
{
|
||||
SerializableAttribute serializableAttribute = GetCachedAttribute<SerializableAttribute>(objectType);
|
||||
@@ -245,7 +245,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
};
|
||||
}
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
public static TypeConverter GetTypeConverter(Type type)
|
||||
{
|
||||
return TypeDescriptor.GetConverter(type);
|
||||
@@ -397,14 +397,14 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
public static bool DynamicCodeGeneration
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE
|
||||
[SecuritySafeCritical]
|
||||
#endif
|
||||
get
|
||||
{
|
||||
if (_dynamicCodeGeneration == null)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_CAS
|
||||
try
|
||||
{
|
||||
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
public void BindToName(Type serializedType, out string assemblyName, out string typeName)
|
||||
{
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_SERIALIZATION_BINDER_BIND_TO_NAME
|
||||
SerializationBinder.BindToName(serializedType, out assemblyName, out typeName);
|
||||
#else
|
||||
assemblyName = null;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return value;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
public override DateTimeOffset? ReadAsDateTimeOffset()
|
||||
{
|
||||
DateTimeOffset? value = _innerReader.ReadAsDateTimeOffset();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -156,7 +156,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
public override void WriteValue(DateTimeOffset value)
|
||||
{
|
||||
_textWriter.WriteValue(value);
|
||||
@@ -177,7 +177,6 @@ namespace Newtonsoft.Json.Serialization
|
||||
base.WriteUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public override void WriteValue(double value)
|
||||
@@ -301,7 +300,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (value is BigInteger)
|
||||
{
|
||||
_textWriter.WriteValue(value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#if (DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if !HAVE_TRACE_WRITER
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
@@ -156,7 +156,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
_writer.Write(chars, index, count);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
public async Task EncodeAsync(byte[] buffer, int index, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -30,13 +30,13 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_METHOD_IMPL_ATTRIBUTE
|
||||
using System.Runtime.CompilerServices;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
#if (NET20 || NET35 || PORTABLE40)
|
||||
#if !HAVE_COVARIANT_GENERICS
|
||||
public static void AddRange<T>(this IList<T> initial, IEnumerable collection)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(initial, nameof(initial));
|
||||
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)))
|
||||
{
|
||||
return true;
|
||||
@@ -357,7 +357,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
// pretty much guaranteed to be inlined, giving us fast access of that cached
|
||||
// array. With 4.5 and up we use AggressiveInlining just to be sure, so it's
|
||||
// effectively the same as calling Array.Empty<T> even when not available.
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_METHOD_IMPL_ATTRIBUTE
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
#endif
|
||||
public static T[] ArrayEmpty<T>()
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -27,17 +27,17 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Reflection;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
#endif
|
||||
@@ -135,7 +135,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(double?), PrimitiveTypeCode.DoubleNullable },
|
||||
{ typeof(DateTime), PrimitiveTypeCode.DateTime },
|
||||
{ typeof(DateTime?), PrimitiveTypeCode.DateTimeNullable },
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
{ typeof(DateTimeOffset), PrimitiveTypeCode.DateTimeOffset },
|
||||
{ typeof(DateTimeOffset?), PrimitiveTypeCode.DateTimeOffsetNullable },
|
||||
#endif
|
||||
@@ -145,19 +145,19 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(Guid?), PrimitiveTypeCode.GuidNullable },
|
||||
{ typeof(TimeSpan), PrimitiveTypeCode.TimeSpan },
|
||||
{ typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable },
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
{ typeof(BigInteger), PrimitiveTypeCode.BigInteger },
|
||||
{ typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable },
|
||||
#endif
|
||||
{ typeof(Uri), PrimitiveTypeCode.Uri },
|
||||
{ typeof(string), PrimitiveTypeCode.String },
|
||||
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
|
||||
#if !(PORTABLE || PORTABLE40 || DOTNET)
|
||||
#if HAVE_ADO_NET
|
||||
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
private static readonly TypeInformation[] PrimitiveTypeCodes =
|
||||
{
|
||||
// need all of these. lookup against the index with TypeCode value
|
||||
@@ -220,7 +220,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return PrimitiveTypeCode.Object;
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
public static TypeInformation GetTypeInformation(IConvertible convertable)
|
||||
{
|
||||
TypeInformation typeInformation = PrimitiveTypeCodes[(int)convertable.GetTypeCode()];
|
||||
@@ -230,7 +230,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsConvertible(Type t)
|
||||
{
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
return typeof(IConvertible).IsAssignableFrom(t);
|
||||
#else
|
||||
return (
|
||||
@@ -241,7 +241,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static TimeSpan ParseTimeSpan(string input)
|
||||
{
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_TIME_SPAN_PARSE_WITH_CULTURE
|
||||
return TimeSpan.Parse(input, CultureInfo.InvariantCulture);
|
||||
#else
|
||||
return TimeSpan.Parse(input);
|
||||
@@ -311,7 +311,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return o => call(null, o);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
internal static BigInteger ToBigInteger(object value)
|
||||
{
|
||||
if (value is BigInteger)
|
||||
@@ -484,7 +484,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.Success;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (initialValue is DateTime && targetType == typeof(DateTimeOffset))
|
||||
{
|
||||
value = new DateTimeOffset((DateTime)initialValue);
|
||||
@@ -546,7 +546,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (targetType == typeof(BigInteger))
|
||||
{
|
||||
value = ToBigInteger(initialValue);
|
||||
@@ -559,7 +559,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
// see if source or target types have a TypeConverter that converts between the two
|
||||
TypeConverter toConverter = GetConverter(initialType);
|
||||
|
||||
@@ -577,7 +577,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.Success;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
// handle DBNull and INullable
|
||||
if (initialValue == DBNull.Value)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.CannotConvertNull;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
INullable nullable = initialValue as INullable;
|
||||
if (nullable != null)
|
||||
{
|
||||
@@ -675,7 +675,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, initialType?.ToString() ?? "{null}", targetType));
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
public static object ToValue(INullable nullableValue)
|
||||
{
|
||||
if (nullableValue == null)
|
||||
@@ -707,7 +707,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
internal static TypeConverter GetConverter(Type t)
|
||||
{
|
||||
return JsonTypeReflector.GetTypeConverter(t);
|
||||
@@ -716,7 +716,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool VersionTryParse(string input, out Version result)
|
||||
{
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_VERSION_TRY_PARSE
|
||||
return Version.TryParse(input, out result);
|
||||
#else
|
||||
// improve failure performance with regex?
|
||||
@@ -1015,7 +1015,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
/// <param name="val">Mantissa</param>
|
||||
/// <param name="scale">Exponent</param>
|
||||
/// <remarks>
|
||||
/// Adoption of native function NumberToDouble() from coreclr sources,
|
||||
/// Adoption of native function NumberToDouble() from coreclr sources,
|
||||
/// see https://github.com/dotnet/coreclr/blob/master/src/classlibnative/bcltype/number.cpp#L451
|
||||
/// </remarks>
|
||||
public static double PackDouble(bool negative, ulong val, int scale)
|
||||
@@ -1265,7 +1265,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
if (i == numDecimalStart)
|
||||
{
|
||||
// E follows decimal point
|
||||
// E follows decimal point
|
||||
return ParseResult.Invalid;
|
||||
}
|
||||
i++;
|
||||
@@ -1292,7 +1292,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
break;
|
||||
}
|
||||
|
||||
// parse 3 digit
|
||||
// parse 3 digit
|
||||
for (; i < end; i++)
|
||||
{
|
||||
c = chars[i];
|
||||
@@ -1367,7 +1367,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
public static bool TryConvertGuid(string s, out Guid g)
|
||||
{
|
||||
// GUID has to have format 00000000-0000-0000-0000-000000000000
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_GUID_TRY_PARSE
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static TimeSpan GetUtcOffset(this DateTime d)
|
||||
{
|
||||
#if NET20
|
||||
#if !HAVE_TIME_ZONE_INFO
|
||||
return TimeZone.CurrentTimeZone.GetUtcOffset(d);
|
||||
#else
|
||||
return TimeZoneInfo.Local.GetUtcOffset(d);
|
||||
@@ -276,7 +276,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static bool TryParseDateTimeOffsetIso(StringReference text, out DateTimeOffset dt)
|
||||
{
|
||||
DateTimeParser dateTimeParser = new DateTimeParser();
|
||||
@@ -413,7 +413,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static bool TryParseDateTimeOffset(StringReference s, string dateFormatString, CultureInfo culture, out DateTimeOffset dt)
|
||||
{
|
||||
if (s.Length > 0)
|
||||
@@ -564,7 +564,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
private static bool TryParseDateTimeOffsetMicrosoft(StringReference text, out DateTimeOffset dt)
|
||||
{
|
||||
long ticks;
|
||||
@@ -764,7 +764,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return start;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static void WriteDateTimeOffsetString(TextWriter writer, DateTimeOffset value, DateFormatHandling format, string formatString, CultureInfo culture)
|
||||
{
|
||||
if (string.IsNullOrEmpty(formatString))
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -46,7 +46,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
private readonly IDictionary _dictionary;
|
||||
private readonly IDictionary<TKey, TValue> _genericDictionary;
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
private readonly IReadOnlyDictionary<TKey, TValue> _readOnlyDictionary;
|
||||
#endif
|
||||
private object _syncRoot;
|
||||
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
_genericDictionary = dictionary;
|
||||
}
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
public DictionaryWrapper(IReadOnlyDictionary<TKey, TValue> dictionary)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(dictionary, nameof(dictionary));
|
||||
@@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Contains(key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.ContainsKey(key);
|
||||
@@ -116,7 +116,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Keys.Cast<TKey>().ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Keys.ToList();
|
||||
@@ -143,7 +143,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -190,7 +190,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Values.Cast<TValue>().ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Values.ToList();
|
||||
@@ -211,7 +211,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return (TValue)_dictionary[key];
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary[key];
|
||||
@@ -228,7 +228,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary[key] = value;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -247,7 +247,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
((IList)_dictionary).Add(item);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -265,7 +265,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Clear();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -283,7 +283,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return ((IList)_dictionary).Contains(item);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Contains(item);
|
||||
@@ -314,7 +314,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
(e as IDisposable)?.Dispose();
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -334,7 +334,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Count;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Count;
|
||||
@@ -355,7 +355,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.IsReadOnly;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return true;
|
||||
@@ -391,7 +391,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -409,7 +409,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Cast<DictionaryEntry>().Select(de => new KeyValuePair<TKey, TValue>((TKey)de.Key, (TValue)de.Value)).GetEnumerator();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.GetEnumerator();
|
||||
@@ -432,7 +432,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Add(key, value);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -452,7 +452,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary[key];
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary[(TKey)key];
|
||||
@@ -469,7 +469,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary[key] = value;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -529,7 +529,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.GetEnumerator();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return new DictionaryEnumerator<TKey, TValue>(_readOnlyDictionary.GetEnumerator());
|
||||
@@ -547,7 +547,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.ContainsKey((TKey)key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.ContainsKey((TKey)key);
|
||||
@@ -567,7 +567,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return true;
|
||||
@@ -588,7 +588,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.Keys.ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Keys.ToList();
|
||||
@@ -607,7 +607,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Remove(key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -627,7 +627,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.Values.ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Values.ToList();
|
||||
@@ -646,7 +646,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.CopyTo(array, index);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -694,7 +694,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_REFLECTION_EMIT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
using System.Reflection;
|
||||
#else
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
internal static class BinderWrapper
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
public const string CSharpAssemblyName = "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
|
||||
|
||||
private const string BinderTypeName = "Microsoft.CSharp.RuntimeBinder.Binder, " + CSharpAssemblyName;
|
||||
@@ -114,7 +114,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static CallSiteBinder GetMember(string name, Type context)
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
Init();
|
||||
return (CallSiteBinder)_getMemberCall(null, 0, name, context, _getCSharpArgumentInfoArray);
|
||||
#else
|
||||
@@ -125,7 +125,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static CallSiteBinder SetMember(string name, Type context)
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
Init();
|
||||
return (CallSiteBinder)_setMemberCall(null, 0, name, context, _setCSharpArgumentInfoArray);
|
||||
#else
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -51,7 +51,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
string n1 = f.Name;
|
||||
string n2;
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
n2 = f.GetCustomAttributes(typeof(EnumMemberAttribute), true)
|
||||
.Cast<EnumMemberAttribute>()
|
||||
.Select(a => a.Value)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user