void PrepareRenameEvent(MEventDef eventDef) { if (eventDef.IsVirtual()) { throw new ApplicationException("Can't rename virtual events here"); } var eventInfo = Event(eventDef); if (eventInfo.renamed) { return; } string eventName = eventInfo.oldName; if (!NameChecker.IsValidEventName(eventName)) { eventName = eventInfo.suggestedName; } if (!NameChecker.IsValidEventName(eventName)) { eventName = variableNameState.GetNewEventName(eventDef.EventDef); } variableNameState.AddEventName(eventName); eventInfo.Rename(eventName); RenameSpecialMethod(eventDef.AddMethod, "add_" + eventName); RenameSpecialMethod(eventDef.RemoveMethod, "remove_" + eventName); RenameSpecialMethod(eventDef.RaiseMethod, "raise_" + eventName); }
public MEventDef Create(EventDef newEvent) { if (FindAny(newEvent) != null) { throw new ApplicationException("Can't add an event when it's already been added"); } var eventDef = new MEventDef(newEvent, this, events.Count); Add(eventDef); TypeDef.Events.Add(newEvent); return(eventDef); }
public void Add(MEventDef e) => events.Add(e);
public EventInfo Event(MEventDef evt) => memberInfos.Event(evt);
public void Add(MEventDef evt) { allEventInfos[evt] = new EventInfo(evt); }
public EventInfo(MEventDef eventDef) : base(eventDef) { }
public EventInfo Event(MEventDef evt) { return(allEventInfos[evt]); }
public bool TryGetEvent(MEventDef e, out EventInfo info) { return(allEventInfos.TryGetValue(e, out info)); }
public EventInfo Event(MEventDef evt) { return(memberInfos.Event(evt)); }
public EventInfo Event(MEventDef evt) => allEventInfos[evt];
public bool TryGetEvent(MEventDef e, out EventInfo info) => allEventInfos.TryGetValue(e, out info);