Esempio n. 1
0
        private DescriptionText GetDescription()
        {
            try
            {
                DescriptionBuilder sb = new DescriptionBuilder(true);

                sb.Append("Type Library ");
                sb.AppendName(DisplayName);

                sb.EndFirstLine();
                sb.Append("     ");
                sb.Append(m_filePath);
                sb.EndLine();

                string description = GetDocString();
                if (description != null && description.Length != 0)
                {
                    sb.AppendHeading("Description:");
                    sb.Append(description);
                }

                return(sb.GetText());
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to write the type library description for type library '"
                                               + m_filePath + "'.", ex);
            }
        }
Esempio n. 2
0
        private DescriptionText GetDescription()
        {
            DescriptionBuilder sb = new DescriptionBuilder(true);

            switch (m_member.MemberType)
            {
            case MemberTypes.Method:
            case MemberTypes.Event:
                AppendMethod(sb, (MethodDesc)m_member);
                break;

            case MemberTypes.Property:
                AppendProperty(sb, (PropertyDesc)m_member);
                break;

            case MemberTypes.Field:
                AppendField(sb, (FieldDesc)m_member);
                break;

            default:
                throw new ApplicationException("Unsupported member type: '" + m_member.MemberType.ToString() + "'.");
            }

            sb.EndFirstLine();
            sb.Append(@"     Member of ");
            sb.AppendLink(m_type.DisplayName, m_type);
            sb.EndLine();

            return(sb.GetText());
        }
Esempio n. 3
0
        private DescriptionText GetDescription()
        {
            try
            {
                DescriptionBuilder sb = new DescriptionBuilder(true);

                sb.Append("Assembly ");
                sb.AppendName(m_assembly.GetName().Name);

                sb.EndFirstLine();
                sb.Append("     ");
                sb.Append(m_assembly.Location);
                sb.EndLine();
                sb.EndLine();

                Manager.AppendCustomAttributes(sb, m_assembly);

                return(sb.GetText());
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to write the assembly description for assembly '"
                                               + m_assembly.FullName + "'.", ex);
            }
        }
Esempio n. 4
0
        private DescriptionText GetDescriptionInternal(NetNamespaceBrowserInfo ns, NetTypeBrowserInfo baseType)
        {
            try
            {
                DescriptionBuilder sb = new DescriptionBuilder(true);

                sb.Append(Settings.GetKeyword(GetTypeAccess(m_type)));
                sb.Append(" ");

                AppendTypeAttribute(sb, m_type, TypeAttributes.Abstract);
                AppendTypeAttribute(sb, m_type, TypeAttributes.Sealed);

                sb.Append(Settings.GetKeyword(GetObjectType(m_type)));
                sb.Append(" ");

                sb.AppendName(GetTypeDisplayName(m_type));

                if (baseType != null)
                {
                    sb.Append(" : ");
                    sb.AppendLink(baseType.DisplayName, baseType);
                }

                if (m_type.IsEnum)
                {
                    Type underlying = Enum.GetUnderlyingType(m_type);
                    sb.Append(" (");
                    sb.AppendName(Settings.GetKeyword(underlying.AssemblyQualifiedName));
                    sb.Append(")");
                }

                IElementBrowserInfo container = (ns.IsNullNamespace ? ns.Repository : (IElementBrowserInfo)ns);

                sb.EndFirstLine();
                sb.Append(@"     Member of ");
                sb.AppendLink(container.NodeText, container);
                sb.EndLine();

                return(sb.GetText());
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to write the type declaration for type '"
                                               + m_type.FullName + "'.", ex);
            }
        }
Esempio n. 5
0
        private DescriptionText GetDescriptionInternal(NetBrowserManager manager, NetTypeBrowserInfo type)
        {
            DescriptionBuilder sb = new DescriptionBuilder(true);

            sb.Append(Settings.GetKeyword(GetMemberAccess(m_memberInfo)));
            sb.Append(" ");

            switch (m_memberInfo.MemberType)
            {
            case MemberTypes.Constructor:
                AppendConstructor(sb, manager, (ConstructorInfo)m_memberInfo);
                break;

            case MemberTypes.Method:
                AppendMethod(sb, manager, (MethodInfo)m_memberInfo);
                break;

            case MemberTypes.Property:
                AppendProperty(sb, manager, (PropertyInfo)m_memberInfo);
                break;

            case MemberTypes.Field:
                AppendField(sb, manager, (FieldInfo)m_memberInfo);
                break;

            case MemberTypes.Event:
                AppendEvent(sb, manager, (EventInfo)m_memberInfo);
                break;

            default:
                throw new ApplicationException("Unsupported member type: '" + m_memberInfo.MemberType.ToString() + "'.");
            }

            sb.EndFirstLine();
            sb.Append(@"     Member of ");
            sb.AppendLink(type.DisplayName, type);
            sb.EndLine();

            return(sb.GetText());
        }
        private DescriptionText GetDescriptionInternal(TypeLibraryBrowserInfo parent)
        {
            try
            {
                DescriptionBuilder sb = new DescriptionBuilder(true);

                sb.Append("namespace ");
                sb.AppendName(m_name);

                sb.EndFirstLine();
                sb.Append(@"     Member of ");
                sb.AppendLink(m_typeLibrary.NodeText, parent);
                sb.EndLine();

                return(sb.GetText());
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to write the namespace declaration for namespace '"
                                               + DisplayName + "' (type library '" + m_typeLibrary.DisplayName + "') .", ex);
            }
        }
Esempio n. 7
0
        private DescriptionText GetDescription()
        {
            try
            {
                DescriptionBuilder sb = new DescriptionBuilder(true);

                IntPtr ptr = IntPtr.Zero;
                m_typeInfo.ComType.GetTypeAttr(out ptr);

                try
                {
                    TYPEATTR typeAttr = (TYPEATTR)Marshal.PtrToStructure(ptr, typeof(TYPEATTR));

                    // Type GUID and attributes.

                    sb.Append("[ uuid(");
                    sb.Append(typeAttr.guid.ToString().ToUpper());
                    sb.Append(")");

                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FAGGREGATABLE);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FAPPOBJECT);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FCONTROL);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FLICENSED);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FHIDDEN);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FNONEXTENSIBLE);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FOLEAUTOMATION);
                    AppendTypeAttribute(sb, typeAttr, TYPEFLAGS.TYPEFLAG_FRESTRICTED);

                    sb.Append(" ]");
                    sb.EndLine();

                    // Object type (including interface type for an interface).

                    ObjectType objectType = GetObjectType(typeAttr);

                    if (objectType == ObjectType.Interface)
                    {
                        sb.Append(ComBrowserSettings.GetKeyword(GetInterfaceType(typeAttr)));
                    }
                    else
                    {
                        sb.Append(ComBrowserSettings.GetKeyword(objectType));
                    }
                    sb.Append(" ");
                }
                finally
                {
                    m_typeInfo.ComType.ReleaseTypeAttr(ptr);
                }

                // Name and description.

                sb.AppendName(Marshal.GetTypeInfoName(m_typeInfo.ComType));
                sb.EndFirstLine();

                sb.Append(@"     Member of ");
                sb.AppendLink(Namespace.NodeText, Namespace);
                sb.EndLine();

                string description = GetDocString();
                if (description != null && description.Length != 0)
                {
                    sb.AppendHeading("Description:");
                    sb.Append(description);
                }

                return(sb.GetText());
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to write the type declaration for type '"
                                               + Marshal.GetTypeInfoName(m_typeInfo.ComType) + "'.", ex);
            }
        }