Exemplo n.º 1
0
        public static BridgeSerializerSettings GetSerializerSettings()
        {
            var _settings = new BridgeSerializerSettings();

            //_settings.TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;
            _settings.TypeNameHandling = TypeNameHandling.All;
            _settings.Converters.Insert(0, new PrimitiveJsonConverter());

            return(_settings);
        }
Exemplo n.º 2
0
        public static T Deserialize <T>(string data)
        {
            if (EnvironmentHelper.RunOnCLR())
            {
                data = data.Replace("%CORE%", EnvironmentHelper.GetNetCoreVersion());
            }
            else
            {
                data = data.Replace("%CORE%", "mscorlib");
            }

            return((T)JsonConvert.DeserializeObject <T>(data, BridgeSerializerSettings.GetSerializerSettings()));
        }
Exemplo n.º 3
0
        public static string Serialize(object value)
        {
            string data = JsonConvert.SerializeObject(value, BridgeSerializerSettings.GetSerializerSettings());

            if (EnvironmentHelper.RunOnCLR())
            {
                data = data.Replace("System.Private.CoreLib", "%CORE%");
            }
            else
            {
                data = data.Replace("mscorlib", "%CORE%");
            }


            return(data);
        }