示例#1
0
        public override IEnumerable <ITreeNodeData> CreateChildren()
        {
            if (analyzedEvent.AddMethod != null)
            {
                yield return(new EventAccessorNode(analyzedEvent.AddMethod, dnSpy_Analyzer_Resources.EventAdderTreeNodeName));
            }

            if (analyzedEvent.RemoveMethod != null)
            {
                yield return(new EventAccessorNode(analyzedEvent.RemoveMethod, dnSpy_Analyzer_Resources.EventRemoverTreeNodeName));
            }

            foreach (var accessor in analyzedEvent.OtherMethods)
            {
                yield return(new EventAccessorNode(accessor, null));
            }

            if (EventFiredByNode.CanShow(analyzedEvent))
            {
                yield return(new EventFiredByNode(analyzedEvent));
            }

            if (EventOverridesNode.CanShow(analyzedEvent))
            {
                yield return(new EventOverridesNode(analyzedEvent));
            }

            if (InterfaceEventImplementedByNode.CanShow(analyzedEvent))
            {
                yield return(new InterfaceEventImplementedByNode(analyzedEvent));
            }
        }
示例#2
0
        public static bool CanShow(IMemberRef member, ILanguage language)
        {
            var eventDef = member as EventDef;

            if (eventDef == null)
            {
                return(false);
            }

            return(!language.ShowMember(eventDef.AddMethod ?? eventDef.RemoveMethod) ||
                   EventOverridesNode.CanShow(eventDef));
        }
示例#3
0
        public override IEnumerable <TreeNodeData> CreateChildren()
        {
            if (analyzedEvent.AddMethod is not null)
            {
                yield return(new EventAccessorNode(analyzedEvent.AddMethod, "add"));
            }

            if (analyzedEvent.RemoveMethod is not null)
            {
                yield return(new EventAccessorNode(analyzedEvent.RemoveMethod, "remove"));
            }

            if (analyzedEvent.InvokeMethod is not null)
            {
                yield return(new EventAccessorNode(analyzedEvent.InvokeMethod, "raise"));
            }

            foreach (var accessor in analyzedEvent.OtherMethods)
            {
                yield return(new EventAccessorNode(accessor, null));
            }

            if (EventFiredByNode.CanShow(analyzedEvent))
            {
                yield return(new EventFiredByNode(analyzedEvent));
            }

            if (EventOverriddenNode.CanShow(analyzedEvent))
            {
                yield return(new EventOverriddenNode(analyzedEvent));
            }

            if (EventOverridesNode.CanShow(analyzedEvent))
            {
                yield return(new EventOverridesNode(analyzedEvent));
            }

            if (InterfaceEventImplementedByNode.CanShow(analyzedEvent))
            {
                yield return(new InterfaceEventImplementedByNode(analyzedEvent));
            }
        }