From b8e60c773bfbd765b9131694a01569e067b37d99 Mon Sep 17 00:00:00 2001 From: Florian Greinacher Date: Wed, 11 Jan 2017 23:07:02 +0100 Subject: [PATCH] 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 --- .gitignore | 3 +- Build/build.ps1 | 44 +++---- .../Newtonsoft.Json.Tests.Portable40.csproj | 9 -- Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs | 4 +- Src/Newtonsoft.Json/Bson/BsonReader.cs | 2 +- Src/Newtonsoft.Json/Bson/BsonWriter.cs | 10 +- .../Converters/BinaryConverter.cs | 12 +- .../Converters/DataSetConverter.cs | 2 +- .../Converters/DataTableConverter.cs | 2 +- .../Converters/DateTimeConverterBase.cs | 2 +- .../Converters/DiscriminatedUnionConverter.cs | 6 +- .../Converters/EntityKeyMemberConverter.cs | 2 +- .../Converters/ExpandoObjectConverter.cs | 2 +- .../Converters/IsoDateTimeConverter.cs | 8 +- .../Converters/JavaScriptDateTimeConverter.cs | 5 +- .../Converters/StringEnumConverter.cs | 2 +- .../Converters/XmlNodeConverter.cs | 31 ++--- Src/Newtonsoft.Json/DateParseHandling.cs | 2 +- Src/Newtonsoft.Json/FormatterAssemblyStyle.cs | 2 +- Src/Newtonsoft.Json/JsonConvert.cs | 28 ++--- Src/Newtonsoft.Json/JsonException.cs | 4 +- Src/Newtonsoft.Json/JsonReader.Async.cs | 2 +- Src/Newtonsoft.Json/JsonReader.cs | 14 +-- Src/Newtonsoft.Json/JsonReaderException.cs | 4 +- .../JsonSerializationException.cs | 4 +- Src/Newtonsoft.Json/JsonTextReader.Async.cs | 10 +- Src/Newtonsoft.Json/JsonTextReader.cs | 22 ++-- Src/Newtonsoft.Json/JsonTextWriter.Async.cs | 14 +-- Src/Newtonsoft.Json/JsonTextWriter.cs | 16 +-- Src/Newtonsoft.Json/JsonValidatingReader.cs | 12 +- Src/Newtonsoft.Json/JsonWriter.Async.cs | 14 +-- Src/Newtonsoft.Json/JsonWriter.cs | 22 ++-- Src/Newtonsoft.Json/JsonWriterException.cs | 4 +- Src/Newtonsoft.Json/Linq/Extensions.cs | 2 +- Src/Newtonsoft.Json/Linq/IJEnumerable.cs | 2 +- Src/Newtonsoft.Json/Linq/JArray.Async.cs | 2 +- .../Linq/JConstructor.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JContainer.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JContainer.cs | 44 +++---- Src/Newtonsoft.Json/Linq/JEnumerable.cs | 2 +- Src/Newtonsoft.Json/Linq/JObject.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JObject.cs | 27 ++--- Src/Newtonsoft.Json/Linq/JProperty.Async.cs | 2 +- .../Linq/JPropertyDescriptor.cs | 2 +- Src/Newtonsoft.Json/Linq/JRaw.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JToken.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JToken.cs | 90 +++++++------- .../Linq/JTokenWriter.Async.cs | 2 +- Src/Newtonsoft.Json/Linq/JTokenWriter.cs | 10 +- Src/Newtonsoft.Json/Linq/JValue.Async.cs | 6 +- Src/Newtonsoft.Json/Linq/JValue.cs | 41 ++++--- .../Linq/JsonPath/FieldMultipleFilter.cs | 4 +- .../Linq/JsonPath/QueryExpression.cs | 4 +- .../Newtonsoft.Json.Net20.csproj | 6 +- .../Newtonsoft.Json.Net35.csproj | 5 +- .../Newtonsoft.Json.Net40.csproj | 5 +- .../Newtonsoft.Json.Portable.csproj | 6 +- .../Newtonsoft.Json.Portable40.csproj | 5 +- Src/Newtonsoft.Json/Newtonsoft.Json.csproj | 8 +- .../Properties/AssemblyInfo.cs | 4 +- .../Schema/JsonSchemaBuilder.cs | 2 +- .../Schema/JsonSchemaException.cs | 4 +- .../Schema/JsonSchemaGenerator.cs | 16 +-- .../Schema/JsonSchemaModelBuilder.cs | 2 +- Src/Newtonsoft.Json/Schema/JsonSchemaNode.cs | 4 +- .../Schema/JsonSchemaResolver.cs | 2 +- .../Schema/JsonSchemaWriter.cs | 2 +- .../Serialization/DefaultContractResolver.cs | 68 +++++------ .../DefaultSerializationBinder.cs | 6 +- .../Serialization/DiagnosticsTraceWriter.cs | 2 +- .../Serialization/DynamicValueProvider.cs | 4 +- .../Serialization/ExpressionValueProvider.cs | 3 +- .../Serialization/JsonArrayContract.cs | 10 +- .../Serialization/JsonContainerContract.cs | 2 +- .../Serialization/JsonDictionaryContract.cs | 10 +- .../Serialization/JsonDynamicContract.cs | 2 +- .../Serialization/JsonFormatterConverter.cs | 2 +- .../JsonISerializableContract.cs | 2 +- .../Serialization/JsonObjectContract.cs | 4 +- .../Serialization/JsonPrimitiveContract.cs | 2 +- .../Serialization/JsonProperty.cs | 2 +- .../JsonSerializerInternalReader.cs | 34 +++--- .../JsonSerializerInternalWriter.cs | 20 ++-- .../Serialization/JsonTypeReflector.cs | 16 +-- .../SerializationBinderAdapter.cs | 2 +- .../Serialization/TraceJsonReader.cs | 2 +- .../Serialization/TraceJsonWriter.cs | 9 +- Src/Newtonsoft.Json/TraceLevel.cs | 2 +- Src/Newtonsoft.Json/Utilities/AsyncUtils.cs | 2 +- .../Utilities/Base64Encoder.cs | 4 +- .../Utilities/CollectionUtils.cs | 10 +- .../Utilities/CollectionWrapper.cs | 2 +- Src/Newtonsoft.Json/Utilities/ConvertUtils.cs | 48 ++++---- .../Utilities/DateTimeUtils.cs | 10 +- .../Utilities/DictionaryWrapper.cs | 58 ++++----- Src/Newtonsoft.Json/Utilities/DynamicProxy.cs | 2 +- .../Utilities/DynamicProxyMetaObject.cs | 2 +- .../DynamicReflectionDelegateFactory.cs | 4 +- Src/Newtonsoft.Json/Utilities/DynamicUtils.cs | 10 +- Src/Newtonsoft.Json/Utilities/EnumUtils.cs | 4 +- .../ExpressionReflectionDelegateFactory.cs | 1 + Src/Newtonsoft.Json/Utilities/FSharpUtils.cs | 4 +- .../Utilities/ILGeneratorExtensions.cs | 2 +- .../Utilities/ImmutableCollectionsUtils.cs | 3 +- .../Utilities/JavaScriptUtils.cs | 8 +- .../LateBoundReflectionDelegateFactory.cs | 2 +- Src/Newtonsoft.Json/Utilities/LinqBridge.cs | 2 +- .../Utilities/ReflectionDelegateFactory.cs | 2 +- .../Utilities/ReflectionObject.cs | 2 +- .../Utilities/ReflectionUtils.cs | 10 +- Src/Newtonsoft.Json/Utilities/StringUtils.cs | 10 +- .../Utilities/ThreadSafeStore.cs | 4 +- .../Utilities/TypeExtensions.cs | 30 ++--- Src/Newtonsoft.Json/project.json | 111 +++++++++++++++++- 114 files changed, 642 insertions(+), 550 deletions(-) diff --git a/.gitignore b/.gitignore index cfe68293..e32f1773 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ _ReSharper.* *.lock.json *.nuget.props *.nuget.targets -*.orig \ No newline at end of file +*.orig +.DS_Store \ No newline at end of file diff --git a/Build/build.ps1 b/Build/build.ps1 index b672d76b..adb1e305 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -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) { diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj index 13e3d10b..33a5906a 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj @@ -72,37 +72,28 @@ - 3.5 - 3.5 - 3.5 - 3.5 - 3.0 - 3.0 - 3.5 - 3.5 - 3.5 diff --git a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs index 87729d5c..d4009169 100644 --- a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Bson/BsonReader.cs b/Src/Newtonsoft.Json/Bson/BsonReader.cs index 5b262e96..69de6f61 100644 --- a/Src/Newtonsoft.Json/Bson/BsonReader.cs +++ b/Src/Newtonsoft.Json/Bson/BsonReader.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Bson/BsonWriter.cs b/Src/Newtonsoft.Json/Bson/BsonWriter.cs index 9e017605..e4e277eb 100644 --- a/Src/Newtonsoft.Json/Bson/BsonWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonWriter.cs @@ -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 /// The value to write. 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 /// /// Writes a value. /// diff --git a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs index 34b878b8..1ceb8b36 100644 --- a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs +++ b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs @@ -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 /// 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 /// public override bool CanConvert(Type objectType) { -#if !NET20 +#if HAVE_LINQ if (objectType.AssignableToTypeName(BinaryTypeName)) { return true; diff --git a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs index 5c86e827..f75d7e55 100644 --- a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs index 83769204..7046c292 100644 --- a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs b/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs index 5e0ed293..076d639b 100644 --- a/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs +++ b/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs b/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs index 679a8324..d850db9c 100644 --- a/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs @@ -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(); diff --git a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs index 516c8385..85845f51 100644 --- a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs +++ b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs b/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs index a20a9640..57959328 100644 --- a/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs +++ b/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET35 || NET20 || PORTABLE40) +#if HAVE_DYNAMIC using System; using System.Collections.Generic; diff --git a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs index 3de10c75..3a960728 100644 --- a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs @@ -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)) diff --git a/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs index c7508394..db7e837d 100644 --- a/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs @@ -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; } } diff --git a/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs b/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs index b9db34b1..cbfc8809 100644 --- a/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs +++ b/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs index d6025934..723bafc3 100644 --- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -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 /// 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; diff --git a/Src/Newtonsoft.Json/DateParseHandling.cs b/Src/Newtonsoft.Json/DateParseHandling.cs index 528b7c59..481098c8 100644 --- a/Src/Newtonsoft.Json/DateParseHandling.cs +++ b/Src/Newtonsoft.Json/DateParseHandling.cs @@ -39,7 +39,7 @@ namespace Newtonsoft.Json /// Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . /// DateTime = 1, -#if !NET20 +#if HAVE_DATE_TIME_OFFSET /// /// Date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed to . /// diff --git a/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs b/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs index e9eec6fd..a405908d 100644 --- a/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs +++ b/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs @@ -1,5 +1,5 @@  -#if DOTNET || PORTABLE40 || PORTABLE +#if !HAVE_BINARY_SERIALIZATION namespace System.Runtime.Serialization.Formatters { diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index b30ae1f1..22089c97 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -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 /// /// Converts the to its JSON string representation. /// @@ -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 /// /// 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 /// /// 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 /// /// Asynchronously populates the object with values from the JSON string using . /// @@ -991,7 +991,7 @@ namespace Newtonsoft.Json #endregion #region Xml -#if !(PORTABLE40 || PORTABLE || DOTNET) +#if HAVE_BINARY_SERIALIZATION /// /// Serializes the to a JSON string. /// @@ -1071,7 +1071,7 @@ namespace Newtonsoft.Json } #endif -#if !NET20 && !PORTABLE40 +#if HAVE_XLINQ /// /// Serializes the to a JSON string. /// diff --git a/Src/Newtonsoft.Json/JsonException.cs b/Src/Newtonsoft.Json/JsonException.cs index ab7835aa..e0ce5f40 100644 --- a/Src/Newtonsoft.Json/JsonException.cs +++ b/Src/Newtonsoft.Json/JsonException.cs @@ -35,7 +35,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#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 /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonReader.Async.cs b/Src/Newtonsoft.Json/JsonReader.Async.cs index 060c6982..d3bee93c 100644 --- a/Src/Newtonsoft.Json/JsonReader.Async.cs +++ b/Src/Newtonsoft.Json/JsonReader.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System; using System.Collections.Generic; diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index cd17d3a0..b2fab7a6 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -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 /// /// Reads the next JSON token from the source as a of . /// diff --git a/Src/Newtonsoft.Json/JsonReaderException.cs b/Src/Newtonsoft.Json/JsonReaderException.cs index 766bcc4a..940e14e8 100644 --- a/Src/Newtonsoft.Json/JsonReaderException.cs +++ b/Src/Newtonsoft.Json/JsonReaderException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs while reading JSON text. /// -#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 /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonSerializationException.cs b/Src/Newtonsoft.Json/JsonSerializationException.cs index e193b0fc..9ca772d9 100644 --- a/Src/Newtonsoft.Json/JsonSerializationException.cs +++ b/Src/Newtonsoft.Json/JsonSerializationException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#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 /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/JsonTextReader.Async.cs b/Src/Newtonsoft.Json/JsonTextReader.Async.cs index f7b963d7..c0152997 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.Async.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.Async.cs @@ -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; diff --git a/Src/Newtonsoft.Json/JsonTextReader.cs b/Src/Newtonsoft.Json/JsonTextReader.cs index 56e0ee72..8bbb6a9b 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.cs @@ -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 /// /// Reads the next JSON token from the underlying as a of . /// @@ -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(); diff --git a/Src/Newtonsoft.Json/JsonTextWriter.Async.cs b/Src/Newtonsoft.Json/JsonTextWriter.Async.cs index 49bac08b..b2f746f6 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.Async.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.Async.cs @@ -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); diff --git a/Src/Newtonsoft.Json/JsonTextWriter.cs b/Src/Newtonsoft.Json/JsonTextWriter.cs index 22c52995..560d5d23 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.cs @@ -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 /// The value to write. 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 /// /// Writes a value. /// @@ -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); diff --git a/Src/Newtonsoft.Json/JsonValidatingReader.cs b/Src/Newtonsoft.Json/JsonValidatingReader.cs index fef13e85..cca64386 100644 --- a/Src/Newtonsoft.Json/JsonValidatingReader.cs +++ b/Src/Newtonsoft.Json/JsonValidatingReader.cs @@ -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 /// /// Reads the next JSON token from the underlying as a of . /// @@ -714,7 +714,7 @@ namespace Newtonsoft.Json { IEnumerable 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 diff --git a/Src/Newtonsoft.Json/JsonWriter.Async.cs b/Src/Newtonsoft.Json/JsonWriter.Async.cs index add1ac6b..8cc0b25c 100644 --- a/Src/Newtonsoft.Json/JsonWriter.Async.cs +++ b/Src/Newtonsoft.Json/JsonWriter.Async.cs @@ -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) { diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 22709ebc..fa3a13ef 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -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 /// /// Writes a value. /// @@ -1306,7 +1306,7 @@ namespace Newtonsoft.Json } } -#if !NET20 +#if HAVE_DATE_TIME_OFFSET /// /// Writes a of value. /// @@ -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) { diff --git a/Src/Newtonsoft.Json/JsonWriterException.cs b/Src/Newtonsoft.Json/JsonWriterException.cs index 616a3288..aed9866a 100644 --- a/Src/Newtonsoft.Json/JsonWriterException.cs +++ b/Src/Newtonsoft.Json/JsonWriterException.cs @@ -33,7 +33,7 @@ namespace Newtonsoft.Json /// /// The exception thrown when an error occurs while writing JSON text. /// -#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 /// /// Initializes a new instance of the class. /// diff --git a/Src/Newtonsoft.Json/Linq/Extensions.cs b/Src/Newtonsoft.Json/Linq/Extensions.cs index 66381dcd..68295fdc 100644 --- a/Src/Newtonsoft.Json/Linq/Extensions.cs +++ b/Src/Newtonsoft.Json/Linq/Extensions.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Linq/IJEnumerable.cs b/Src/Newtonsoft.Json/Linq/IJEnumerable.cs index 3f2981c5..133a7f6f 100644 --- a/Src/Newtonsoft.Json/Linq/IJEnumerable.cs +++ b/Src/Newtonsoft.Json/Linq/IJEnumerable.cs @@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Linq /// /// The type of token. public interface IJEnumerable< -#if !(NET20 || NET35) +#if HAVE_VARIANT_TYPE_PARAMETERS out #endif T> : IEnumerable where T : JToken diff --git a/Src/Newtonsoft.Json/Linq/JArray.Async.cs b/Src/Newtonsoft.Json/Linq/JArray.Async.cs index fa299af9..e747c1a6 100644 --- a/Src/Newtonsoft.Json/Linq/JArray.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JArray.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System.Globalization; using System.Threading; diff --git a/Src/Newtonsoft.Json/Linq/JConstructor.Async.cs b/Src/Newtonsoft.Json/Linq/JConstructor.Async.cs index b7456255..ea4e5e86 100644 --- a/Src/Newtonsoft.Json/Linq/JConstructor.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JConstructor.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System.Globalization; using System.Threading; diff --git a/Src/Newtonsoft.Json/Linq/JContainer.Async.cs b/Src/Newtonsoft.Json/Linq/JContainer.Async.cs index 131e566a..004a9ec0 100644 --- a/Src/Newtonsoft.Json/Linq/JContainer.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JContainer.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System; using System.Globalization; diff --git a/Src/Newtonsoft.Json/Linq/JContainer.cs b/Src/Newtonsoft.Json/Linq/JContainer.cs index 144dbaf5..6eaa279e 100644 --- a/Src/Newtonsoft.Json/Linq/JContainer.cs +++ b/Src/Newtonsoft.Json/Linq/JContainer.cs @@ -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 /// /// Represents a token that can contain other tokens. /// - public abstract partial class JContainer : JToken, IList -#if !(DOTNET || PORTABLE || PORTABLE40) +    public abstract partial class JContainer : JToken, IList +#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; /// @@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Linq protected abstract IList 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(); } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if HAVE_COMPONENT_MODEL /// /// Raises the event. /// @@ -164,7 +164,7 @@ namespace Newtonsoft.Json.Linq } } #endif -#if !(NET20 || NET35 || PORTABLE40) +#if HAVE_INOTIFY_COLLECTION_CHANGED /// /// Raises the event. /// @@ -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 items = new HashSet(target, EqualityComparer); foreach (JToken item in content) diff --git a/Src/Newtonsoft.Json/Linq/JEnumerable.cs b/Src/Newtonsoft.Json/Linq/JEnumerable.cs index 193ebad0..095010fa 100644 --- a/Src/Newtonsoft.Json/Linq/JEnumerable.cs +++ b/Src/Newtonsoft.Json/Linq/JEnumerable.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if NET20 +#if !HAVE_LINQ using Newtonsoft.Json.Utilities.LinqBridge; #else using System.Linq; diff --git a/Src/Newtonsoft.Json/Linq/JObject.Async.cs b/Src/Newtonsoft.Json/Linq/JObject.Async.cs index 8546a8ed..170b3c54 100644 --- a/Src/Newtonsoft.Json/Linq/JObject.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JObject.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System.Globalization; using System.Threading; diff --git a/Src/Newtonsoft.Json/Linq/JObject.cs b/Src/Newtonsoft.Json/Linq/JObject.cs index 9c0c8e58..7cb6505c 100644 --- a/Src/Newtonsoft.Json/Linq/JObject.cs +++ b/Src/Newtonsoft.Json/Linq/JObject.cs @@ -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 /// /// public partial class JObject : JContainer, IDictionary, 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 /// public event PropertyChangedEventHandler PropertyChanged; -#if !(NET20 || PORTABLE || PORTABLE40) +#if HAVE_INOTIFY_PROPERTY_CHANGING /// /// Occurs when a property value is changing. /// @@ -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 /// /// Raises the event with the provided arguments. /// @@ -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 /// /// Returns the responsible for binding operations performed on this object. /// diff --git a/Src/Newtonsoft.Json/Linq/JProperty.Async.cs b/Src/Newtonsoft.Json/Linq/JProperty.Async.cs index 35c76517..77ce7341 100644 --- a/Src/Newtonsoft.Json/Linq/JProperty.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JProperty.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System.Globalization; using System.Threading; diff --git a/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs b/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs index c5234774..eda6d39c 100644 --- a/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs +++ b/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(DOTNET || PORTABLE || PORTABLE40) +#if HAVE_COMPONENT_MODEL using System; using System.ComponentModel; diff --git a/Src/Newtonsoft.Json/Linq/JRaw.Async.cs b/Src/Newtonsoft.Json/Linq/JRaw.Async.cs index 4458bd7e..8f24d305 100644 --- a/Src/Newtonsoft.Json/Linq/JRaw.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JRaw.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System.Globalization; using System.IO; diff --git a/Src/Newtonsoft.Json/Linq/JToken.Async.cs b/Src/Newtonsoft.Json/Linq/JToken.Async.cs index 63e04101..5833879d 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.Async.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(NET20 || NET35 || NET40 || PORTABLE40) +#if HAVE_ASYNC using System; using System.Globalization; diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index b711e3a7..2e6d13fb 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -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. /// public abstract partial class JToken : IJEnumerable, 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 /// /// Performs an explicit conversion from to . /// @@ -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 /// /// Performs an explicit conversion from to of . /// @@ -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 /// /// Performs an implicit conversion from to . /// @@ -1592,7 +1592,7 @@ namespace Newtonsoft.Json.Linq return new JValue(value); } -#if !NET20 +#if HAVE_DATE_TIME_OFFSET /// /// Performs an implicit conversion from of to . /// @@ -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 /// /// Returns the responsible for binding operations performed on this object. /// @@ -2381,7 +2381,7 @@ namespace Newtonsoft.Json.Linq } #endif -#if !(DOTNET || PORTABLE || PORTABLE40) +#if HAVE_ICLONEABLE object ICloneable.Clone() { return DeepClone(); diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.Async.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.Async.cs index e49dd6fb..1dbed28a 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.Async.cs @@ -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; diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs index 72abd975..4d86d563 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -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 /// The value to write. 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 /// /// Writes a value. /// diff --git a/Src/Newtonsoft.Json/Linq/JValue.Async.cs b/Src/Newtonsoft.Json/Linq/JValue.Async.cs index fb6327eb..a0da0f79 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.Async.cs @@ -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); diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 65defa49..2fbc747f 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -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). /// public partial class JValue : JToken, IEquatable, IFormattable, IComparable, IComparable -#if !PORTABLE +#if HAVE_ICONVERTIBLE , IConvertible #endif { @@ -129,7 +128,7 @@ namespace Newtonsoft.Json.Linq { } -#if !NET20 +#if HAVE_DATE_TIME_OFFSET /// /// Initializes a new instance of the class with the given value. /// @@ -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 /// /// Returns the responsible for binding operations performed on this object. /// @@ -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) diff --git a/Src/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs b/Src/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs index d24818ff..b291f813 100644 --- a/Src/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs +++ b/Src/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs @@ -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)); diff --git a/Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs b/Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs index a7536070..245bffe7 100644 --- a/Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs +++ b/Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs @@ -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); diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj index 5c49be45..7374260c 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj @@ -42,6 +42,8 @@ 1.0.0.%2a false true + 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 true @@ -49,7 +51,7 @@ false bin\Debug\Net20\ obj\Debug\Net20\ - TRACE;DEBUG;NET20 + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Debug\Net20\Newtonsoft.Json.xml @@ -63,7 +65,7 @@ true bin\Release\Net20\ obj\Release\Net20\ - TRACE;NET20 + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Release\Net20\Newtonsoft.Json.xml diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj index cec06ba6..e3e6e7ee 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj @@ -44,6 +44,7 @@ true + 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 true @@ -51,7 +52,7 @@ false bin\Debug\Net35\ obj\Debug\Net35\ - TRACE;DEBUG;CODE_ANALYSIS;NET35 + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Debug\Net35\Newtonsoft.Json.xml @@ -66,7 +67,7 @@ true bin\Release\Net35\ obj\Release\Net35\ - TRACE;NET35 + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Release\Net35\Newtonsoft.Json.xml diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj index 46474b2e..fb80dd58 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj @@ -44,6 +44,7 @@ true + 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 true @@ -51,7 +52,7 @@ false bin\Debug\Net40\ obj\Debug\Net40\ - TRACE;DEBUG;NET40;CODE_ANALYSIS + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Debug\Net40\Newtonsoft.Json.xml @@ -66,7 +67,7 @@ true bin\Release\Net40\ obj\Release\Net40\ - TRACE;NET40;CODE_ANALYSIS + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Release\Net40\Newtonsoft.Json.xml diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj index 4a2d78a6..96bdf484 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj @@ -13,6 +13,7 @@ 512 {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 11.0 + 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 true @@ -20,7 +21,7 @@ false bin\Debug\Portable\ obj\Debug\Portable\ - TRACE;DEBUG;PORTABLE + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 true @@ -31,8 +32,7 @@ true bin\Release\Portable\ obj\Release\Portable\ - TRACE;PORTABLE - prompt + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants)prompt 4 bin\Release\Portable\Newtonsoft.Json.xml true diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj index b48bfeab..bcc087e1 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj @@ -18,6 +18,7 @@ 4.0 + 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 true @@ -25,7 +26,7 @@ false bin\Debug\Portable40\ obj\Debug\Portable40\ - TRACE;DEBUG;CODE_ANALYSIS;PORTABLE40 + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 true @@ -36,7 +37,7 @@ true bin\Release\Portable40\ obj\Release\Portable40\ - TRACE;CODE_ANALYSIS;PORTABLE40 + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Release\Portable40\Newtonsoft.Json.xml diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj index 0b3ea340..ee828752 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -11,6 +11,8 @@ Newtonsoft.Json v4.5 512 + 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 true @@ -18,7 +20,7 @@ false bin\Debug\Net45\ obj\Debug\Net45\ - TRACE;DEBUG;CODE_ANALYSIS + TRACE;DEBUG;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Debug\Net45\Newtonsoft.Json.xml @@ -31,7 +33,7 @@ true bin\Release\Net45\ obj\Release\Net45\ - TRACE;CODE_ANALYSIS + TRACE;CODE_ANALYSIS;$(DefineConstants);$(AdditionalConstants) prompt 4 bin\Release\Net45\Newtonsoft.Json.xml @@ -274,7 +276,7 @@ -