示例#1
0
        void getVirtualEventName(EventDef eventDef, ref string prefix, ref string propName)
        {
            EventRef sameDef;
            var overrideMethod = eventDef.getOverrideMethod();
            if (overrideMethod != null && (sameDef = defFinder.findEvent(overrideMethod)) != null) {
                prefix = getOverrideMethodNamePrefix(sameDef.Owner.TypeDefinition);
                propName = sameDef.NewName;
                return;
            }

            var method = getOverrideMethod(eventDef.EventDefinition.AddMethod ?? eventDef.EventDefinition.RemoveMethod);
            if (method != null) {
                var realName = getRealName(method.Name);
                // Only use the name if the method is not in one of the loaded files, since the
                // name shouldn't be obfuscated.
                if (Regex.IsMatch(realName, @"^(add|remove)_.") && defFinder.findEvent(method) == null) {
                    prefix = getOverrideMethodNamePrefix(method.DeclaringType);
                    propName = realName.Substring(realName.IndexOf('_') + 1);
                    return;
                }
            }

            sameDef = MemberRenameState.get(eventDef);
            if (sameDef != null) {
                prefix = "";
                propName = sameDef.NewName;
                return;
            }
        }
示例#2
0
 public void add(EventDef e)
 {
     events.add(e);
 }