private void FormatObjectMembersRecursive(
                List <CommonObjectFormatter.Visitor.FormattedMember> result,
                object obj)
            {
                List <MemberInfo> memberInfoList = new List <MemberInfo>();
                Type baseType;

                for (System.Reflection.TypeInfo typeInfo = IntrospectionExtensions.GetTypeInfo(obj.GetType());
                     typeInfo != null;
                     typeInfo = (object)baseType != null ? IntrospectionExtensions.GetTypeInfo(baseType) : null)
                {
                    memberInfoList.AddRange(Enumerable.Where <FieldInfo>(typeInfo.DeclaredFields, f => !f.IsStatic));
                    memberInfoList.AddRange(Enumerable.Where <PropertyInfo>(typeInfo.DeclaredProperties, f =>
                    {
                        if ((object)f.GetMethod != null)
                        {
                            return(!f.GetMethod.IsStatic);
                        }
                        return(false);
                    }));
                    baseType = typeInfo.BaseType;
                }
                memberInfoList.Sort((x, y) =>
                {
                    int num = StringComparer.OrdinalIgnoreCase.Compare(x.Name, y.Name);
                    if (num == 0)
                    {
                        num = StringComparer.Ordinal.Compare(x.Name, y.Name);
                    }
                    return(num);
                });
                foreach (MemberInfo member in memberInfoList)
                {
                    bool flag1 = false;
                    bool flag2 = false;
                    if (member is FieldInfo fieldInfo)
                    {
                        if (!(flag2) && !fieldInfo.IsPublic && (!fieldInfo.IsFamily && !fieldInfo.IsFamilyOrAssembly))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        PropertyInfo propertyInfo = (PropertyInfo)member;
                        MethodInfo   getMethod    = propertyInfo.GetMethod;
                        if ((object)getMethod != null)
                        {
                            MethodInfo setMethod = propertyInfo.SetMethod;
                            if (!(flag2) && !getMethod.IsPublic && (!getMethod.IsFamily && !getMethod.IsFamilyOrAssembly) && ((object)setMethod == null || !setMethod.IsPublic && !setMethod.IsFamily && !setMethod.IsFamilyOrAssembly) || getMethod.GetParameters().Length != 0)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    Exception exception;
                    object    memberValue = ObjectFormatterHelpers.GetMemberValue(member, obj, out exception);
                    if (exception != null)
                    {
                        CommonObjectFormatter.Builder result1 = new Builder();
                        this.FormatException(result1, exception);
                        if (!this.AddMember(result, new CommonObjectFormatter.Visitor.FormattedMember(-1, member.Name, result1.ToString())))
                        {
                            break;
                        }
                    }
                    else if (flag1)
                    {
                        if (memberValue != null && !this.VisitedObjects.Contains(memberValue))
                        {
                            if (memberValue is Array array)
                            {
                                int index = 0;
                                foreach (object obj1 in array)
                                {
                                    CommonObjectFormatter.Builder result1 = new Builder();
                                    this.FormatObjectRecursive(result1, obj1, false);
                                    if (!this.AddMember(result, new CommonObjectFormatter.Visitor.FormattedMember(index, "", result1.ToString())))
                                    {
                                        return;
                                    }
                                    ++index;
                                }
                            }
                            else if (this._formatter.PrimitiveFormatter.FormatPrimitive(memberValue, this._primitiveOptions) == null && this.VisitedObjects.Add(memberValue))
                            {
                                this.FormatObjectMembersRecursive(result, memberValue);
                                this.VisitedObjects.Remove(memberValue);
                            }
                        }
                    }
                    else
                    {
                        CommonObjectFormatter.Builder result1 = new Builder();
                        this.FormatObjectRecursive(result1, memberValue, false);
                        if (!this.AddMember(result, new CommonObjectFormatter.Visitor.FormattedMember(-1, "", result1.ToString())))
                        {
                            break;
                        }
                    }
                }
            }