示例#1
0
		static MemberIcon GetMemberIcon(PropertyDef property) {
			MethodDef method = GetMostAccessibleMethod(property);
			if (method == null)
				return MemberIcon.Property;

			var access = MethodTreeNode.GetMemberAccess(method);
			if (method.IsStatic) {
				switch (access) {
				case MemberAccess.Public: return MemberIcon.StaticProperty;
				case MemberAccess.Private: return MemberIcon.StaticPropertyPrivate;
				case MemberAccess.Protected: return MemberIcon.StaticPropertyProtected;
				case MemberAccess.Internal: return MemberIcon.StaticPropertyInternal;
				case MemberAccess.CompilerControlled: return MemberIcon.StaticPropertyCompilerControlled;
				case MemberAccess.ProtectedInternal: return MemberIcon.StaticPropertyProtectedInternal;
				default:
					Debug.Fail("Invalid MemberAccess");
					goto case MemberAccess.Public;
				}
			}

			if (method.IsVirtual) {
				switch (access) {
				case MemberAccess.Public: return MemberIcon.VirtualProperty;
				case MemberAccess.Private: return MemberIcon.VirtualPropertyPrivate;
				case MemberAccess.Protected: return MemberIcon.VirtualPropertyProtected;
				case MemberAccess.Internal: return MemberIcon.VirtualPropertyInternal;
				case MemberAccess.CompilerControlled: return MemberIcon.VirtualPropertyCompilerControlled;
				case MemberAccess.ProtectedInternal: return MemberIcon.VirtualPropertyProtectedInternal;
				default:
					Debug.Fail("Invalid MemberAccess");
					goto case MemberAccess.Public;
				}
			}

			switch (access) {
			case MemberAccess.Public: return MemberIcon.Property;
			case MemberAccess.Private: return MemberIcon.PropertyPrivate;
			case MemberAccess.Protected: return MemberIcon.PropertyProtected;
			case MemberAccess.Internal: return MemberIcon.PropertyInternal;
			case MemberAccess.CompilerControlled: return MemberIcon.PropertyCompilerControlled;
			case MemberAccess.ProtectedInternal: return MemberIcon.PropertyProtectedInternal;
			default:
				Debug.Fail("Invalid MemberAccess");
				goto case MemberAccess.Public;
			}
		}
示例#2
0
        static MemberIcon GetMemberIcon(EventDef eventDef)
        {
            MethodDef method = eventDef.AddMethod ?? eventDef.RemoveMethod;

            if (method == null)
            {
                return(MemberIcon.Event);
            }

            var access = MethodTreeNode.GetMemberAccess(method);

            if (method.IsStatic)
            {
                switch (access)
                {
                case MemberAccess.Public: return(MemberIcon.StaticEvent);

                case MemberAccess.Private: return(MemberIcon.StaticEventPrivate);

                case MemberAccess.Protected: return(MemberIcon.StaticEventProtected);

                case MemberAccess.Internal: return(MemberIcon.StaticEventInternal);

                case MemberAccess.CompilerControlled: return(MemberIcon.StaticEventCompilerControlled);

                case MemberAccess.ProtectedInternal: return(MemberIcon.StaticEventProtectedInternal);

                default:
                    Debug.Fail("Invalid MemberAccess");
                    goto case MemberAccess.Public;
                }
            }

            if (method.IsVirtual)
            {
                switch (access)
                {
                case MemberAccess.Public: return(MemberIcon.VirtualEvent);

                case MemberAccess.Private: return(MemberIcon.VirtualEventPrivate);

                case MemberAccess.Protected: return(MemberIcon.VirtualEventProtected);

                case MemberAccess.Internal: return(MemberIcon.VirtualEventInternal);

                case MemberAccess.CompilerControlled: return(MemberIcon.VirtualEventCompilerControlled);

                case MemberAccess.ProtectedInternal: return(MemberIcon.VirtualEventProtectedInternal);

                default:
                    Debug.Fail("Invalid MemberAccess");
                    goto case MemberAccess.Public;
                }
            }

            switch (access)
            {
            case MemberAccess.Public: return(MemberIcon.Event);

            case MemberAccess.Private: return(MemberIcon.EventPrivate);

            case MemberAccess.Protected: return(MemberIcon.EventProtected);

            case MemberAccess.Internal: return(MemberIcon.EventInternal);

            case MemberAccess.CompilerControlled: return(MemberIcon.EventCompilerControlled);

            case MemberAccess.ProtectedInternal: return(MemberIcon.EventProtectedInternal);

            default:
                Debug.Fail("Invalid MemberAccess");
                goto case MemberAccess.Public;
            }
        }