// Token: 0x06000073 RID: 115 // RVA: 0x00006094 File Offset: 0x00004294 protected JsonReader() { this._currentState = JsonReader.State.Start; this._stack = new List<JsonPosition>(4); this._dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; this._dateParseHandling = DateParseHandling.DateTime; this._floatParseHandling = FloatParseHandling.Double; this.CloseInput = true; }
private string SerializeUsing(Flight flight, DateTimeZoneHandling handling) { var settings = new ConnectionSettings() .SetDefaultPropertyNameInferrer(p=>p) .SetJsonSerializerSettingsModifier(s => { s.DateFormatHandling = DateFormatHandling.IsoDateFormat; s.DateTimeZoneHandling = handling; }); var client = new ElasticClient(settings); return client.Serializer.Serialize(flight).Utf8String(); }
internal static DateTime EnsureDateTime(DateTime value, DateTimeZoneHandling timeZone) { switch (timeZone) { case DateTimeZoneHandling.Local: value = SwitchToLocalTime(value); break; case DateTimeZoneHandling.Utc: value = SwitchToUtcTime(value); break; case DateTimeZoneHandling.Unspecified: value = new DateTime(value.Ticks, DateTimeKind.Unspecified); break; case DateTimeZoneHandling.RoundtripKind: break; default: throw new ArgumentException("Invalid date time handling value."); } return value; }
internal static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { const string isoDateFormat = "yyyy-MM-ddTHH:mm:ss.FFFFFFFK"; #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { DateTimeOffset dateTimeOffset; if (DateTimeOffset.TryParseExact(text, isoDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTimeOffset)) { dt = dateTimeOffset; return true; } } else #endif { DateTime dateTime; if (DateTime.TryParseExact(text, isoDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTime)) { dateTime = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); dt = dateTime; return true; } } dt = null; return false; }
/// <summary> /// Creates an instance of the <c>JsonWriter</c> class. /// </summary> protected JsonWriter() { _currentState = State.Start; _formatting = Formatting.None; _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; CloseOutput = true; }
public static DateTime ConvertDateTime(double epoch_time, string timezone, DateTimeZoneHandling tzHandle) { var dto = ConvertDateTimeOffset(epoch_time, timezone); switch (tzHandle) { case DateTimeZoneHandling.Local: return dto.LocalDateTime; case DateTimeZoneHandling.Utc: return dto.UtcDateTime; case DateTimeZoneHandling.Unspecified: return dto.DateTime; case DateTimeZoneHandling.RoundtripKind: return dto.Offset == TimeSpan.Zero ? dto.UtcDateTime : dto.LocalDateTime; default: throw new JsonSerializationException("Invalid date time handling value."); } }
// Token: 0x06000D22 RID: 3362 // RVA: 0x0004A6E8 File Offset: 0x000488E8 private static bool TryParseDateExact(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { DateTime dateTime; if (DateTime.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out dateTime)) { dateTime = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); dt = dateTime; return true; } dt = null; return false; }
internal static bool TryParseDateTime(StringReference s, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out DateTime dt) { if (s.Length > 0) { int i = s.StartIndex; if (s[i] == '/') { if (s.Length >= 9 && s.StartsWith("/Date(") && s.EndsWith(")/")) { if (TryParseDateTimeMicrosoft(s, dateTimeZoneHandling, out dt)) { return true; } } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[i]) && s[i + 10] == 'T') { if (TryParseDateTimeIso(s, dateTimeZoneHandling, out dt)) { return true; } } if (!string.IsNullOrEmpty(dateFormatString)) { if (TryParseDateTimeExact(s.ToString(), dateTimeZoneHandling, dateFormatString, culture, out dt)) { return true; } } } dt = default(DateTime); return false; }
internal static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { DateTimeParser dateTimeParser = new DateTimeParser(); if (!dateTimeParser.Parse(text)) { dt = null; return false; } DateTime d = new DateTime(dateTimeParser.Year, dateTimeParser.Month, dateTimeParser.Day, dateTimeParser.Hour, dateTimeParser.Minute, dateTimeParser.Second); d = d.AddTicks(dateTimeParser.Fraction); #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { TimeSpan offset; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: offset = new TimeSpan(0L); break; case ParserTimeZone.LocalWestOfUtc: offset = new TimeSpan(-dateTimeParser.ZoneHour, -dateTimeParser.ZoneMinute, 0); break; case ParserTimeZone.LocalEastOfUtc: offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); break; default: offset = TimeZoneInfo.Local.GetUtcOffset(d); break; } long ticks = d.Ticks - offset.Ticks; if (ticks < 0 || ticks > 3155378975999999999) { dt = null; return false; } dt = new DateTimeOffset(d, offset); return true; } else #endif { long ticks; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: d = new DateTime(d.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks + offset.Ticks; if (ticks <= DateTime.MaxValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks > DateTime.MaxValue.Ticks) ticks = DateTime.MaxValue.Ticks; d = new DateTime(ticks, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks - offset.Ticks; if (ticks >= DateTime.MinValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks < DateTime.MinValue.Ticks) ticks = DateTime.MinValue.Ticks; d = new DateTime(ticks, DateTimeKind.Local); } break; } } dt = EnsureDateTime(d, dateTimeZoneHandling); return true; } }
internal static bool TryParseDateTimeIso(StringReference text, DateTimeZoneHandling dateTimeZoneHandling, out DateTime dt) { var dateTimeParser = new DateTimeParser(); if (!dateTimeParser.Parse(text.Chars, text.StartIndex, text.Length)) { dt = default(DateTime); return(false); } var d = CreateDateTime(dateTimeParser); long ticks; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: d = new DateTime(d.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { var offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks + offset.Ticks; if (ticks <= DateTime.MaxValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks > DateTime.MaxValue.Ticks) { ticks = DateTime.MaxValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { var offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks - offset.Ticks; if (ticks >= DateTime.MinValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks < DateTime.MinValue.Ticks) { ticks = DateTime.MinValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } } dt = EnsureDateTime(d, dateTimeZoneHandling); return(true); }
internal static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { const string isoDateFormat = "yyyy-MM-ddTHH:mm:ss.FFFFFFFK"; #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { DateTimeOffset dateTimeOffset; if (DateTimeOffset.TryParseExact(text, isoDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTimeOffset)) { dt = dateTimeOffset; return(true); } } else #endif { DateTime dateTime; if (DateTime.TryParseExact(text, isoDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dateTime)) { dateTime = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); dt = dateTime; return(true); } } dt = null; return(false); }
public Dates(string format, DateTimeZoneHandling timeZoneHandling = DateTimeZoneHandling.RoundtripKind) { this.format = format; this.timeZoneHandling = timeZoneHandling; }
private void SetupReader([Nullable(1)] JsonReader reader, out CultureInfo previousCulture, out DateTimeZoneHandling?previousDateTimeZoneHandling, out DateParseHandling?previousDateParseHandling, out FloatParseHandling?previousFloatParseHandling, out int?previousMaxDepth, out string previousDateFormatString) { if (this._culture != null && !this._culture.Equals(reader.Culture)) { previousCulture = reader.Culture; reader.Culture = this._culture; } else { previousCulture = null; } if (this._dateTimeZoneHandling != null) { DateTimeZoneHandling dateTimeZoneHandling = reader.DateTimeZoneHandling; DateTimeZoneHandling?dateTimeZoneHandling2 = this._dateTimeZoneHandling; if (!(dateTimeZoneHandling == dateTimeZoneHandling2.GetValueOrDefault() & dateTimeZoneHandling2 != null)) { previousDateTimeZoneHandling = new DateTimeZoneHandling?(reader.DateTimeZoneHandling); reader.DateTimeZoneHandling = this._dateTimeZoneHandling.GetValueOrDefault(); goto IL_8C; } } previousDateTimeZoneHandling = null; IL_8C: if (this._dateParseHandling != null) { DateParseHandling dateParseHandling = reader.DateParseHandling; DateParseHandling?dateParseHandling2 = this._dateParseHandling; if (!(dateParseHandling == dateParseHandling2.GetValueOrDefault() & dateParseHandling2 != null)) { previousDateParseHandling = new DateParseHandling?(reader.DateParseHandling); reader.DateParseHandling = this._dateParseHandling.GetValueOrDefault(); goto IL_E6; } } previousDateParseHandling = null; IL_E6: if (this._floatParseHandling != null) { FloatParseHandling floatParseHandling = reader.FloatParseHandling; FloatParseHandling?floatParseHandling2 = this._floatParseHandling; if (!(floatParseHandling == floatParseHandling2.GetValueOrDefault() & floatParseHandling2 != null)) { previousFloatParseHandling = new FloatParseHandling?(reader.FloatParseHandling); reader.FloatParseHandling = this._floatParseHandling.GetValueOrDefault(); goto IL_140; } } previousFloatParseHandling = null; IL_140: if (this._maxDepthSet) { int?maxDepth = reader.MaxDepth; int?maxDepth2 = this._maxDepth; if (!(maxDepth.GetValueOrDefault() == maxDepth2.GetValueOrDefault() & maxDepth != null == (maxDepth2 != null))) { previousMaxDepth = reader.MaxDepth; reader.MaxDepth = this._maxDepth; goto IL_19D; } } previousMaxDepth = null; IL_19D: if (this._dateFormatStringSet && reader.DateFormatString != this._dateFormatString) { previousDateFormatString = reader.DateFormatString; reader.DateFormatString = this._dateFormatString; } else { previousDateFormatString = null; } JsonTextReader jsonTextReader = reader as JsonTextReader; if (jsonTextReader != null && jsonTextReader.PropertyNameTable == null) { DefaultContractResolver defaultContractResolver = this._contractResolver as DefaultContractResolver; if (defaultContractResolver != null) { jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable(); } } }
internal virtual void SerializeInternal([Nullable(1)] JsonWriter jsonWriter, object value, Type objectType) { ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter"); Formatting?formatting = null; if (this._formatting != null) { Formatting formatting2 = jsonWriter.Formatting; Formatting?formatting3 = this._formatting; if (!(formatting2 == formatting3.GetValueOrDefault() & formatting3 != null)) { formatting = new Formatting?(jsonWriter.Formatting); jsonWriter.Formatting = this._formatting.GetValueOrDefault(); } } DateFormatHandling?dateFormatHandling = null; if (this._dateFormatHandling != null) { DateFormatHandling dateFormatHandling2 = jsonWriter.DateFormatHandling; DateFormatHandling?dateFormatHandling3 = this._dateFormatHandling; if (!(dateFormatHandling2 == dateFormatHandling3.GetValueOrDefault() & dateFormatHandling3 != null)) { dateFormatHandling = new DateFormatHandling?(jsonWriter.DateFormatHandling); jsonWriter.DateFormatHandling = this._dateFormatHandling.GetValueOrDefault(); } } DateTimeZoneHandling?dateTimeZoneHandling = null; if (this._dateTimeZoneHandling != null) { DateTimeZoneHandling dateTimeZoneHandling2 = jsonWriter.DateTimeZoneHandling; DateTimeZoneHandling?dateTimeZoneHandling3 = this._dateTimeZoneHandling; if (!(dateTimeZoneHandling2 == dateTimeZoneHandling3.GetValueOrDefault() & dateTimeZoneHandling3 != null)) { dateTimeZoneHandling = new DateTimeZoneHandling?(jsonWriter.DateTimeZoneHandling); jsonWriter.DateTimeZoneHandling = this._dateTimeZoneHandling.GetValueOrDefault(); } } FloatFormatHandling?floatFormatHandling = null; if (this._floatFormatHandling != null) { FloatFormatHandling floatFormatHandling2 = jsonWriter.FloatFormatHandling; FloatFormatHandling?floatFormatHandling3 = this._floatFormatHandling; if (!(floatFormatHandling2 == floatFormatHandling3.GetValueOrDefault() & floatFormatHandling3 != null)) { floatFormatHandling = new FloatFormatHandling?(jsonWriter.FloatFormatHandling); jsonWriter.FloatFormatHandling = this._floatFormatHandling.GetValueOrDefault(); } } StringEscapeHandling?stringEscapeHandling = null; if (this._stringEscapeHandling != null) { StringEscapeHandling stringEscapeHandling2 = jsonWriter.StringEscapeHandling; StringEscapeHandling?stringEscapeHandling3 = this._stringEscapeHandling; if (!(stringEscapeHandling2 == stringEscapeHandling3.GetValueOrDefault() & stringEscapeHandling3 != null)) { stringEscapeHandling = new StringEscapeHandling?(jsonWriter.StringEscapeHandling); jsonWriter.StringEscapeHandling = this._stringEscapeHandling.GetValueOrDefault(); } } CultureInfo cultureInfo = null; if (this._culture != null && !this._culture.Equals(jsonWriter.Culture)) { cultureInfo = jsonWriter.Culture; jsonWriter.Culture = this._culture; } string dateFormatString = null; if (this._dateFormatStringSet && jsonWriter.DateFormatString != this._dateFormatString) { dateFormatString = jsonWriter.DateFormatString; jsonWriter.DateFormatString = this._dateFormatString; } TraceJsonWriter traceJsonWriter = (this.TraceWriter == null || this.TraceWriter.LevelFilter < TraceLevel.Verbose) ? null : new TraceJsonWriter(jsonWriter); new JsonSerializerInternalWriter(this).Serialize(traceJsonWriter ?? jsonWriter, value, objectType); if (traceJsonWriter != null) { this.TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null); } if (formatting != null) { jsonWriter.Formatting = formatting.GetValueOrDefault(); } if (dateFormatHandling != null) { jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault(); } if (dateTimeZoneHandling != null) { jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault(); } if (floatFormatHandling != null) { jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault(); } if (stringEscapeHandling != null) { jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault(); } if (this._dateFormatStringSet) { jsonWriter.DateFormatString = dateFormatString; } if (cultureInfo != null) { jsonWriter.Culture = cultureInfo; } }
internal static bool smethod_12(string string_0, DateParseHandling dateParseHandling_0, DateTimeZoneHandling dateTimeZoneHandling_0, out object object_0) { Struct26 struct2 = new Struct26(); if (!struct2.method_0(string_0)) { object_0 = null; return(false); } DateTime time = new DateTime(struct2.int_0, struct2.int_1, struct2.int_2, struct2.int_3, struct2.int_4, struct2.int_5); time = time.AddTicks((long)struct2.int_6); if (dateParseHandling_0 != DateParseHandling.DateTimeOffset) { long ticks; switch (struct2.enum13_0) { case Enum13.Utc: time = new DateTime(time.Ticks, DateTimeKind.Utc); break; case Enum13.LocalWestOfUtc: { TimeSpan span2 = new TimeSpan(struct2.int_7, struct2.int_8, 0); ticks = time.Ticks + span2.Ticks; if (ticks > DateTime.MaxValue.Ticks) { ticks += time.smethod_0().Ticks; if (ticks > DateTime.MaxValue.Ticks) { ticks = DateTime.MaxValue.Ticks; } time = new DateTime(ticks, DateTimeKind.Local); break; } time = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); break; } case Enum13.LocalEastOfUtc: { TimeSpan span3 = new TimeSpan(struct2.int_7, struct2.int_8, 0); ticks = time.Ticks - span3.Ticks; if (ticks < DateTime.MinValue.Ticks) { ticks += time.smethod_0().Ticks; if (ticks < DateTime.MinValue.Ticks) { ticks = DateTime.MinValue.Ticks; } time = new DateTime(ticks, DateTimeKind.Local); break; } time = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); break; } } } else { TimeSpan utcOffset; switch (struct2.enum13_0) { case Enum13.Utc: utcOffset = new TimeSpan(0L); break; case Enum13.LocalWestOfUtc: utcOffset = new TimeSpan(-struct2.int_7, -struct2.int_8, 0); break; case Enum13.LocalEastOfUtc: utcOffset = new TimeSpan(struct2.int_7, struct2.int_8, 0); break; default: utcOffset = TimeZoneInfo.Local.GetUtcOffset(time); break; } long num = time.Ticks - utcOffset.Ticks; if ((num >= 0L) && (num <= 0x2bca2875f4373fffL)) { object_0 = new DateTimeOffset(time, utcOffset); return(true); } object_0 = null; return(false); } object_0 = smethod_2(time, dateTimeZoneHandling_0); return(true); }
internal static bool TryParseDateTime(string s, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { if (s.Length > 0) { if (s[0] == '/') { if (s.StartsWith("/Date(", StringComparison.Ordinal) && s.EndsWith(")/", StringComparison.Ordinal)) { if (TryParseDateMicrosoft(s, dateParseHandling, dateTimeZoneHandling, out dt)) return true; } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[0]) && s[10] == 'T') { if (TryParseDateIso(s, dateParseHandling, dateTimeZoneHandling, out dt)) return true; } if (!string.IsNullOrEmpty(dateFormatString)) { if (TryParseDateExact(s, dateParseHandling, dateTimeZoneHandling, dateFormatString, culture, out dt)) return true; } } dt = null; return false; }
/// <summary> /// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>. /// </summary> protected JsonReader() { _currentState = State.Start; _stack = new List<JsonPosition>(4); _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; _dateParseHandling = DateParseHandling.DateTime; _floatParseHandling = FloatParseHandling.PreferDecimalFallbackToDouble; CloseInput = true; }
private static string TestDateTimeFormat <T>(T value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling) { string date = null; if (value is DateTime) { date = JsonConvert.ToString((DateTime)(object)value, format, timeZoneHandling); } else { #if !NET20 date = JsonConvert.ToString((DateTimeOffset)(object)value, format); #endif } Console.WriteLine(format.ToString("g") + "-" + timeZoneHandling.ToString("g") + ": " + date); if (timeZoneHandling == DateTimeZoneHandling.RoundtripKind) { T parsed = JsonConvert.DeserializeObject <T>(date); try { Assert.AreEqual(value, parsed); } catch (Exception) { long valueTicks = GetTicks(value); long parsedTicks = GetTicks(parsed); valueTicks = (valueTicks / 10000) * 10000; Assert.AreEqual(valueTicks, parsedTicks); } } return(date.Trim('"')); }
private static bool TryParseDateMicrosoft(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { string value = text.Substring(6, text.Length - 8); DateTimeKind kind = DateTimeKind.Utc; int index = value.IndexOf('+', 1); if (index == -1) index = value.IndexOf('-', 1); TimeSpan offset = TimeSpan.Zero; if (index != -1) { kind = DateTimeKind.Local; offset = ReadOffset(value.Substring(index)); value = value.Substring(0, index); } long javaScriptTicks = long.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture); DateTime utcDateTime = ConvertJavaScriptTicksToDateTime(javaScriptTicks); #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { dt = new DateTimeOffset(utcDateTime.Add(offset).Ticks, offset); return true; } else #endif { DateTime dateTime; switch (kind) { case DateTimeKind.Unspecified: dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); break; case DateTimeKind.Local: dateTime = utcDateTime.ToLocalTime(); break; default: dateTime = utcDateTime; break; } dt = EnsureDateTime(dateTime, dateTimeZoneHandling); return true; } }
internal static bool TryParseDateTime(string s, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { if (s.Length > 0) { if (s[0] == '/') { if (s.StartsWith("/Date(", StringComparison.Ordinal) && s.EndsWith(")/", StringComparison.Ordinal)) { return(TryParseDateMicrosoft(s, dateParseHandling, dateTimeZoneHandling, out dt)); } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[0]) && s[10] == 'T') { return(TryParseDateIso(s, dateParseHandling, dateTimeZoneHandling, out dt)); } } dt = null; return(false); }
private static bool TryParseDateTimeMicrosoft(StringReference text, DateTimeZoneHandling dateTimeZoneHandling, out DateTime dt) { long ticks; TimeSpan offset; DateTimeKind kind; if (!TryParseMicrosoftDate(text, out ticks, out offset, out kind)) { dt = default(DateTime); return false; } DateTime utcDateTime = ConvertJavaScriptTicksToDateTime(ticks); switch (kind) { case DateTimeKind.Unspecified: dt = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); break; case DateTimeKind.Local: dt = utcDateTime.ToLocalTime(); break; default: dt = utcDateTime; break; } dt = EnsureDateTime(dt, dateTimeZoneHandling); return true; }
public static bool TryParseDateTime(StringReference s, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out DateTime dt) { return(Api.TryParseDateTime(s, dateTimeZoneHandling, dateFormatString, culture, out dt)); }
private static bool smethod_14(string string_0, DateParseHandling dateParseHandling_0, DateTimeZoneHandling dateTimeZoneHandling_0, out object object_0) { DateTime time2; string s = string_0.Substring(6, string_0.Length - 8); DateTimeKind utc = DateTimeKind.Utc; int index = s.IndexOf('+', 1); if (index == -1) { index = s.IndexOf('-', 1); } TimeSpan zero = TimeSpan.Zero; if (index != -1) { utc = DateTimeKind.Local; zero = smethod_15(s.Substring(index)); s = s.Substring(0, index); } DateTime time = smethod_11(long.Parse(s, NumberStyles.Integer, CultureInfo.InvariantCulture)); if (dateParseHandling_0 == DateParseHandling.DateTimeOffset) { object_0 = new DateTimeOffset(time.Add(zero).Ticks, zero); return(true); } switch (utc) { case DateTimeKind.Unspecified: time2 = DateTime.SpecifyKind(time.ToLocalTime(), DateTimeKind.Unspecified); break; case DateTimeKind.Local: time2 = time.ToLocalTime(); break; default: time2 = time; break; } object_0 = smethod_2(time2, dateTimeZoneHandling_0); return(true); }
public static bool TryParseDateTimeExact(string text, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out DateTime dt) { return(Api.TryParseDateTimeExact(text, dateTimeZoneHandling, dateFormatString, culture, out dt)); }
// Token: 0x06000D21 RID: 3361 // RVA: 0x0004A63C File Offset: 0x0004883C private static bool TryParseDateMicrosoft(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { string text2 = text.Substring(6, text.Length - 8); DateTimeKind dateTimeKind = DateTimeKind.Utc; int num = text2.IndexOf('+', 1); if (num == -1) { num = text2.IndexOf('-', 1); } if (num != -1) { dateTimeKind = DateTimeKind.Local; text2 = text2.Substring(0, num); } long javaScriptTicks; if (!long.TryParse(text2, NumberStyles.Integer, CultureInfo.InvariantCulture, out javaScriptTicks)) { dt = null; return false; } DateTime dateTime = DateTimeUtils.ConvertJavaScriptTicksToDateTime(javaScriptTicks); DateTime value; switch (dateTimeKind) { case DateTimeKind.Unspecified: value = DateTime.SpecifyKind(dateTime.ToLocalTime(), DateTimeKind.Unspecified); goto IL_8E; case DateTimeKind.Local: value = dateTime.ToLocalTime(); goto IL_8E; } value = dateTime; IL_8E: dt = DateTimeUtils.EnsureDateTime(value, dateTimeZoneHandling); return true; }
public static DateTime EnsureDateTime(DateTime value, DateTimeZoneHandling timeZone) { return(Api.EnsureDateTime(value, timeZone)); }
private static bool TryParseDateMicrosoft(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { string value = text.Substring(6, text.Length - 8); DateTimeKind kind = DateTimeKind.Utc; int index = value.IndexOf('+', 1); if (index == -1) index = value.IndexOf('-', 1); if (index != -1) { kind = DateTimeKind.Local; value = value.Substring(0, index); } long javaScriptTicks; if (!long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out javaScriptTicks)) { dt = null; return false; } DateTime utcDateTime = ConvertJavaScriptTicksToDateTime(javaScriptTicks); DateTime dateTime; switch (kind) { case DateTimeKind.Unspecified: dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); break; case DateTimeKind.Local: dateTime = utcDateTime.ToLocalTime(); break; default: dateTime = utcDateTime; break; } dt = EnsureDateTime(dateTime, dateTimeZoneHandling); return true; }
public static bool TryParseDateTimeIso(StringReference text, DateTimeZoneHandling dateTimeZoneHandling, out DateTime dt) { return(Api.TryParseDateTimeIso(text, dateTimeZoneHandling, out dt)); }
/// <summary> /// Converts the <see cref="DateTime"/> to its JSON string representation using the <see cref="DateFormatHandling"/> specified. /// </summary> /// <param name="value">The value to convert.</param> /// <param name="format">The format the date will be converted to.</param> /// <param name="timeZoneHandling">The time zone handling when the date is converted to a string.</param> /// <returns>A JSON string representation of the <see cref="DateTime"/>.</returns> public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling) { DateTime updatedDateTime = DateTimeUtils.EnsureDateTime(value, timeZoneHandling); using (StringWriter writer = StringUtils.CreateStringWriter(64)) { writer.Write('"'); DateTimeUtils.WriteDateTimeString(writer, updatedDateTime, format, null, CultureInfo.InvariantCulture); writer.Write('"'); return writer.ToString(); } }
private static bool TryParseDateExact(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { { DateTime temp; if (DateTime.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out temp)) { temp = EnsureDateTime(temp, dateTimeZoneHandling); dt = temp; return(true); } } dt = null; return(false); }
/// <summary> /// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>. /// </summary> protected JsonReader() { _currentState = State.Start; _stack = new List<JsonPosition>(4); _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; _dateParseHandling = DateParseHandling.DateTime; CloseInput = true; }
public static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { DateTimeParser dateTimeParser = default(DateTimeParser); if (!dateTimeParser.Parse(text)) { dt = null; return(false); } DateTime dateTime = new DateTime(dateTimeParser.Year, dateTimeParser.Month, dateTimeParser.Day, dateTimeParser.Hour, dateTimeParser.Minute, dateTimeParser.Second); dateTime = dateTime.AddTicks((long)dateTimeParser.Fraction); if (dateParseHandling != DateParseHandling.DateTimeOffset) { switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: dateTime = new DateTime(dateTime.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { TimeSpan timeSpan = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); long num = dateTime.Ticks + timeSpan.Ticks; if (num <= DateTime.MaxValue.Ticks) { dateTime = new DateTime(num, DateTimeKind.Utc).ToLocalTime(); } else { num += dateTime.GetUtcOffset().Ticks; if (num > DateTime.MaxValue.Ticks) { num = DateTime.MaxValue.Ticks; } dateTime = new DateTime(num, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { TimeSpan timeSpan2 = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); long num = dateTime.Ticks - timeSpan2.Ticks; if (num >= DateTime.MinValue.Ticks) { dateTime = new DateTime(num, DateTimeKind.Utc).ToLocalTime(); } else { num += dateTime.GetUtcOffset().Ticks; if (num < DateTime.MinValue.Ticks) { num = DateTime.MinValue.Ticks; } dateTime = new DateTime(num, DateTimeKind.Local); } break; } } dt = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); return(true); } TimeSpan utcOffset; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: utcOffset = new TimeSpan(0L); break; case ParserTimeZone.LocalWestOfUtc: utcOffset = new TimeSpan(-dateTimeParser.ZoneHour, -dateTimeParser.ZoneMinute, 0); break; case ParserTimeZone.LocalEastOfUtc: utcOffset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); break; default: utcOffset = TimeZoneInfo.Local.GetUtcOffset(dateTime); break; } long num2 = dateTime.Ticks - utcOffset.Ticks; if (num2 < 0L || num2 > 3155378975999999999L) { dt = null; return(false); } dt = new DateTimeOffset(dateTime, utcOffset); return(true); }
private static bool TryParseDateExact(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { DateTimeOffset temp; if (DateTimeOffset.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out temp)) { dt = temp; return true; } } else #endif { DateTime temp; if (DateTime.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out temp)) { temp = EnsureDateTime(temp, dateTimeZoneHandling); dt = temp; return true; } } dt = null; return false; }
public static bool TryParseDateMicrosoft(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { string text2 = text.Substring(6, text.Length - 8); DateTimeKind dateTimeKind = DateTimeKind.Utc; int num = text2.IndexOf('+', 1); if (num == -1) { num = text2.IndexOf('-', 1); } TimeSpan timeSpan = TimeSpan.Zero; if (num != -1) { dateTimeKind = DateTimeKind.Local; timeSpan = DateTimeUtils.ReadOffset(text2.Substring(num)); text2 = text2.Substring(0, num); } long javaScriptTicks; if (!long.TryParse(text2, NumberStyles.Integer, CultureInfo.InvariantCulture, out javaScriptTicks)) { dt = null; return(false); } DateTime dateTime = DateTimeUtils.ConvertJavaScriptTicksToDateTime(javaScriptTicks); if (dateParseHandling == DateParseHandling.DateTimeOffset) { dt = new DateTimeOffset(dateTime.Add(timeSpan).Ticks, timeSpan); return(true); } DateTime value; switch (dateTimeKind) { case DateTimeKind.Unspecified: value = DateTime.SpecifyKind(dateTime.ToLocalTime(), DateTimeKind.Unspecified); goto IL_C6; case DateTimeKind.Local: value = dateTime.ToLocalTime(); goto IL_C6; } value = dateTime; IL_C6: dt = DateTimeUtils.EnsureDateTime(value, dateTimeZoneHandling); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="JsonReader"/> class with the specified <see cref="TextReader"/>. /// </summary> protected JsonReader() { _currentState = State.Start; _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; _dateParseHandling = DateParseHandling.DateTime; _floatParseHandling = FloatParseHandling.Double; CloseInput = true; }
public static bool TryParseDateExact(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { DateTime dateTime; if (dateParseHandling == DateParseHandling.DateTimeOffset) { DateTimeOffset dateTimeOffset; if (DateTimeOffset.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out dateTimeOffset)) { dt = dateTimeOffset; return(true); } } else if (DateTime.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out dateTime)) { dateTime = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); dt = dateTime; return(true); } dt = null; return(false); }
internal static bool TryParseDateTime(string s, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { if (s.Length > 0) { if (s[0] == '/') { if (s.StartsWith("/Date(", StringComparison.Ordinal) && s.EndsWith(")/", StringComparison.Ordinal)) { return TryParseDateMicrosoft(s, dateParseHandling, dateTimeZoneHandling, out dt); } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[0]) && s[10] == 'T') { return TryParseDateIso(s, dateParseHandling, dateTimeZoneHandling, out dt); } } dt = null; return false; }
internal static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { DateTimeParser dateTimeParser = new DateTimeParser(); if (!dateTimeParser.Parse(text)) { dt = null; return(false); } DateTime d = new DateTime(dateTimeParser.Year, dateTimeParser.Month, dateTimeParser.Day, dateTimeParser.Hour, dateTimeParser.Minute, dateTimeParser.Second); d = d.AddTicks(dateTimeParser.Fraction); #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { TimeSpan offset; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: offset = new TimeSpan(0L); break; case ParserTimeZone.LocalWestOfUtc: offset = new TimeSpan(-dateTimeParser.ZoneHour, -dateTimeParser.ZoneMinute, 0); break; case ParserTimeZone.LocalEastOfUtc: offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); break; default: offset = TimeZoneInfo.Local.GetUtcOffset(d); break; } long ticks = d.Ticks - offset.Ticks; if (ticks < 0 || ticks > 3155378975999999999) { dt = null; return(false); } dt = new DateTimeOffset(d, offset); return(true); } else #endif { long ticks; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: d = new DateTime(d.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks + offset.Ticks; if (ticks <= DateTime.MaxValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks > DateTime.MaxValue.Ticks) { ticks = DateTime.MaxValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks - offset.Ticks; if (ticks >= DateTime.MinValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks < DateTime.MinValue.Ticks) { ticks = DateTime.MinValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } } dt = EnsureDateTime(d, dateTimeZoneHandling); return(true); } }
internal static bool TryParseDateTimeIso(StringReference text, DateTimeZoneHandling dateTimeZoneHandling, out DateTime dt) { DateTimeParser dateTimeParser = new DateTimeParser(); if (!dateTimeParser.Parse(text.Chars, text.StartIndex, text.Length)) { dt = default(DateTime); return false; } DateTime d = CreateDateTime(dateTimeParser); long ticks; switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: d = new DateTime(d.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks + offset.Ticks; if (ticks <= DateTime.MaxValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks > DateTime.MaxValue.Ticks) { ticks = DateTime.MaxValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { TimeSpan offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); ticks = d.Ticks - offset.Ticks; if (ticks >= DateTime.MinValue.Ticks) { d = new DateTime(ticks, DateTimeKind.Utc).ToLocalTime(); } else { ticks += d.GetUtcOffset().Ticks; if (ticks < DateTime.MinValue.Ticks) { ticks = DateTime.MinValue.Ticks; } d = new DateTime(ticks, DateTimeKind.Local); } break; } } dt = EnsureDateTime(d, dateTimeZoneHandling); return true; }
internal static bool TryParseDateTime(string s, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out object dt) { if (s.Length > 0) { if (s[0] == '/') { if (s.StartsWith("/Date(", StringComparison.Ordinal) && s.EndsWith(")/", StringComparison.Ordinal)) { if (TryParseDateMicrosoft(s, dateParseHandling, dateTimeZoneHandling, out dt)) { return(true); } } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[0]) && s[10] == 'T') { if (TryParseDateIso(s, dateParseHandling, dateTimeZoneHandling, out dt)) { return(true); } } if (!string.IsNullOrEmpty(dateFormatString)) { if (TryParseDateExact(s, dateParseHandling, dateTimeZoneHandling, dateFormatString, culture, out dt)) { return(true); } } } dt = null; return(false); }
internal static bool TryParseDateTime(string s, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out DateTime dt) { if (s.Length > 0) { if (s[0] == '/') { if (s.Length >= 9 && s.StartsWith("/Date(", StringComparison.Ordinal) && s.EndsWith(")/", StringComparison.Ordinal)) { if (TryParseDateTimeMicrosoft(new StringReference(s.ToCharArray(), 0, s.Length), dateTimeZoneHandling, out dt)) { return true; } } } else if (s.Length >= 19 && s.Length <= 40 && char.IsDigit(s[0]) && s[10] == 'T') { if (DateTime.TryParseExact(s, IsoDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dt)) { dt = EnsureDateTime(dt, dateTimeZoneHandling); return true; } } if (!string.IsNullOrEmpty(dateFormatString)) { if (TryParseDateTimeExact(s, dateTimeZoneHandling, dateFormatString, culture, out dt)) { return true; } } } dt = default(DateTime); return false; }
private static bool TryParseDateMicrosoft(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { string value = text.Substring(6, text.Length - 8); DateTimeKind kind = DateTimeKind.Utc; int index = value.IndexOf('+', 1); if (index == -1) { index = value.IndexOf('-', 1); } #if !NET20 TimeSpan offset = TimeSpan.Zero; #endif if (index != -1) { kind = DateTimeKind.Local; #if !NET20 offset = ReadOffset(value.Substring(index)); #endif value = value.Substring(0, index); } long javaScriptTicks; if (!long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out javaScriptTicks)) { dt = null; return(false); } DateTime utcDateTime = ConvertJavaScriptTicksToDateTime(javaScriptTicks); #if !NET20 if (dateParseHandling == DateParseHandling.DateTimeOffset) { dt = new DateTimeOffset(utcDateTime.Add(offset).Ticks, offset); return(true); } #endif DateTime dateTime; switch (kind) { case DateTimeKind.Unspecified: dateTime = DateTime.SpecifyKind(utcDateTime.ToLocalTime(), DateTimeKind.Unspecified); break; case DateTimeKind.Local: dateTime = utcDateTime.ToLocalTime(); break; default: dateTime = utcDateTime; break; } dt = EnsureDateTime(dateTime, dateTimeZoneHandling); return(true); }
private static bool TryParseDateTimeExact(string text, DateTimeZoneHandling dateTimeZoneHandling, string dateFormatString, CultureInfo culture, out DateTime dt) { DateTime temp; if (DateTime.TryParseExact(text, dateFormatString, culture, DateTimeStyles.RoundtripKind, out temp)) { temp = EnsureDateTime(temp, dateTimeZoneHandling); dt = temp; return true; } dt = default(DateTime); return false; }
// Token: 0x06000D1F RID: 3359 // RVA: 0x0004A3D4 File Offset: 0x000485D4 internal static bool TryParseDateIso(string text, DateParseHandling dateParseHandling, DateTimeZoneHandling dateTimeZoneHandling, out object dt) { DateTimeParser dateTimeParser = default(DateTimeParser); if (!dateTimeParser.Parse(text)) { dt = null; return false; } DateTime dateTime = new DateTime(dateTimeParser.Year, dateTimeParser.Month, dateTimeParser.Day, dateTimeParser.Hour, dateTimeParser.Minute, dateTimeParser.Second); dateTime = dateTime.AddTicks((long)dateTimeParser.Fraction); switch (dateTimeParser.Zone) { case ParserTimeZone.Utc: dateTime = new DateTime(dateTime.Ticks, DateTimeKind.Utc); break; case ParserTimeZone.LocalWestOfUtc: { TimeSpan timeSpan = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); long num = dateTime.Ticks + timeSpan.Ticks; if (num <= DateTime.MaxValue.Ticks) { dateTime = new DateTime(num, DateTimeKind.Utc).ToLocalTime(); } else { num += DateTimeUtils.GetUtcOffset(dateTime).Ticks; if (num > DateTime.MaxValue.Ticks) { num = DateTime.MaxValue.Ticks; } dateTime = new DateTime(num, DateTimeKind.Local); } break; } case ParserTimeZone.LocalEastOfUtc: { TimeSpan timeSpan2 = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0); long num = dateTime.Ticks - timeSpan2.Ticks; if (num >= DateTime.MinValue.Ticks) { dateTime = new DateTime(num, DateTimeKind.Utc).ToLocalTime(); } else { num += DateTimeUtils.GetUtcOffset(dateTime).Ticks; if (num < DateTime.MinValue.Ticks) { num = DateTime.MinValue.Ticks; } dateTime = new DateTime(num, DateTimeKind.Local); } break; } } dt = DateTimeUtils.EnsureDateTime(dateTime, dateTimeZoneHandling); return true; }
/// <summary> /// Creates an instance of the <c>JsonWriter</c> class. /// </summary> protected JsonWriter() { _stack = new List<JsonPosition>(4); _currentState = State.Start; _formatting = Formatting.None; _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; CloseOutput = true; }
internal static bool smethod_13(string string_0, DateParseHandling dateParseHandling_0, DateTimeZoneHandling dateTimeZoneHandling_0, out object object_0) { if (string_0.Length > 0) { if (string_0[0] == '/') { if (string_0.StartsWith("/Date(", StringComparison.Ordinal) && string_0.EndsWith(")/", StringComparison.Ordinal)) { return(smethod_14(string_0, dateParseHandling_0, dateTimeZoneHandling_0, out object_0)); } } else if (((string_0.Length >= 0x13) && (string_0.Length <= 40)) && (char.IsDigit(string_0[0]) && (string_0[10] == 'T'))) { return(smethod_12(string_0, dateParseHandling_0, dateTimeZoneHandling_0, out object_0)); } } object_0 = null; return(false); }