using System;
using System.Runtime.InteropServices;
namespace System.Reflection.Emit
{
/// Defines events for a class.
// Token: 0x020001F0 RID: 496
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_EventBuilder))]
public sealed class EventBuilder : _EventBuilder
{
// Token: 0x060019F4 RID: 6644 RVA: 0x00062440 File Offset: 0x00060640
internal EventBuilder(TypeBuilder tb, string eventName, EventAttributes eventAttrs, Type eventType)
{
this.name = eventName;
this.attrs = eventAttrs;
this.type = eventType;
this.typeb = tb;
this.table_idx = this.get_next_table_index(this, 20, true);
}
/// Maps a set of names to a corresponding set of dispatch identifiers.
/// Reserved for future use. Must be IID_NULL.
/// Passed-in array of names to be mapped.
/// Count of the names to be mapped.
/// The locale context in which to interpret the names.
/// Caller-allocated array which receives the IDs corresponding to the names.
/// The method is called late-bound using the COM IDispatch interface.
// Token: 0x060019F5 RID: 6645 RVA: 0x00062478 File Offset: 0x00060678
void _EventBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException();
}
/// Retrieves the type information for an object, which can then be used to get the type information for an interface.
/// The type information to return.
/// The locale identifier for the type information.
/// Receives a pointer to the requested type information object.
/// The method is called late-bound using the COM IDispatch interface.
// Token: 0x060019F6 RID: 6646 RVA: 0x00062480 File Offset: 0x00060680
void _EventBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException();
}
/// Retrieves the number of type information interfaces that an object provides (either 0 or 1).
/// Points to a location that receives the number of type information interfaces provided by the object.
/// The method is called late-bound using the COM IDispatch interface.
// Token: 0x060019F7 RID: 6647 RVA: 0x00062488 File Offset: 0x00060688
void _EventBuilder.GetTypeInfoCount(out uint pcTInfo)
{
throw new NotImplementedException();
}
/// Provides access to properties and methods exposed by an object.
/// Identifies the member.
/// Reserved for future use. Must be IID_NULL.
/// The locale context in which to interpret arguments.
/// Flags describing the context of the call.
/// Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
/// Pointer to the location where the result is to be stored.
/// Pointer to a structure that contains exception information.
/// The index of the first argument that has an error.
/// The method is called late-bound using the COM IDispatch interface.
// Token: 0x060019F8 RID: 6648 RVA: 0x00062490 File Offset: 0x00060690
void _EventBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
throw new NotImplementedException();
}
// Token: 0x060019F9 RID: 6649 RVA: 0x00062498 File Offset: 0x00060698
internal int get_next_table_index(object obj, int table, bool inc)
{
return this.typeb.get_next_table_index(obj, table, inc);
}
/// Adds one of the "other" methods associated with this event. "Other" methods are methods other than the "on" and "raise" methods associated with an event. This function can be called many times to add as many "other" methods.
/// A MethodBuilder object that represents the other method.
///
/// is null.
///
/// has been called on the enclosing type.
// Token: 0x060019FA RID: 6650 RVA: 0x000624A8 File Offset: 0x000606A8
public void AddOtherMethod(MethodBuilder mdBuilder)
{
if (mdBuilder == null)
{
throw new ArgumentNullException("mdBuilder");
}
this.RejectIfCreated();
if (this.other_methods != null)
{
MethodBuilder[] array = new MethodBuilder[this.other_methods.Length + 1];
this.other_methods.CopyTo(array, 0);
this.other_methods = array;
}
else
{
this.other_methods = new MethodBuilder[1];
}
this.other_methods[this.other_methods.Length - 1] = mdBuilder;
}
/// Returns the token for this event.
/// Returns the EventToken for this event.
// Token: 0x060019FB RID: 6651 RVA: 0x00062520 File Offset: 0x00060720
public EventToken GetEventToken()
{
return new EventToken(335544320 | this.table_idx);
}
/// Sets the method used to subscribe to this event.
/// A MethodBuilder object that represents the method used to subscribe to this event.
///
/// is null.
///
/// has been called on the enclosing type.
// Token: 0x060019FC RID: 6652 RVA: 0x00062534 File Offset: 0x00060734
public void SetAddOnMethod(MethodBuilder mdBuilder)
{
if (mdBuilder == null)
{
throw new ArgumentNullException("mdBuilder");
}
this.RejectIfCreated();
this.add_method = mdBuilder;
}
/// Sets the method used to raise this event.
/// A MethodBuilder object that represents the method used to raise this event.
///
/// is null.
///
/// has been called on the enclosing type.
// Token: 0x060019FD RID: 6653 RVA: 0x00062554 File Offset: 0x00060754
public void SetRaiseMethod(MethodBuilder mdBuilder)
{
if (mdBuilder == null)
{
throw new ArgumentNullException("mdBuilder");
}
this.RejectIfCreated();
this.raise_method = mdBuilder;
}
/// Sets the method used to unsubscribe to this event.
/// A MethodBuilder object that represents the method used to unsubscribe to this event.
///
/// is null.
///
/// has been called on the enclosing type.
// Token: 0x060019FE RID: 6654 RVA: 0x00062574 File Offset: 0x00060774
public void SetRemoveOnMethod(MethodBuilder mdBuilder)
{
if (mdBuilder == null)
{
throw new ArgumentNullException("mdBuilder");
}
this.RejectIfCreated();
this.remove_method = mdBuilder;
}
/// Sets a custom attribute using a custom attribute builder.
/// An instance of a helper class to describe the custom attribute.
///
/// is null.
///
/// has been called on the enclosing type.
// Token: 0x060019FF RID: 6655 RVA: 0x00062594 File Offset: 0x00060794
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
{
throw new ArgumentNullException("customBuilder");
}
this.RejectIfCreated();
string fullName = customBuilder.Ctor.ReflectedType.FullName;
if (fullName == "System.Runtime.CompilerServices.SpecialNameAttribute")
{
this.attrs |= EventAttributes.SpecialName;
return;
}
if (this.cattrs != null)
{
CustomAttributeBuilder[] array = new CustomAttributeBuilder[this.cattrs.Length + 1];
this.cattrs.CopyTo(array, 0);
array[this.cattrs.Length] = customBuilder;
this.cattrs = array;
}
else
{
this.cattrs = new CustomAttributeBuilder[1];
this.cattrs[0] = customBuilder;
}
}
/// Set a custom attribute using a specified custom attribute blob.
/// The constructor for the custom attribute.
/// A byte blob representing the attributes.
///
/// or is null.
///
/// has been called on the enclosing type.
// Token: 0x06001A00 RID: 6656 RVA: 0x00062640 File Offset: 0x00060840
[ComVisible(true)]
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
if (con == null)
{
throw new ArgumentNullException("con");
}
if (binaryAttribute == null)
{
throw new ArgumentNullException("binaryAttribute");
}
this.SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
}
// Token: 0x06001A01 RID: 6657 RVA: 0x00062674 File Offset: 0x00060874
private void RejectIfCreated()
{
if (this.typeb.is_created)
{
throw new InvalidOperationException("Type definition of the method is complete.");
}
}
// Token: 0x040007A4 RID: 1956
internal string name;
// Token: 0x040007A5 RID: 1957
private Type type;
// Token: 0x040007A6 RID: 1958
private TypeBuilder typeb;
// Token: 0x040007A7 RID: 1959
private CustomAttributeBuilder[] cattrs;
// Token: 0x040007A8 RID: 1960
internal MethodBuilder add_method;
// Token: 0x040007A9 RID: 1961
internal MethodBuilder remove_method;
// Token: 0x040007AA RID: 1962
internal MethodBuilder raise_method;
// Token: 0x040007AB RID: 1963
internal MethodBuilder[] other_methods;
// Token: 0x040007AC RID: 1964
internal EventAttributes attrs;
// Token: 0x040007AD RID: 1965
private int table_idx;
}
}