// Token: 0x060015EC RID: 5612 RVA: 0x000411D8 File Offset: 0x0003F3D8
        internal static string Format(DateTime dateTime, string format, DateTimeFormatInfo dtfi, TimeSpan offset)
        {
            if (format == null || format.Length == 0)
            {
                bool flag = false;
                if (dateTime.Ticks < 864000000000L)
                {
                    int id = dtfi.Calendar.ID;
                    switch (id)
                    {
                    case 3:
                    case 4:
                    case 6:
                    case 8:
                        break;

                    case 5:
                    case 7:
                        goto IL_63;

                    default:
                        if (id != 13 && id - 22 > 1)
                        {
                            goto IL_63;
                        }
                        break;
                    }
                    flag = true;
                    dtfi = DateTimeFormatInfo.InvariantInfo;
                }
IL_63:
                if (offset == DateTimeFormat.NullOffset)
                {
                    if (flag)
                    {
                        format = "s";
                    }
                    else
                    {
                        format = "G";
                    }
                }
                else if (flag)
                {
                    format = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
                }
                else
                {
                    format = dtfi.DateTimeOffsetPattern;
                }
            }
            if (format.Length == 1)
            {
                char c = format[0];
                if (c <= 'R')
                {
                    if (c != 'O')
                    {
                        if (c != 'R')
                        {
                            goto IL_E2;
                        }
                        goto IL_D4;
                    }
                }
                else if (c != 'o')
                {
                    if (c != 'r')
                    {
                        goto IL_E2;
                    }
                    goto IL_D4;
                }
                return(StringBuilderCache.GetStringAndRelease(DateTimeFormat.FastFormatRoundtrip(dateTime, offset)));

IL_D4:
                return(StringBuilderCache.GetStringAndRelease(DateTimeFormat.FastFormatRfc1123(dateTime, offset, dtfi)));

IL_E2:
                format = DateTimeFormat.ExpandPredefinedFormat(format, ref dateTime, ref dtfi, ref offset);
            }
            return(DateTimeFormat.FormatCustomized(dateTime, format, dtfi, offset));
        }