public static bool TryGetDateFromConstructorJson(JsonReader reader, out DateTime dateTime, out string errorMessage) { long?nullable; long?nullable1; long?nullable2; dateTime = new DateTime(); errorMessage = null; if (!JavaScriptUtils.TryGetDateConstructorValue(reader, out nullable, out errorMessage) || !nullable.HasValue) { errorMessage = errorMessage ?? "Date constructor has no arguments."; return(false); } if (!JavaScriptUtils.TryGetDateConstructorValue(reader, out nullable1, out errorMessage)) { return(false); } if (!nullable1.HasValue) { dateTime = DateTimeUtils.ConvertJavaScriptTicksToDateTime(nullable.Value); } else { List <long> nums = new List <long>() { nullable.Value, nullable1.Value }; while (JavaScriptUtils.TryGetDateConstructorValue(reader, out nullable2, out errorMessage)) { if (!nullable2.HasValue) { if (nums.Count > 7) { errorMessage = "Unexpected number of arguments when reading date constructor."; return(false); } while (nums.Count < 7) { nums.Add(0L); } dateTime = new DateTime((int)nums[0], (int)nums[1] + 1, (nums[2] == 0 ? 1 : (int)nums[2]), (int)nums[3], (int)nums[4], (int)nums[5], (int)nums[6]); return(true); } else { nums.Add(nullable2.Value); } } return(false); } return(true); }
// Token: 0x06000DDA RID: 3546 RVA: 0x00050B24 File Offset: 0x0004ED24 public static bool TryGetDateFromConstructorJson(JsonReader reader, out DateTime dateTime, [Nullable(2), NotNullWhen(false)] out string errorMessage) { dateTime = default(DateTime); errorMessage = null; long?num; if (!JavaScriptUtils.TryGetDateConstructorValue(reader, out num, out errorMessage) || num == null) { errorMessage = (errorMessage ?? "Date constructor has no arguments."); return(false); } long?num2; if (!JavaScriptUtils.TryGetDateConstructorValue(reader, out num2, out errorMessage)) { return(false); } if (num2 != null) { List <long> list = new List <long> { num.Value, num2.Value }; long?num3; while (JavaScriptUtils.TryGetDateConstructorValue(reader, out num3, out errorMessage)) { if (num3 != null) { list.Add(num3.Value); } else { if (list.Count > 7) { errorMessage = "Unexpected number of arguments when reading date constructor."; return(false); } while (list.Count < 7) { list.Add(0L); } dateTime = new DateTime((int)list[0], (int)list[1] + 1, (list[2] == 0L) ? 1 : ((int)list[2]), (int)list[3], (int)list[4], (int)list[5], (int)list[6]); return(true); } } return(false); } dateTime = DateTimeUtils.ConvertJavaScriptTicksToDateTime(num.Value); return(true); }