Преглед изворни кода

Removed all conditional compilation

Brad Robinson пре 5 година
родитељ
комит
bc8838409f
4 измењених фајлова са 1 додато и 34 уклоњено
  1. 0 4
      Topten.JsonKit/Emit.cs
  2. 0 20
      Topten.JsonKit/JsonKit.cs
  3. 0 6
      Topten.JsonKit/JsonReader.cs
  4. 1 4
      Topten.JsonKit/ReflectionInfo.cs

+ 0 - 4
Topten.JsonKit/Emit.cs

@@ -22,15 +22,12 @@ using System.Linq;
 using System.IO;
 using System.Reflection;
 using System.Globalization;
-#if !JsonKit_NO_EMIT
 using System.Reflection.Emit;
-#endif
 
 
 
 namespace Topten.JsonKit
 {
-#if !JsonKit_NO_EMIT
     static class Emit
     {
 
@@ -807,5 +804,4 @@ namespace Topten.JsonKit
             throw new InvalidDataException("expected a numeric literal");
         }
     }
-#endif
 }

+ 0 - 20
Topten.JsonKit/JsonKit.cs

@@ -17,25 +17,7 @@
 // Define JsonKit_NO_DATACONTRACT to disable support for [DataContract]/[DataMember]
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.IO;
-using System.Reflection;
-using System.Globalization;
-using System.Collections;
-using System.Threading;
-#if !JsonKit_NO_DYNAMIC
-using System.Dynamic;
-#endif
-#if !JsonKit_NO_EMIT
-using System.Reflection.Emit;
-#endif
-#if !JsonKit_NO_DATACONTRACT
-using System.Runtime.Serialization;
-#endif
-
-
 
 namespace Topten.JsonKit
 {
@@ -47,11 +29,9 @@ namespace Topten.JsonKit
             WriteWhitespaceDefault = true;
             StrictParserDefault = false;
 
-#if !JsonKit_NO_EMIT
             Json.SetFormatterResolver(Emit.MakeFormatter);
             Json.SetParserResolver(Emit.MakeParser);
             Json.SetIntoParserResolver(Emit.MakeIntoParser);
-#endif
         }
 
         // Pretty format default

+ 0 - 6
Topten.JsonKit/JsonReader.cs

@@ -22,9 +22,7 @@ using System.Linq;
 using System.IO;
 using System.Globalization;
 using System.Collections;
-#if !JsonKit_NO_DYNAMIC
 using System.Dynamic;
-#endif
 
 
 namespace Topten.JsonKit
@@ -334,11 +332,7 @@ namespace Topten.JsonKit
             // Untyped dictionary?
             if (_tokenizer.CurrentToken == Token.OpenBrace && (type.IsAssignableFrom(typeof(IDictionary<string, object>))))
             {
-#if !JsonKit_NO_DYNAMIC
                 var container = (new ExpandoObject()) as IDictionary<string, object>;
-#else
-                var container = new Dictionary<string, object>();
-#endif
                 ParseDictionary(key =>
                 {
                     container[key] = Parse(typeof(Object));

+ 1 - 4
Topten.JsonKit/ReflectionInfo.cs

@@ -20,9 +20,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
-#if !JsonKit_NO_DATACONTRACT
 using System.Runtime.Serialization;
-#endif
 
 
 
@@ -177,7 +175,6 @@ namespace Topten.JsonKit
                 // Do any members have a [Json] attribute
                 bool anyFieldsMarked = allMembers.Any(x => x.GetCustomAttributes(typeof(JsonAttribute), false).OfType<JsonAttribute>().Any());
 
-#if !JsonKit_NO_DATACONTRACT
                 // Try with DataContract and friends
                 if (!typeMarked && !anyFieldsMarked && type.GetCustomAttributes(typeof(DataContractAttribute), true).OfType<DataContractAttribute>().Any())
                 {
@@ -200,7 +197,7 @@ namespace Topten.JsonKit
                     ri.Members.Sort((a, b) => String.CompareOrdinal(a.JsonKey, b.JsonKey));    // Match DataContractJsonSerializer
                     return ri;
                 }
-#endif
+
                 {
                     // Should we serialize all public methods?
                     bool serializeAllPublics = typeMarked || !anyFieldsMarked;