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); } }
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); } }