Esempio n. 1
0
        private void LayoutInstanceFields(HtmlWriter writer, Type type)
        {
            var instanceFields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(instanceFields, (lhs, rhs) => ReflectionHelper.CompareFields(type, lhs, rhs));
            int split = instanceFields.Length;

            for (int i = 0; i < instanceFields.Length; i++)
            {
                if (instanceFields[i].DeclaringType != type)
                {
                    split = i;
                    break;
                }
            }
            writer.Inline("h4", "Instance Fields");
            if (split > 0)
            {
                LayoutFields(writer, ArrayView(instanceFields, 0, split));
            }
            writer.Inline("h4", "Inherited Fields");
            if (split < instanceFields.Length)
            {
                LayoutFields(writer, ArrayView(instanceFields, split));
            }
        }
        private void LayoutInstanceFields(HtmlWriter writer, Type type)
        {
            var instanceFields = type.GetFields(k_AllInstanceBindings);

            if (instanceFields.Length == 0)
            {
                return;
            }
            Array.Sort(instanceFields, (lhs, rhs) => ReflectionHelper.CompareFields(type, lhs, rhs));
            int split = instanceFields.Length;

            for (int i = 0; i < instanceFields.Length; i++)
            {
                if (instanceFields[i].DeclaringType != type)
                {
                    split = i;
                    break;
                }
            }

            if (split > 0)
            {
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Instance fields");
                    LayoutFields(writer, ArrayView(instanceFields, 0, split));
                }
            }

            if (split < instanceFields.Length)
            {
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Inherited fields");
                    LayoutFields(writer, ArrayView(instanceFields, split));
                }
            }
        }
Esempio n. 3
0
        private void InspectClass(HtmlWriter writer, Type type)
        {
            var instanceCtors = type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(instanceCtors, (lhs, rhs) => ReflectionHelper.CompareConstructors(type, lhs, rhs));
            writer.Inline("h4", "Constructors");
            LayoutCtors(writer, instanceCtors);

            LayoutInstanceFields(writer, type);
            LayoutInstanceProperties(writer, type);
            LayoutInstanceMethods(writer, type);

            var staticCtor = type.GetConstructors(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(instanceCtors, (lhs, rhs) => ReflectionHelper.CompareConstructors(type, lhs, rhs));
            writer.Inline("h4", "Static Constructor");
            LayoutCtors(writer, staticCtor);

            writer.Inline("h4", "Static Fields");
            var staticFields = type.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(staticFields, (lhs, rhs) => ReflectionHelper.CompareFields(type, lhs, rhs));
            LayoutStaticFields(writer, staticFields);

            writer.Inline("h4", "Static Properties");
            var staticProperties = type.GetProperties(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(staticProperties, (lhs, rhs) => ReflectionHelper.CompareProperties(type, lhs, rhs));
            LayoutProperties(writer, staticProperties);

            writer.Inline("h4", "Static Functions");
            var staticMethods = type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);

            Array.Sort(staticMethods, (lhs, rhs) => ReflectionHelper.CompareMethods(type, lhs, rhs));
            LayoutMethods(writer, staticMethods.Where(m => !m.IsSpecialName));

            LayoutNestedTypes(writer, type);
        }
        private void InspectClass(HtmlWriter writer, Type type)
        {
            var instanceCtors = type.GetConstructors(k_AllInstanceBindings);

            Array.Sort(instanceCtors, (lhs, rhs) => ReflectionHelper.CompareConstructors(type, lhs, rhs));
            if (instanceCtors.Length > 0)
            {
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Constructors");
                    LayoutCtors(writer, instanceCtors);
                }
            }

            var staticCtor = type.GetConstructors(k_AllStaticBindings);

            if (staticCtor.Length > 0)
            {
                Array.Sort(staticCtor, (lhs, rhs) => ReflectionHelper.CompareConstructors(type, lhs, rhs));
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Static constructors");
                    LayoutCtors(writer, staticCtor);
                }
            }

            LayoutInstanceFields(writer, type);

            var staticFields = type.GetFields(k_AllStaticBindings);

            if (staticFields.Length > 0)
            {
                Array.Sort(staticFields, (lhs, rhs) => ReflectionHelper.CompareFields(type, lhs, rhs));
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Static fields");
                    LayoutStaticFields(writer, staticFields);
                }
            }

            LayoutInstanceProperties(writer, type);

            var staticProperties = type.GetProperties(k_AllStaticBindings);

            if (staticProperties.Length > 0)
            {
                Array.Sort(staticProperties, (lhs, rhs) => ReflectionHelper.CompareProperties(type, lhs, rhs));
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "Static properties");
                    LayoutProperties(writer, staticProperties);
                }
            }

            LayoutInstanceMethods(writer, type);

            var staticMethods = type.GetMethods(k_AllStaticBindings);

            if (staticMethods.Length > 0)
            {
                Array.Sort(staticMethods, (lhs, rhs) => ReflectionHelper.CompareMethods(type, lhs, rhs));
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Static functions");
                    LayoutMethods(writer, staticMethods.Where(m => !m.IsSpecialName));
                }
            }

            LayoutNestedTypes(writer, type);
        }