Beispiel #1
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);
            }
        }
Beispiel #2
0
        /// <summary>
        /// The base implementation compares the node text first using case-insensitive comparison and then,
        /// if the elements are equal, case-sensitive comparison.
        /// </summary>
        public virtual int CompareTo(object obj)
        {
            IElementBrowserInfo other = obj as IElementBrowserInfo;

            if (other == null)
            {
                throw new ArgumentException(string.Format("Only another IElementBrowserInfo object can be"
                                                          + " compared to a '{0}' object, but '{1}' was passed in.", GetType().FullName,
                                                          (obj == null ? "<null>" : obj.GetType().FullName)), "obj");
            }

            int result = string.Compare(NodeText, other.NodeText, true);

            if (result != 0)
            {
                return(result);
            }

            return(string.Compare(NodeText, other.NodeText, false));
        }