From c6eff351a49708c37832aecd114a0b661ce72b2d Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 10 Feb 2013 17:49:36 +1300 Subject: [PATCH] -Removed old PocketPC ifdefs --- .../Bson/BsonWriterTests.cs | 2 +- .../Converters/BinaryConverterTests.cs | 2 +- .../Converters/ExpandoObjectConverterTests.cs | 2 +- .../Converters/IsoDateTimeConverterTests.cs | 2 +- .../JavaScriptDateTimeConverterTests.cs | 2 +- .../Converters/RegexConverterTests.cs | 2 +- Src/Newtonsoft.Json.Tests/JsonConvertTest.cs | 4 +-- .../JsonTextWriterTest.cs | 4 +-- .../Linq/JObjectTests.cs | 2 +- .../Linq/JTokenReaderTest.cs | 2 +- Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs | 4 +-- .../Linq/LinqToJsonTest.cs | 2 +- Src/Newtonsoft.Json.Tests/PerformanceTests.cs | 2 +- .../Properties/AssemblyInfo.cs | 4 --- .../Schema/ExtensionsTests.cs | 2 +- .../DefaultValueHandlingTests.cs | 4 +-- .../Serialization/JsonSerializerTest.cs | 20 ++++++------ .../SerializationEventAttributeTests.cs | 4 +-- .../TestObjects/Computer.cs | 2 +- .../TestObjects/DateTimeTestClass.cs | 2 +- .../DefaultValueAttributeTestClass.cs | 2 +- .../TestObjects/NullableDateTimeTestClass.cs | 2 +- .../TestObjects/Person.cs | 2 +- .../SerializationEventTestDictionary.cs | 4 +-- .../TestObjects/SerializationEventTestList.cs | 4 +-- .../SerializationEventTestObject.cs | 4 +-- ...alizationEventTestObjectWithConstructor.cs | 4 +-- Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs | 2 +- Src/Newtonsoft.Json/Bson/BsonWriter.cs | 2 +- .../Converters/DateTimeConverterBase.cs | 2 +- .../Converters/IsoDateTimeConverter.cs | 6 ++-- .../Converters/JavaScriptDateTimeConverter.cs | 4 +-- Src/Newtonsoft.Json/JsonConvert.cs | 6 ++-- Src/Newtonsoft.Json/JsonTextWriter.cs | 2 +- Src/Newtonsoft.Json/JsonWriter.cs | 8 ++--- Src/Newtonsoft.Json/Linq/JToken.cs | 10 +++--- Src/Newtonsoft.Json/Linq/JTokenWriter.cs | 2 +- Src/Newtonsoft.Json/Linq/JValue.cs | 4 +-- .../Properties/AssemblyInfo.cs | 4 --- .../Serialization/DefaultContractResolver.cs | 22 ++++++------- .../Serialization/JsonContract.cs | 10 ------ .../JsonSerializerInternalReader.cs | 3 +- .../JsonSerializerInternalWriter.cs | 4 +-- .../Serialization/JsonTypeReflector.cs | 8 ++--- .../LateBoundMetadataTypeAttribute.cs | 2 +- Src/Newtonsoft.Json/Utilities/ConvertUtils.cs | 2 +- .../Utilities/ReflectionUtils.cs | 32 ------------------- 47 files changed, 82 insertions(+), 145 deletions(-) diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs index b988528d..bfddc694 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs @@ -82,7 +82,7 @@ namespace Newtonsoft.Json.Tests.Bson Assert.AreEqual("0F-00-00-00-10-42-6C-61-68-00-01-00-00-00-00", bson); } -#if !PocketPC && !NET20 +#if !NET20 [Test] public void WriteValues() { diff --git a/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs index 9a342cad..b0ce3553 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE using System.Data.Linq; #endif #if !(SILVERLIGHT || NETFX_CORE) diff --git a/Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs index f6a81127..68827dbc 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE using System.Data.Linq; #endif #if !SILVERLIGHT && !NETFX_CORE diff --git a/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs index 534b33e9..e3c5828b 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs @@ -149,7 +149,7 @@ namespace Newtonsoft.Json.Tests.Converters } #endif -#if !PocketPC && !NET20 +#if !NET20 [Test] public void SerializeDateTimeOffset() { diff --git a/Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs index 85911653..493aefe1 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs @@ -53,7 +53,7 @@ namespace Newtonsoft.Json.Tests.Converters Assert.AreEqual("new Date(976918263055)", result); } -#if !PocketPC && !NET20 +#if !NET20 [Test] public void SerializeDateTimeOffset() { diff --git a/Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs index 4b68a6f9..7d9ec30e 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs @@ -25,7 +25,7 @@ using System; using System.Collections.Generic; -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE using System.Data.Linq; #endif #if !SILVERLIGHT && !NETFX_CORE diff --git a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs index 2953cd90..3afdbc5a 100644 --- a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs @@ -231,7 +231,7 @@ now brown cow?", '"', true); value = new DateTime(JsonConvert.InitialJavaScriptDateTicks, DateTimeKind.Utc); Assert.AreEqual(@"""\/Date(0)\/""", JsonConvert.ToString((DateTime)value, DateFormatHandling.MicrosoftDateFormat, DateTimeZoneHandling.RoundtripKind)); -#if !PocketPC && !NET20 +#if !NET20 value = new DateTimeOffset(JsonConvert.InitialJavaScriptDateTicks, TimeSpan.Zero); Assert.AreEqual(@"""1970-01-01T00:00:00+00:00""", JsonConvert.ToString(value)); @@ -280,7 +280,7 @@ now brown cow?", '"', true); int i = JsonConvert.DeserializeObject("1"); Assert.AreEqual(1, i); -#if !PocketPC && !NET20 +#if !NET20 DateTimeOffset d = JsonConvert.DeserializeObject(@"""\/Date(-59011455539000+0000)\/"""); Assert.AreEqual(new DateTimeOffset(new DateTime(100, 1, 1, 1, 1, 1, DateTimeKind.Utc)), d); #endif diff --git a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs index 4b0f4e07..5387b6ca 100644 --- a/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs @@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Tests jsonWriter.WriteValue((decimal?)1.1m); jsonWriter.WriteValue((DateTime?)null); jsonWriter.WriteValue((DateTime?)new DateTime(JsonConvert.InitialJavaScriptDateTicks, DateTimeKind.Utc)); -#if !PocketPC && !NET20 +#if !NET20 jsonWriter.WriteValue((DateTimeOffset?)null); jsonWriter.WriteValue((DateTimeOffset?)new DateTimeOffset(JsonConvert.InitialJavaScriptDateTicks, TimeSpan.Zero)); #endif @@ -143,7 +143,7 @@ namespace Newtonsoft.Json.Tests string json = sw.ToString(); string expected; -#if !PocketPC && !NET20 +#if !NET20 expected = @"[null,""c"",null,true,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1.1,null,1.1,null,1.1,null,""1970-01-01T00:00:00Z"",null,""1970-01-01T00:00:00+00:00""]"; #else expected = @"[null,""c"",null,true,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1.1,null,1.1,null,1.1,null,""1970-01-01T00:00:00Z""]"; diff --git a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs index 12983fc7..0ea1fcb6 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs @@ -38,7 +38,7 @@ using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAtt using Newtonsoft.Json.Linq; using System.IO; using System.Collections; -#if !PocketPC && !SILVERLIGHT && !NETFX_CORE +#if !SILVERLIGHT && !NETFX_CORE using System.Web.UI; #endif #if NET20 diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs index 777545f9..7e716f43 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs @@ -44,7 +44,7 @@ namespace Newtonsoft.Json.Tests.Linq [TestFixture] public class JTokenReaderTest : TestFixtureBase { -#if !PocketPC && !NET20 +#if !NET20 [Test] public void YahooFinance() { diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs index 6874a439..206454fa 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs @@ -233,7 +233,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(2L, (long)new JArray(1, 2, 3)[1]); Assert.AreEqual(new DateTime(2000, 12, 20), (DateTime)new JValue(new DateTime(2000, 12, 20))); -#if !PocketPC && !NET20 +#if !NET20 Assert.AreEqual(new DateTimeOffset(2000, 12, 20, 0, 0, 0, TimeSpan.Zero), (DateTimeOffset)new JValue(new DateTime(2000, 12, 20, 0, 0, 0, DateTimeKind.Utc))); Assert.AreEqual(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero), (DateTimeOffset)new JValue(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero))); Assert.AreEqual(null, (DateTimeOffset?)new JValue((DateTimeOffset?)null)); @@ -446,7 +446,7 @@ namespace Newtonsoft.Json.Tests.Linq public void ImplicitCastingTo() { Assert.IsTrue(JToken.DeepEquals(new JValue(new DateTime(2000, 12, 20)), (JValue)new DateTime(2000, 12, 20))); -#if !PocketPC && !NET20 +#if !NET20 Assert.IsTrue(JToken.DeepEquals(new JValue(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero)), (JValue)new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero))); Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null)); #endif diff --git a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs index 05867981..151b7c91 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs @@ -565,7 +565,7 @@ keyword such as type of business."" }); } -#if !PocketPC && !NET20 +#if !NET20 [Test] public void ToStringJsonConverter() { diff --git a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs index 39f0215d..fc477b2c 100644 --- a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs +++ b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(SILVERLIGHT || PocketPC || NET20 || NET35 || NETFX_CORE || PORTABLE) +#if !(SILVERLIGHT || NET20 || NET35 || NETFX_CORE || PORTABLE) using System; using System.Collections.Generic; using System.Globalization; diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 2088f356..02c8b3f1 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -35,8 +35,6 @@ using System.Security; [assembly: AssemblyTitle("Json.NET Tests Windows Phone")] #elif SILVERLIGHT [assembly: AssemblyTitle("Json.NET Tests Silverlight")] -#elif PocketPC -[assembly: AssemblyTitle("Json.NET Tests Compact")] #elif PORTABLE [assembly: AssemblyTitle("Json.NET Tests Portable")] #elif NETFX_CORE @@ -75,6 +73,4 @@ using System.Security; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.5.0.0")] -#if !PocketPC [assembly: AssemblyFileVersion("4.5.11.15810")] -#endif diff --git a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs index 9d043b98..7f2b4aba 100644 --- a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs @@ -199,7 +199,7 @@ namespace Newtonsoft.Json.Tests.Schema GenerateSchemaAndSerializeFromType(new CircularReferenceWithIdClass()); GenerateSchemaAndSerializeFromType(new ClassWithArray()); GenerateSchemaAndSerializeFromType(new ClassWithGuid()); -#if !NET20 && !PocketPC +#if !NET20 GenerateSchemaAndSerializeFromType(new NullableDateTimeTestClass()); #endif #if !(SILVERLIGHT || NETFX_CORE || PORTABLE) diff --git a/Src/Newtonsoft.Json.Tests/Serialization/DefaultValueHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/DefaultValueHandlingTests.cs index cb530ffa..e8497229 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/DefaultValueHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/DefaultValueHandlingTests.cs @@ -27,7 +27,7 @@ using System; using System.ComponentModel; using System.IO; using System.Runtime.Serialization; -#if !(SILVERLIGHT || PocketPC || NET20 || NET35 || NETFX_CORE || PORTABLE) +#if !(SILVERLIGHT || NET20 || NET35 || NETFX_CORE || PORTABLE) using System.Runtime.Serialization.Json; #endif using System.Text; @@ -209,7 +209,7 @@ namespace Newtonsoft.Json.Tests.Serialization { EmitDefaultValueClass c = new EmitDefaultValueClass(); -#if !(SILVERLIGHT || PocketPC || NET20 || NET35 || NETFX_CORE || PORTABLE) +#if !(SILVERLIGHT || NET20 || NET35 || NETFX_CORE || PORTABLE) DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(EmitDefaultValueClass)); MemoryStream ms = new MemoryStream(); diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index 5b7a27c0..58e143a0 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Concurrent; #endif using System.Collections.Generic; -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE using System.ComponentModel.DataAnnotations; using System.Configuration; using System.Runtime.CompilerServices; @@ -53,7 +53,7 @@ using System.Collections.ObjectModel; using Newtonsoft.Json.Bson; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Converters; -#if !PocketPC && !NET20 && !WINDOWS_PHONE +#if !NET20 && !WINDOWS_PHONE using System.Runtime.Serialization.Json; #endif using Newtonsoft.Json.Serialization; @@ -173,7 +173,7 @@ namespace Newtonsoft.Json.Tests.Serialization string jsonText = JsonConvert.SerializeObject(testDictionary); -#if !PocketPC && !NET20 && !WINDOWS_PHONE +#if !NET20 && !WINDOWS_PHONE MemoryStream ms = new MemoryStream(); DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Dictionary)); serializer.WriteObject(ms, testDictionary); @@ -432,7 +432,7 @@ keyword such as type of business."" CollectionAssert.AreEqual(r1, r2); } -#if !PocketPC && !NET20 && !WINDOWS_PHONE +#if !NET20 && !WINDOWS_PHONE [Test] public void Unicode() { @@ -1595,7 +1595,7 @@ keyword such as type of business."" } #endif -#if !PocketPC && !NET20 +#if !NET20 [DataContract] public class DataContractPrivateMembers { @@ -1982,7 +1982,7 @@ keyword such as type of business."" Assert.AreEqual("Product 1", products[0].Name); } -#if !PocketPC && !NET20 +#if !NET20 [Test] public void DeserializeEmptyStringToNullableDateTime() { @@ -2759,7 +2759,7 @@ Path '', line 1, position 2.", public string Ethnicity { get; set; } } -#if !NET20 && !PocketPC && !WINDOWS_PHONE +#if !NET20 && !WINDOWS_PHONE public class DataContractJsonSerializerTestClass { public TimeSpan TimeSpanProperty { get; set; } @@ -4108,7 +4108,7 @@ To fix this error either change the environment to be fully trusted, change the Assert.AreEqual(null, d[2]); } -#if !SILVERLIGHT && !NET20 && !PocketPC +#if !SILVERLIGHT && !NET20 [Test] public void SerializeHashSet() { @@ -4161,7 +4161,7 @@ To fix this error either change the environment to be fully trusted, change the Assert.AreEqual(0, z[1].Prop1.Length); } -#if !NET20 && !PocketPC && !SILVERLIGHT && !NETFX_CORE +#if !NET20 && !SILVERLIGHT && !NETFX_CORE public class StringDictionaryTestClass { public StringDictionary StringDictionaryProperty { get; set; } @@ -4456,7 +4456,7 @@ To fix this error either change the environment to be fully trusted, change the Assert.AreEqual(meh.IDontWork, "meh"); } -#if !(SILVERLIGHT || PocketPC || NET20 || NETFX_CORE) +#if !(SILVERLIGHT || NET20 || NETFX_CORE) [DataContract] public struct StructISerializable : ISerializable { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SerializationEventAttributeTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/SerializationEventAttributeTests.cs index 8b0a701a..87a9bf31 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/SerializationEventAttributeTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/SerializationEventAttributeTests.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC using System; using System.Diagnostics; using System.IO; @@ -336,5 +335,4 @@ namespace Newtonsoft.Json.Tests.Serialization } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Computer.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Computer.cs index 25b0bab8..26745e65 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Computer.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Computer.cs @@ -26,7 +26,7 @@ using System; using System.Runtime.Serialization; -#if !PocketPC && !NET20 +#if !NET20 namespace Newtonsoft.Json.Tests.TestObjects { [DataContract] diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/DateTimeTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/DateTimeTestClass.cs index 17d328c8..5dc2b7a3 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/DateTimeTestClass.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/DateTimeTestClass.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC && !NET20 +#if !NET20 using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs index cec2c86d..fb5ccfcb 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs @@ -27,7 +27,7 @@ using System.ComponentModel; namespace Newtonsoft.Json.Tests.TestObjects { -#if !PocketPC && !NETFX_CORE +#if !NETFX_CORE [Description("DefaultValueAttributeTestClass description!")] #endif public sealed class DefaultValueAttributeTestClass diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/NullableDateTimeTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/NullableDateTimeTestClass.cs index 2ede4794..9fba16b5 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/NullableDateTimeTestClass.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/NullableDateTimeTestClass.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC && !NET20 +#if !NET20 using System; using System.Collections.Generic; using System.Linq; diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs index 0c905d21..d6eb844c 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs @@ -29,7 +29,7 @@ using System.ComponentModel; namespace Newtonsoft.Json.Tests.TestObjects { [JsonObject(Id = "Person", Title = "Title!", Description = "JsonObjectAttribute description!", MemberSerialization = MemberSerialization.OptIn)] -#if !PocketPC && !NETFX_CORE +#if !NETFX_CORE [Description("DescriptionAttribute description!")] #endif public class Person diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestDictionary.cs b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestDictionary.cs index e6137040..390e16b0 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestDictionary.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestDictionary.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC using System.Collections.Generic; using System.Runtime.Serialization; @@ -78,5 +77,4 @@ namespace Newtonsoft.Json.Tests.TestObjects Member4 = "This value was set after deserialization."; } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestList.cs b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestList.cs index da1eed74..2bc0d0fb 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestList.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestList.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC using System.Collections.ObjectModel; using System.Runtime.Serialization; @@ -78,5 +77,4 @@ namespace Newtonsoft.Json.Tests.TestObjects Member4 = "This value was set after deserialization."; } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs index f36d8a07..3965447f 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC using System; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; @@ -97,5 +96,4 @@ namespace Newtonsoft.Json.Tests.TestObjects errorContext.Handled = true; } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObjectWithConstructor.cs b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObjectWithConstructor.cs index 2aa159d0..3e3a557e 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObjectWithConstructor.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObjectWithConstructor.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !PocketPC using System; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; @@ -81,5 +80,4 @@ namespace Newtonsoft.Json.Tests.TestObjects Member4 = "This value was set after deserialization."; } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs index 78e7c7fd..2775c52e 100644 --- a/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs @@ -148,7 +148,7 @@ namespace Newtonsoft.Json.Bson ticks = JsonConvert.ConvertDateTimeToJavaScriptTicks(dateTime, false); } -#if !PocketPC && !NET20 +#if !NET20 else { DateTimeOffset dateTimeOffset = (DateTimeOffset)value.Value; diff --git a/Src/Newtonsoft.Json/Bson/BsonWriter.cs b/Src/Newtonsoft.Json/Bson/BsonWriter.cs index 499625dd..ac10abb8 100644 --- a/Src/Newtonsoft.Json/Bson/BsonWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonWriter.cs @@ -407,7 +407,7 @@ namespace Newtonsoft.Json.Bson AddValue(value, BsonType.Date); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Writes a value. /// diff --git a/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs b/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs index b0642ae0..d5bafe62 100644 --- a/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs +++ b/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs @@ -43,7 +43,7 @@ namespace Newtonsoft.Json.Converters { if (objectType == typeof(DateTime) || objectType == typeof(DateTime?)) return true; -#if !PocketPC && !NET20 +#if !NET20 if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?)) return true; #endif diff --git a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs index f44115bd..cca39b36 100644 --- a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs @@ -90,7 +90,7 @@ namespace Newtonsoft.Json.Converters text = dateTime.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture); } -#if !PocketPC && !NET20 +#if !NET20 else if (value is DateTimeOffset) { DateTimeOffset dateTimeOffset = (DateTimeOffset)value; @@ -134,7 +134,7 @@ namespace Newtonsoft.Json.Converters if (reader.TokenType == JsonToken.Date) { -#if !PocketPC && !NET20 +#if !NET20 if (t == typeof(DateTimeOffset)) return new DateTimeOffset((DateTime)reader.Value); #endif @@ -150,7 +150,7 @@ namespace Newtonsoft.Json.Converters if (string.IsNullOrEmpty(dateText) && nullable) return null; -#if !PocketPC && !NET20 +#if !NET20 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 606a64a2..af20d53a 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 = JsonConvert.ConvertDateTimeToJavaScriptTicks(utcDateTime); } -#if !PocketPC && !NET20 +#if !NET20 else if (value is DateTimeOffset) { DateTimeOffset dateTimeOffset = (DateTimeOffset)value; @@ -107,7 +107,7 @@ namespace Newtonsoft.Json.Converters if (reader.TokenType != JsonToken.EndConstructor) throw JsonSerializationException.Create(reader, "Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); -#if !PocketPC && !NET20 +#if !NET20 if (t == typeof(DateTimeOffset)) return new DateTimeOffset(d); #endif diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index 02dbf62a..923946ee 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -137,7 +137,7 @@ namespace Newtonsoft.Json return value; } -#if !PocketPC && !NET20 +#if !NET20 /// /// Converts the to its JSON string representation. /// @@ -656,7 +656,7 @@ namespace Newtonsoft.Json #endif } } -#if !PocketPC && !NET20 +#if !NET20 else if (value is DateTimeOffset) { return ToString((DateTimeOffset) value); @@ -711,7 +711,7 @@ namespace Newtonsoft.Json if (ReflectionUtils.IsNullableType(type)) type = Nullable.GetUnderlyingType(type); -#if !PocketPC && !NET20 +#if !NET20 if (type == typeof (DateTimeOffset)) return true; #endif diff --git a/Src/Newtonsoft.Json/JsonTextWriter.cs b/Src/Newtonsoft.Json/JsonTextWriter.cs index 82621245..4a5f4241 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.cs @@ -507,7 +507,7 @@ namespace Newtonsoft.Json } } -#if !PocketPC && !NET20 +#if !NET20 /// /// Writes a value. /// diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index 9b494ebb..f074fe39 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -521,7 +521,7 @@ namespace Newtonsoft.Json WriteEndConstructor(); break; case JsonToken.Date: -#if !PocketPC && !NET20 +#if !NET20 if (reader.Value is DateTimeOffset) WriteValue((DateTimeOffset)reader.Value); else @@ -949,7 +949,7 @@ namespace Newtonsoft.Json InternalWriteValue(JsonToken.Date); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Writes a value. /// @@ -1150,7 +1150,7 @@ namespace Newtonsoft.Json WriteValue(value.Value); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Writes a value. /// @@ -1340,7 +1340,7 @@ namespace Newtonsoft.Json #endif } } -#if !PocketPC && !NET20 +#if !NET20 else if (value is DateTimeOffset) { if (nullable) diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index 95403653..82e8fcf0 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -454,7 +454,7 @@ namespace Newtonsoft.Json.Linq return Convert.ToBoolean(v.Value, CultureInfo.InvariantCulture); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Performs an explicit conversion from to . /// @@ -522,7 +522,7 @@ namespace Newtonsoft.Json.Linq return (v.Value != null) ? (DateTime?)Convert.ToDateTime(v.Value, CultureInfo.InvariantCulture) : null; } -#if !PocketPC && !NET20 +#if !NET20 /// /// Performs an explicit conversion from to . /// @@ -1036,7 +1036,7 @@ namespace Newtonsoft.Json.Linq return new JValue(value); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Performs an implicit conversion from to . /// @@ -1078,7 +1078,7 @@ namespace Newtonsoft.Json.Linq return new JValue(value); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Performs an implicit conversion from to . /// @@ -1517,7 +1517,7 @@ namespace Newtonsoft.Json.Linq return (string) this; } -#if !PocketPC && !NET20 +#if !NET20 if (objectType == typeof (DateTimeOffset)) { if (isNullable) diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs index fe5de9c4..1463de7d 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -377,7 +377,7 @@ namespace Newtonsoft.Json.Linq AddValue(value, JsonToken.Date); } -#if !PocketPC && !NET20 +#if !NET20 /// /// Writes a value. /// diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 0fb2f67e..3a4e4823 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -460,7 +460,7 @@ namespace Newtonsoft.Json.Linq return JTokenType.Float; else if (value is DateTime) return JTokenType.Date; -#if !PocketPC && !NET20 +#if !NET20 else if (value is DateTimeOffset) return JTokenType.Date; #endif @@ -573,7 +573,7 @@ namespace Newtonsoft.Json.Linq writer.WriteValue(Convert.ToBoolean(_value, CultureInfo.InvariantCulture)); return; case JTokenType.Date: -#if !PocketPC && !NET20 +#if !NET20 if (_value is DateTimeOffset) writer.WriteValue((DateTimeOffset)_value); else diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 833e55c0..b67176ff 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -36,8 +36,6 @@ using System.Security; [assembly: AssemblyTitle("Json.NET Windows Phone")] #elif SILVERLIGHT [assembly: AssemblyTitle("Json.NET Silverlight")] -#elif PocketPC -[assembly: AssemblyTitle("Json.NET Compact")] #elif PORTABLE [assembly: AssemblyTitle("Json.NET Portable")] #elif NETFX_CORE @@ -89,8 +87,6 @@ using System.Security; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.5.0.0")] -#if !PocketPC [assembly: AssemblyFileVersion("4.5.11.15810")] -#endif [assembly: CLSCompliant(true)] diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs index 68b0371c..d1a3d8cb 100644 --- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs +++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs @@ -274,7 +274,7 @@ namespace Newtonsoft.Json.Serialization if (memberSerialization != MemberSerialization.Fields) { -#if !PocketPC && !NET20 +#if !NET20 DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType); #endif @@ -297,7 +297,7 @@ namespace Newtonsoft.Json.Serialization // or are a field if serializing just fields if (JsonTypeReflector.GetAttribute(member.GetCustomAttributeProvider()) != null) serializableMembers.Add(member); -#if !PocketPC && !NET20 +#if !NET20 else if (dataContractAttribute != null && JsonTypeReflector.GetAttribute(member.GetCustomAttributeProvider()) != null) serializableMembers.Add(member); #endif @@ -307,7 +307,7 @@ namespace Newtonsoft.Json.Serialization } } -#if !PocketPC && !SILVERLIGHT && !NET20 +#if !SILVERLIGHT && !NET20 Type match; // don't include EntityKey on entities objects... this is a bit hacky if (objectType.AssignableToTypeName("System.Data.Objects.DataClasses.EntityObject", out match)) @@ -328,7 +328,7 @@ namespace Newtonsoft.Json.Serialization return serializableMembers; } -#if !PocketPC && !SILVERLIGHT && !NET20 +#if !SILVERLIGHT && !NET20 private bool ShouldSerializeEntityMember(MemberInfo memberInfo) { PropertyInfo propertyInfo = memberInfo as PropertyInfo; @@ -508,7 +508,7 @@ namespace Newtonsoft.Json.Serialization return JsonTypeReflector.ReflectionDelegateFactory.CreateDefaultConstructor(createdType); } -#if !PocketPC && !NET20 +#if !NET20 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Runtime.Serialization.DataContractAttribute.#get_IsReference()")] #endif private void InitializeContract(JsonContract contract) @@ -518,7 +518,7 @@ namespace Newtonsoft.Json.Serialization { contract.IsReference = containerAttribute._isReference; } -#if !PocketPC && !NET20 +#if !NET20 else { DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(contract.NonNullableUnderlyingType); @@ -805,7 +805,7 @@ namespace Newtonsoft.Json.Serialization if (type == typeof(Type) || type.IsSubclassOf(typeof(Type))) return true; -#if SILVERLIGHT || PocketPC +#if SILVERLIGHT if (type == typeof(Guid) || type == typeof(Uri) || type == typeof(TimeSpan)) return true; #endif @@ -938,7 +938,7 @@ namespace Newtonsoft.Json.Serialization private void SetPropertySettingsFromAttributes(JsonProperty property, ICustomAttributeProvider attributeProvider, string name, Type declaringType, MemberSerialization memberSerialization, out bool allowNonPublicAccess) { -#if !PocketPC && !NET20 +#if !NET20 DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(declaringType); MemberInfo memberInfo = null; @@ -962,7 +962,7 @@ namespace Newtonsoft.Json.Serialization string mappedName; if (propertyAttribute != null && propertyAttribute.PropertyName != null) mappedName = propertyAttribute.PropertyName; -#if !PocketPC && !NET20 +#if !NET20 else if (dataMemberAttribute != null && dataMemberAttribute.Name != null) mappedName = dataMemberAttribute.Name; #endif @@ -980,7 +980,7 @@ namespace Newtonsoft.Json.Serialization property.DefaultValueHandling = propertyAttribute._defaultValueHandling; hasMemberAttribute = true; } -#if !PocketPC && !NET20 +#if !NET20 else if (dataMemberAttribute != null) { property._required = (dataMemberAttribute.IsRequired) ? Required.AllowNull : Required.Default; @@ -1045,7 +1045,7 @@ namespace Newtonsoft.Json.Serialization if (memberSerialization == MemberSerialization.Fields) allowNonPublicAccess = true; -#if !PocketPC && !NET20 +#if !NET20 if (dataMemberAttribute != null) { allowNonPublicAccess = true; diff --git a/Src/Newtonsoft.Json/Serialization/JsonContract.cs b/Src/Newtonsoft.Json/Serialization/JsonContract.cs index 568da9ce..e376bc99 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonContract.cs @@ -89,7 +89,6 @@ namespace Newtonsoft.Json.Serialization // checked for after passed in converters and attribute specified converters internal JsonConverter InternalConverter { get; set; } -#if !PocketPC /// /// Gets or sets the method called immediately after deserialization of the object. /// @@ -113,7 +112,6 @@ namespace Newtonsoft.Json.Serialization /// /// The method called before serialization of the object. public MethodInfo OnSerializing { get; set; } -#endif /// /// Gets or sets the default creator method used to create the object. @@ -135,34 +133,26 @@ namespace Newtonsoft.Json.Serialization internal void InvokeOnSerializing(object o, StreamingContext context) { -#if !PocketPC if (OnSerializing != null) OnSerializing.Invoke(o, new object[] {context}); -#endif } internal void InvokeOnSerialized(object o, StreamingContext context) { -#if !PocketPC if (OnSerialized != null) OnSerialized.Invoke(o, new object[] {context}); -#endif } internal void InvokeOnDeserializing(object o, StreamingContext context) { -#if !PocketPC if (OnDeserializing != null) OnDeserializing.Invoke(o, new object[] {context}); -#endif } internal void InvokeOnDeserialized(object o, StreamingContext context) { -#if !PocketPC if (OnDeserialized != null) OnDeserialized.Invoke(o, new object[] {context}); -#endif } internal void InvokeOnError(object o, StreamingContext context, ErrorContext errorContext) diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 2eefcd59..a91f60fc 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -561,10 +561,9 @@ To fix this error either change the JSON to a {1} or change the deserialized typ if (id != null && isTemporaryListReference) throw JsonSerializationException.Create(reader, "Cannot preserve reference to array or readonly list: {0}.".FormatWith(CultureInfo.InvariantCulture, contract.UnderlyingType)); -#if !PocketPC if (contract.OnSerializing != null && isTemporaryListReference) throw JsonSerializationException.Create(reader, "Cannot call OnSerializing on an array or readonly list: {0}.".FormatWith(CultureInfo.InvariantCulture, contract.UnderlyingType)); -#endif + if (contract.OnError != null && isTemporaryListReference) throw JsonSerializationException.Create(reader, "Cannot call OnError on an array or readonly list: {0}.".FormatWith(CultureInfo.InvariantCulture, contract.UnderlyingType)); diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs index 400479fb..7e25bbe6 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs @@ -292,7 +292,7 @@ namespace Newtonsoft.Json.Serialization internal static bool TryConvertToString(object value, Type type, out string s) { -#if !(PocketPC || NETFX_CORE || PORTABLE) +#if !(NETFX_CORE || PORTABLE) TypeConverter converter = ConvertUtils.GetConverter(type); // use the objectType's TypeConverter if it has one and can convert to a string @@ -315,7 +315,7 @@ namespace Newtonsoft.Json.Serialization } #endif -#if SILVERLIGHT || PocketPC || NETFX_CORE +#if SILVERLIGHT || NETFX_CORE if (value is Guid || value is Uri || value is TimeSpan) { s = value.ToString(); diff --git a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs index 31259f22..6b9ac68d 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs @@ -44,7 +44,7 @@ using System.Runtime.Serialization; namespace Newtonsoft.Json.Serialization { -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE internal interface IMetadataTypeAttribute { Type MetadataClassType { get; } @@ -115,7 +115,7 @@ namespace Newtonsoft.Json.Serialization } #endif -#if !PocketPC && !NET20 +#if !NET20 public static DataContractAttribute GetDataContractAttribute(Type type) { // DataContractAttribute does not have inheritance @@ -171,7 +171,7 @@ namespace Newtonsoft.Json.Serialization if (objectAttribute != null) return objectAttribute.MemberSerialization; -#if !PocketPC && !NET20 +#if !NET20 DataContractAttribute dataContractAttribute = GetDataContractAttribute(objectType); if (dataContractAttribute != null) return MemberSerialization.OptIn; @@ -225,7 +225,6 @@ namespace Newtonsoft.Json.Serialization } #if !(NETFX_CORE || PORTABLE) -#if !PocketPC public static TypeConverter GetTypeConverter(Type type) { #if !SILVERLIGHT @@ -237,7 +236,6 @@ namespace Newtonsoft.Json.Serialization return (TypeConverter)ReflectionUtils.CreateInstance(converterType); return null; -#endif #endif } #endif diff --git a/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs b/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs index ec594a08..07cb72f3 100644 --- a/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs +++ b/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !SILVERLIGHT && !PocketPC && !NET20 && !NETFX_CORE +#if !SILVERLIGHT && !NET20 && !NETFX_CORE using System; using System.Collections.Generic; using System.Linq; diff --git a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs index 13c89f9d..fba73a0d 100644 --- a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs @@ -329,7 +329,7 @@ namespace Newtonsoft.Json.Utilities if (targetType.IsInterface() || targetType.IsGenericTypeDefinition() || targetType.IsAbstract()) throw new ArgumentException("Target type {0} is not a value type or a non-abstract class.".FormatWith(CultureInfo.InvariantCulture, targetType), "targetType"); -#if !PocketPC && !NET20 +#if !NET20 if (initialValue is DateTime && targetType == typeof(DateTimeOffset)) return new DateTimeOffset((DateTime)initialValue); #endif diff --git a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs index 74eaa4a0..1703cf67 100644 --- a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -809,39 +809,7 @@ namespace Newtonsoft.Json.Utilities { ValidationUtils.ArgumentNotNull(type, "type"); -#if !PocketPC return Activator.CreateInstance(type, args); -#else - // CF doesn't have a Activator.CreateInstance overload that takes args - // lame - - if (type.IsValueType && CollectionUtils.IsNullOrEmpty(args)) - return Activator.CreateInstance(type); - - ConstructorInfo[] constructors = type.GetConstructors(); - ConstructorInfo match = constructors.Where(c => - { - ParameterInfo[] parameters = c.GetParameters(); - if (parameters.Length != args.Length) - return false; - - for (int i = 0; i < parameters.Length; i++) - { - ParameterInfo parameter = parameters[i]; - object value = args[i]; - - if (!IsCompatibleValue(value, parameter.ParameterType)) - return false; - } - - return true; - }).FirstOrDefault(); - - if (match == null) - throw new Exception("Could not create '{0}' with given parameters.".FormatWith(CultureInfo.InvariantCulture, type)); - - return match.Invoke(args); -#endif } public static void SplitFullyQualifiedTypeName(string fullyQualifiedTypeName, out string typeName, out string assemblyName)