Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EventDefinition.cs
Go to the documentation of this file.
1
using
System.Collections.Immutable
;
2
3
namespace
System.Reflection.Metadata
;
4
5
public
readonly
struct
EventDefinition
6
{
7
private
readonly
MetadataReader
_reader
;
8
9
private
readonly
int
_rowId
;
10
11
private
EventDefinitionHandle
Handle
=>
EventDefinitionHandle
.
FromRowId
(
_rowId
);
12
13
public
StringHandle
Name
=>
_reader
.
EventTable
.GetName(
Handle
);
14
15
public
EventAttributes
Attributes
=>
_reader
.
EventTable
.GetFlags(
Handle
);
16
17
public
EntityHandle
Type
=>
_reader
.
EventTable
.GetEventType(
Handle
);
18
19
internal
EventDefinition
(
MetadataReader
reader,
EventDefinitionHandle
handle
)
20
{
21
_reader
= reader;
22
_rowId
=
handle
.RowId;
23
}
24
25
public
CustomAttributeHandleCollection
GetCustomAttributes
()
26
{
27
return
new
CustomAttributeHandleCollection
(
_reader
,
Handle
);
28
}
29
30
public
EventAccessors
GetAccessors
()
31
{
32
int
adderRowId = 0;
33
int
removerRowId = 0;
34
int
raiserRowId = 0;
35
ImmutableArray<MethodDefinitionHandle>
.
Builder
builder =
null
;
36
ushort methodCount;
37
int
num =
_reader
.
MethodSemanticsTable
.FindSemanticMethodsForEvent(
Handle
, out methodCount);
38
for
(ushort num2 = 0; num2 < methodCount; num2++)
39
{
40
int
rowId = num + num2;
41
switch
(
_reader
.
MethodSemanticsTable
.GetSemantics(rowId))
42
{
43
case
MethodSemanticsAttributes
.Adder:
44
adderRowId =
_reader
.
MethodSemanticsTable
.GetMethod(rowId).RowId;
45
break
;
46
case
MethodSemanticsAttributes
.Remover:
47
removerRowId =
_reader
.
MethodSemanticsTable
.GetMethod(rowId).RowId;
48
break
;
49
case
MethodSemanticsAttributes
.Raiser:
50
raiserRowId =
_reader
.
MethodSemanticsTable
.GetMethod(rowId).RowId;
51
break
;
52
case
MethodSemanticsAttributes
.Other:
53
if
(builder ==
null
)
54
{
55
builder =
ImmutableArray
.CreateBuilder<
MethodDefinitionHandle
>();
56
}
57
builder.Add(
_reader
.
MethodSemanticsTable
.GetMethod(rowId));
58
break
;
59
}
60
}
61
ImmutableArray<MethodDefinitionHandle>
others = builder?.ToImmutable() ??
ImmutableArray<MethodDefinitionHandle>
.
Empty
;
62
return
new
EventAccessors
(adderRowId, removerRowId, raiserRowId, others);
63
}
64
}
System.Collections.Immutable.ImmutableArray.Builder
Definition
ImmutableArray.cs:227
System.Collections.Immutable.ImmutableArray.Empty
static readonly ImmutableArray< T > Empty
Definition
ImmutableArray.cs:760
System.Collections.Immutable.ImmutableArray
Definition
ImmutableArray.cs:223
System.Reflection.Metadata.MetadataReader.MethodSemanticsTable
MethodSemanticsTableReader MethodSemanticsTable
Definition
MetadataReader.cs:123
System.Reflection.Metadata.MetadataReader.EventTable
EventTableReader EventTable
Definition
MetadataReader.cs:115
System.Reflection.Metadata.MetadataReader
Definition
MetadataReader.cs:12
System.Type
Definition
Type.cs:14
System.Collections.Immutable
Definition
AllocFreeConcurrentStack.cs:4
System.Reflection.Metadata
Definition
AssemblyExtensions.cs:4
System.Reflection.MethodSemanticsAttributes
MethodSemanticsAttributes
Definition
MethodSemanticsAttributes.cs:5
System.Reflection.EventAttributes
EventAttributes
Definition
EventAttributes.cs:5
System.ExceptionArgument.handle
@ handle
System.Reflection.Metadata.CustomAttributeHandleCollection
Definition
CustomAttributeHandleCollection.cs:7
System.Reflection.Metadata.EntityHandle
Definition
EntityHandle.cs:6
System.Reflection.Metadata.EventAccessors
Definition
EventAccessors.cs:6
System.Reflection.Metadata.EventDefinitionHandle.FromRowId
static EventDefinitionHandle FromRowId(int rowId)
Definition
EventDefinitionHandle.cs:16
System.Reflection.Metadata.EventDefinitionHandle
Definition
EventDefinitionHandle.cs:4
System.Reflection.Metadata.EventDefinition.GetCustomAttributes
CustomAttributeHandleCollection GetCustomAttributes()
Definition
EventDefinition.cs:25
System.Reflection.Metadata.EventDefinition._reader
readonly MetadataReader _reader
Definition
EventDefinition.cs:7
System.Reflection.Metadata.EventDefinition.Attributes
EventAttributes Attributes
Definition
EventDefinition.cs:15
System.Reflection.Metadata.EventDefinition.EventDefinition
EventDefinition(MetadataReader reader, EventDefinitionHandle handle)
Definition
EventDefinition.cs:19
System.Reflection.Metadata.EventDefinition.Name
StringHandle Name
Definition
EventDefinition.cs:13
System.Reflection.Metadata.EventDefinition._rowId
readonly int _rowId
Definition
EventDefinition.cs:9
System.Reflection.Metadata.EventDefinition.GetAccessors
EventAccessors GetAccessors()
Definition
EventDefinition.cs:30
System.Reflection.Metadata.EventDefinition
Definition
EventDefinition.cs:6
System.Reflection.Metadata.Handle
Definition
Handle.cs:6
System.Reflection.Metadata.MethodDefinitionHandle
Definition
MethodDefinitionHandle.cs:4
System.Reflection.Metadata.StringHandle
Definition
StringHandle.cs:6
source
System.Reflection.Metadata
System.Reflection.Metadata
EventDefinition.cs
Generated by
1.10.0