Exemple #1
0
 static JsonMapper()
 {
     JsonMapper.array_metadata_lock    = new object();
     JsonMapper.conv_ops_lock          = new object();
     JsonMapper.object_metadata_lock   = new object();
     JsonMapper.type_properties_lock   = new object();
     JsonMapper.static_writer_lock     = new object();
     JsonMapper.max_nesting_depth      = 100;
     JsonMapper.array_metadata         = new Dictionary <Type, ArrayMetadata>();
     JsonMapper.conv_ops               = new Dictionary <Type, IDictionary <Type, MethodInfo> >();
     JsonMapper.object_metadata        = new Dictionary <Type, ObjectMetadata>();
     JsonMapper.type_properties        = new Dictionary <Type, IList <PropertyMetadata> >();
     JsonMapper.static_writer          = new JsonWriter();
     JsonMapper.datetime_format        = DateTimeFormatInfo.get_InvariantInfo();
     JsonMapper.base_exporters_table   = new Dictionary <Type, ExporterFunc>();
     JsonMapper.custom_exporters_table = new Dictionary <Type, ExporterFunc>();
     JsonMapper.base_importers_table   = new Dictionary <Type, IDictionary <Type, ImporterFunc> >();
     JsonMapper.custom_importers_table = new Dictionary <Type, IDictionary <Type, ImporterFunc> >();
     JsonMapper.RegisterBaseExporters();
     JsonMapper.RegisterBaseImporters();
 }
Exemple #2
0
 private global::System.DateTime ParseDateString(string dateStr, string formatStr)
 {
     return(global::System.DateTime.ParseExact(dateStr, formatStr, (IFormatProvider)(object)DateTimeFormatInfo.get_InvariantInfo()).ToUniversalTime());
 }
Exemple #3
0
        private global::System.DateTime ParseDateString(string s, string format, bool makeUniversal)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0029: Unknown result type (might be due to invalid IL or missing references)
            //IL_002f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0032: Unknown result type (might be due to invalid IL or missing references)
            //IL_0033: Unknown result type (might be due to invalid IL or missing references)
            //IL_003b: Unknown result type (might be due to invalid IL or missing references)
            DateTimeStyles val = (DateTimeStyles)0;

            if (Platform.EndsWith(format, "Z"))
            {
                try
                {
                    val = (DateTimeStyles)Enums.GetEnumValue(typeof(DateTimeStyles), "AssumeUniversal");
                }
                catch (global::System.Exception)
                {
                }
                val = (DateTimeStyles)(val | 0x10);
            }
            global::System.DateTime result = global::System.DateTime.ParseExact(s, format, (IFormatProvider)(object)DateTimeFormatInfo.get_InvariantInfo(), val);
            if (!makeUniversal)
            {
                return(result);
            }
            return(result.ToUniversalTime());
        }