Example #1
0
        private void AddTypeMembersRecursive(ComTypeBrowserInfo sourceType, SortedList destination,
                                             bool isEventSource)
        {
            foreach (ComMemberBrowserInfo memberInfo in sourceType.Members)
            {
                ComMemberBrowserInfo newMemberInfo;

                if (isEventSource && memberInfo.MemberType == OperationMemberType.Method)
                {
                    newMemberInfo = new ComMemberBrowserInfo(this,
                                                             ((MethodDesc)memberInfo.MemberDesc).CreateEventFromMethod(),
                                                             memberInfo.NodeText);
                }
                else
                {
                    newMemberInfo = new ComMemberBrowserInfo(this, memberInfo.MemberDesc,
                                                             memberInfo.NodeText);
                }

                destination.Add(newMemberInfo, newMemberInfo.NodeText);
            }

            foreach (ComTypeBrowserInfo baseType in sourceType.BaseTypes)
            {
                AddTypeMembersRecursive(baseType, destination, isEventSource);
            }
        }
Example #2
0
        public override int CompareTo(object obj)
        {
            if (!(obj is ComMemberBrowserInfo))
            {
                throw new ArgumentException("Object must be of type '" + GetType().FullName + "'.", "obj");
            }

            ComMemberBrowserInfo other = (ComMemberBrowserInfo)obj;

            if (other == this)
            {
                return(0);
            }

            switch (Manager.Settings.MemberOrder)
            {
            case MemberOrder.Alphabetical:
                // Compare names
                int result1 = CompareMemberNames(m_member, other.m_member);
                if (result1 != 0)
                {
                    return(result1);
                }

                // Compare member types
                return(GetMemberTypePriority(m_member).CompareTo(
                           GetMemberTypePriority(other.m_member)));

            case MemberOrder.MemberType:
                // Compare member types
                int result2 = GetMemberTypePriority(m_member).CompareTo(
                    GetMemberTypePriority(other.m_member));
                if (result2 != 0)
                {
                    return(result2);
                }

                // Compare names
                return(CompareMemberNames(m_member, other.m_member));

            default:
                throw new ApplicationException("Unsupported MemberOrder enum value: '"
                                               + Manager.Settings.MemberOrder.ToString() + "'.");
            }
        }