Ejemplo n.º 1
0
 /// <summary>
 /// A cecil event reference will be directed to this method.
 /// </summary>
 /// <param name="item">Cecil reference.</param>
 /// <param name="resolvedItem">Output parameter that will be populated with the resolved cecil definition.</param>
 /// <returns><c>true</c></returns>
 private static bool TryResolve(EventReference item, out object resolvedItem)
 {
     resolvedItem = item.Resolve();
     return true;
 }
        protected virtual string GetEventName(EventReference @event)
        {
            EventDefinition eventDefinition = @event.Resolve();

            if (eventDefinition != null && eventDefinition.Module.FilePath == this.ModuleContext.Module.FilePath)
            {

                return this.ModuleContext.RenamedMembersMap[eventDefinition.MetadataToken.ToUInt32()];
            }

            return Utilities.EscapeName(GenericHelper.GetNonGenericName(@event.Name), this.Language);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Mark all reachable items in argument as such.
        /// </summary>
        private static void Walk(ReachableContext context, EventReference evt)
        {
            // Type
            evt.EventType.MarkReachable(context);

            var evtDef = evt as EventDefinition;
            if (evtDef != null)
            {
                evtDef.AddMethod.MarkReachable(context);
                evtDef.RemoveMethod.MarkReachable(context);
                evtDef.InvokeMethod.MarkReachable(context);

                // Custom attributes
                Walk(context, (ICustomAttributeProvider)evtDef);
            }
            else
            {
                // Try to resolve
                evt.Resolve(context).MarkReachable(context);
            }
        }