Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FillMethods()

void System.ComponentModel.ReflectEventDescriptor.FillMethods ( )
inlineprivate

Definition at line 181 of file ReflectEventDescriptor.cs.

182 {
183 if (_filledMethods)
184 {
185 return;
186 }
187 if (_realEvent != null)
188 {
191 EventInfo eventInfo = null;
192 if (_addMethod == null || _removeMethod == null)
193 {
194 Type baseType = _componentClass.BaseType;
195 while (baseType != null && baseType != typeof(object))
196 {
197 BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
198 EventInfo @event = baseType.GetEvent(_realEvent.Name, bindingAttr);
199 if (@event.GetAddMethod() != null)
200 {
201 eventInfo = @event;
202 break;
203 }
204 }
205 }
206 if (eventInfo != null)
207 {
208 _addMethod = eventInfo.GetAddMethod();
209 _removeMethod = eventInfo.GetRemoveMethod();
210 _type = eventInfo.EventHandlerType;
211 }
212 else
213 {
215 }
216 }
217 else
218 {
220 if (_realEvent != null)
221 {
222 FillMethods();
223 return;
224 }
225 Type[] args = new Type[1] { _type };
226 _addMethod = MemberDescriptor.FindMethod(_componentClass, "AddOn" + Name, args, typeof(void));
227 _removeMethod = MemberDescriptor.FindMethod(_componentClass, "RemoveOn" + Name, args, typeof(void));
228 if (_addMethod == null || _removeMethod == null)
229 {
231 }
232 }
233 _filledMethods = true;
234 }
MethodInfo? GetAddMethod()
Definition EventInfo.cs:59
virtual ? Type EventHandlerType
Definition EventInfo.cs:31
MethodInfo? GetRemoveMethod()
Definition EventInfo.cs:64
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ErrorMissingEventAccessors
Definition SR.cs:32
Definition SR.cs:7
EventInfo? GetEvent(string name)
Definition Type.cs:589
Type? BaseType
Definition Type.cs:295

References System.ComponentModel.ReflectEventDescriptor._addMethod, System.ComponentModel.ReflectEventDescriptor._componentClass, System.ComponentModel.ReflectEventDescriptor._filledMethods, System.ComponentModel.ReflectEventDescriptor._realEvent, System.ComponentModel.ReflectEventDescriptor._removeMethod, System.ComponentModel.ReflectEventDescriptor._type, System.Type.BaseType, System.SR.ErrorMissingEventAccessors, System.Reflection.EventInfo.EventHandlerType, System.ComponentModel.ReflectEventDescriptor.FillMethods(), System.ComponentModel.MemberDescriptor.FindMethod(), System.SR.Format(), System.Reflection.EventInfo.GetAddMethod(), System.Type.GetEvent(), System.Reflection.EventInfo.GetRemoveMethod(), System.ComponentModel.MemberDescriptor.Name, and System.Reflection.MemberInfo.Name.

Referenced by System.ComponentModel.ReflectEventDescriptor.AddEventHandler(), System.ComponentModel.ReflectEventDescriptor.FillAttributes(), System.ComponentModel.ReflectEventDescriptor.FillMethods(), and System.ComponentModel.ReflectEventDescriptor.RemoveEventHandler().