示例#1
0
        private void LayoutInstanceMethods(HtmlWriter writer, Type type)
        {
            var instanceMethods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

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

            for (int i = 0; i < instanceMethods.Length; i++)
            {
                if (instanceMethods[i].DeclaringType != type)
                {
                    split = i;
                    break;
                }
            }
            writer.Inline("h4", "Instance Methods");
            if (split > 0)
            {
                LayoutMethods(writer, ArrayView(instanceMethods, 0, split).Where(m => !m.IsSpecialName));
            }
            writer.Inline("h4", "Inherited Methods");
            if (split < instanceMethods.Length)
            {
                LayoutMethods(writer, ArrayView(instanceMethods, split).Where(m => !m.IsSpecialName));
            }
        }
        private void LayoutInstanceMethods(HtmlWriter writer, Type type)
        {
            var instanceMethods = type.GetMethods(k_AllInstanceBindings);

            if (instanceMethods.Length == 0)
            {
                return;
            }

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

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

            if (split > 0)
            {
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Instance methods");
                    LayoutMethods(writer, ArrayView(instanceMethods, 0, split).Where(m => !m.IsSpecialName));
                }
            }

            if (split < instanceMethods.Length)
            {
                using (writer.ContainerFluid())
                {
                    writer.Inline("h6", "// Inherited methods");
                    LayoutMethods(writer, ArrayView(instanceMethods, split).Where(m => !m.IsSpecialName));
                }
            }
        }
示例#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);
        }