本文整理汇总了C#中dnlib.DotNet.EventDef类的典型用法代码示例。如果您正苦于以下问题:C# EventDef类的具体用法?C# EventDef怎么用?C# EventDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventDef类属于dnlib.DotNet命名空间,在下文中一共展示了EventDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnalyzedEventTreeNode
public AnalyzedEventTreeNode(EventDef analyzedEvent, bool hidesParent = false) {
if (analyzedEvent == null)
throw new ArgumentNullException("analyzedEvent");
this.analyzedEvent = analyzedEvent;
this.hidesParent = hidesParent;
this.LazyLoading = true;
}
示例2: AnalyzedEventOverridesTreeNode
public AnalyzedEventOverridesTreeNode(EventDef analyzedEvent)
{
if (analyzedEvent == null)
throw new ArgumentNullException("analyzedEvent");
this.analyzedEvent = analyzedEvent;
}
示例3: InterfaceEventImplementedByNode
public InterfaceEventImplementedByNode(EventDef analyzedEvent) {
if (analyzedEvent == null)
throw new ArgumentNullException("analyzedEvent");
this.analyzedEvent = analyzedEvent;
this.analyzedMethod = this.analyzedEvent.AddMethod ?? this.analyzedEvent.RemoveMethod;
}
示例4: AnalyzedEventTreeNode
public AnalyzedEventTreeNode(EventDef analyzedEvent, string prefix = "")
{
if (analyzedEvent == null)
throw new ArgumentNullException("analyzedEvent");
this.analyzedEvent = analyzedEvent;
this.prefix = prefix;
this.LazyLoading = true;
}
示例5: DeletedEventUpdater
public DeletedEventUpdater(ModuleDocumentNode modNode, EventDef originalEvent) {
ownerNode = modNode.Context.DocumentTreeView.FindNode(originalEvent);
if (ownerNode == null)
throw new InvalidOperationException();
parentNode = ownerNode.TreeNode.Parent.Data;
ownerType = originalEvent.DeclaringType;
@event = originalEvent;
}
示例6: EditedEventUpdater
public EditedEventUpdater(ModuleDocumentNode modNode, EventDef originalEvent, EventDefOptions eventDefOptions) {
ownerNode = modNode.Context.DocumentTreeView.FindNode(originalEvent);
if (ownerNode == null)
throw new InvalidOperationException();
@event = originalEvent;
originalEventDefOptions = new EventDefOptions(originalEvent);
newEventDefOptions = eventDefOptions;
}
示例7: Write
public static ITextOutput Write(ITextOutput output, EventDef ev, Language language) {
output.Write(UIUtils.CleanUpIdentifier(ev.Name), TextTokenHelper.GetTextTokenType(ev));
output.WriteSpace();
output.Write(':', TextTokenType.Operator);
output.WriteSpace();
language.TypeToString(output, ev.EventType, false, ev);
ev.MDToken.WriteSuffixString(output);
return output;
}
示例8: EventDefOptions
public EventDefOptions(EventDef evt) {
this.Attributes = evt.Attributes;
this.Name = evt.Name;
this.EventType = evt.EventType;
this.AddMethod = evt.AddMethod;
this.InvokeMethod = evt.InvokeMethod;
this.RemoveMethod = evt.RemoveMethod;
this.OtherMethods.AddRange(evt.OtherMethods);
this.CustomAttributes.AddRange(evt.CustomAttributes);
}
示例9: AnalyzedEventFiredByTreeNode
public AnalyzedEventFiredByTreeNode(EventDef analyzedEvent)
{
if (analyzedEvent == null)
throw new ArgumentNullException("analyzedEvent");
this.analyzedEvent = analyzedEvent;
this.eventBackingField = GetBackingField(analyzedEvent);
this.eventFiringMethod = analyzedEvent.EventType.ResolveTypeDef().Methods.First(md => md.Name == "Invoke");
}
示例10: EventDefOptions
public EventDefOptions(EventDef evt) {
Attributes = evt.Attributes;
Name = evt.Name;
EventType = evt.EventType;
AddMethod = evt.AddMethod;
InvokeMethod = evt.InvokeMethod;
RemoveMethod = evt.RemoveMethod;
OtherMethods.AddRange(evt.OtherMethods);
CustomAttributes.AddRange(evt.CustomAttributes);
}
示例11: EventFiredByNode
public EventFiredByNode(EventDef analyzedEvent) {
if (analyzedEvent == null)
throw new ArgumentNullException(nameof(analyzedEvent));
this.analyzedEvent = analyzedEvent;
eventBackingField = GetBackingField(analyzedEvent);
var eventType = analyzedEvent.EventType.ResolveTypeDef();
if (eventType != null)
eventFiringMethod = eventType.Methods.First(md => md.Name == "Invoke");
}
示例12: CopyTo
public EventDef CopyTo(EventDef evt) {
evt.Attributes = this.Attributes;
evt.Name = this.Name ?? UTF8String.Empty;
evt.EventType = this.EventType;
evt.AddMethod = this.AddMethod;
evt.InvokeMethod = this.InvokeMethod;
evt.RemoveMethod = this.RemoveMethod;
evt.OtherMethods.Clear();
evt.OtherMethods.AddRange(this.OtherMethods);
evt.CustomAttributes.Clear();
evt.CustomAttributes.AddRange(CustomAttributes);
return evt;
}
示例13: EventTreeNode
public EventTreeNode(EventDef ev) {
if (ev == null)
throw new ArgumentNullException("ev");
this.ev = ev;
if (ev.AddMethod != null)
this.Children.Add(new MethodTreeNode(ev.AddMethod));
if (ev.RemoveMethod != null)
this.Children.Add(new MethodTreeNode(ev.RemoveMethod));
if (ev.InvokeMethod != null)
this.Children.Add(new MethodTreeNode(ev.InvokeMethod));
if (ev.HasOtherMethods) {
foreach (var m in ev.OtherMethods)
this.Children.Add(new MethodTreeNode(m));
}
}
示例14: GetMemberIcon
static MemberIcon GetMemberIcon(EventDef eventDef) {
MethodDef method = eventDef.AddMethod ?? eventDef.RemoveMethod;
if (method == null)
return MemberIcon.Event;
var access = MethodTreeNode.GetMemberAccess(method);
if (method.IsStatic) {
switch (access) {
case MemberAccess.Public: return MemberIcon.StaticEvent;
case MemberAccess.Private: return MemberIcon.StaticEventPrivate;
case MemberAccess.Protected: return MemberIcon.StaticEventProtected;
case MemberAccess.Internal: return MemberIcon.StaticEventInternal;
case MemberAccess.CompilerControlled: return MemberIcon.StaticEventCompilerControlled;
case MemberAccess.ProtectedInternal: return MemberIcon.StaticEventProtectedInternal;
default:
Debug.Fail("Invalid MemberAccess");
goto case MemberAccess.Public;
}
}
if (method.IsVirtual) {
switch (access) {
case MemberAccess.Public: return MemberIcon.VirtualEvent;
case MemberAccess.Private: return MemberIcon.VirtualEventPrivate;
case MemberAccess.Protected: return MemberIcon.VirtualEventProtected;
case MemberAccess.Internal: return MemberIcon.VirtualEventInternal;
case MemberAccess.CompilerControlled: return MemberIcon.VirtualEventCompilerControlled;
case MemberAccess.ProtectedInternal: return MemberIcon.VirtualEventProtectedInternal;
default:
Debug.Fail("Invalid MemberAccess");
goto case MemberAccess.Public;
}
}
switch (access) {
case MemberAccess.Public: return MemberIcon.Event;
case MemberAccess.Private: return MemberIcon.EventPrivate;
case MemberAccess.Protected: return MemberIcon.EventProtected;
case MemberAccess.Internal: return MemberIcon.EventInternal;
case MemberAccess.CompilerControlled: return MemberIcon.EventCompilerControlled;
case MemberAccess.ProtectedInternal: return MemberIcon.EventProtectedInternal;
default:
Debug.Fail("Invalid MemberAccess");
goto case MemberAccess.Public;
}
}
示例15: DecompileEvent
public override void DecompileEvent(EventDef ev, ITextOutput output, DecompilationOptions options)
{
StartKeywordBlock(output, ".event", ev);
if (ev.AddMethod != null) {
StartKeywordBlock(output, ".add", ev.AddMethod);
EndKeywordBlock(output);
}
if (ev.InvokeMethod != null) {
StartKeywordBlock(output, ".invoke", ev.InvokeMethod);
EndKeywordBlock(output);
}
if (ev.RemoveMethod != null) {
StartKeywordBlock(output, ".remove", ev.RemoveMethod);
EndKeywordBlock(output);
}
EndKeywordBlock(output);
}