Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs')
-rw-r--r--Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs40
1 files changed, 38 insertions, 2 deletions
diff --git a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
index 12e8ea5..180ce08 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
@@ -26,16 +26,20 @@
using System;
using System.ComponentModel;
using System.Globalization;
-using System.Linq;
using System.Reflection;
-using System.Runtime.Serialization;
#if !NETFX_CORE
+using System.Runtime.Serialization;
using System.Security.Permissions;
#endif
using Newtonsoft.Json.Utilities;
#if NETFX_CORE
using ICustomAttributeProvider = Newtonsoft.Json.Utilities.CustomAttributeProvider;
#endif
+#if NET20
+using Newtonsoft.Json.Utilities.LinqBridge;
+#else
+using System.Linq;
+#endif
namespace Newtonsoft.Json.Serialization
{
@@ -350,6 +354,19 @@ namespace Newtonsoft.Json.Serialization
}
private static bool? _dynamicCodeGeneration;
+ private static bool? _fullyTrusted;
+
+#if DEBUG
+ internal static void SetFullyTrusted(bool fullyTrusted)
+ {
+ _fullyTrusted = fullyTrusted;
+ }
+
+ internal static void SetDynamicCodeGeneration(bool dynamicCodeGeneration)
+ {
+ _dynamicCodeGeneration = dynamicCodeGeneration;
+ }
+#endif
public static bool DynamicCodeGeneration
{
@@ -380,6 +397,25 @@ namespace Newtonsoft.Json.Serialization
}
}
+ public static bool FullyTrusted
+ {
+ get
+ {
+ if (_fullyTrusted == null)
+ {
+#if !(NET20 || NET35 || SILVERLIGHT)
+ AppDomain appDomain = AppDomain.CurrentDomain;
+
+ _fullyTrusted = appDomain.IsHomogenous && appDomain.IsFullyTrusted;
+#else
+ _fullyTrusted = true;
+#endif
+ }
+
+ return _fullyTrusted.Value;
+ }
+ }
+
public static ReflectionDelegateFactory ReflectionDelegateFactory
{
get