Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TypeDefinition.cs
Go to the documentation of this file.
3
5
6public readonly struct TypeDefinition
7{
8 private readonly MetadataReader _reader;
9
10 private readonly uint _treatmentAndRowId;
11
12 private int RowId => (int)(_treatmentAndRowId & 0xFFFFFF);
13
15
17
19 {
20 get
21 {
22 if (Treatment == TypeDefTreatment.None)
23 {
25 }
26 return GetProjectedFlags();
27 }
28 }
29
30 public bool IsNested => Attributes.IsNested();
31
33 {
34 get
35 {
36 if (Treatment == TypeDefTreatment.None)
37 {
39 }
40 return GetProjectedName();
41 }
42 }
43
45 {
46 get
47 {
48 if (Treatment == TypeDefTreatment.None)
49 {
51 }
53 }
54 }
55
57 {
58 get
59 {
60 if (Treatment == TypeDefTreatment.None)
61 {
63 }
64 return GetProjectedNamespace();
65 }
66 }
67
69 {
70 get
71 {
72 if (Treatment == TypeDefTreatment.None)
73 {
75 }
76 return GetProjectedBaseType();
77 }
78 }
79
80 internal TypeDefinition(MetadataReader reader, uint treatmentAndRowId)
81 {
82 _reader = reader;
83 _treatmentAndRowId = treatmentAndRowId;
84 }
85
87 {
89 if (num == 0)
90 {
91 return default(TypeLayout);
92 }
93 uint classSize = _reader.ClassLayoutTable.GetClassSize(num);
94 if ((int)classSize != classSize)
95 {
97 }
98 int packingSize = _reader.ClassLayoutTable.GetPackingSize(num);
99 return new TypeLayout((int)classSize, packingSize);
100 }
101
106
111
116
121
126
131
136
141
146
151
156
158 {
160 TypeDefTreatment treatment = Treatment;
161 switch (treatment & TypeDefTreatment.KindMask)
162 {
163 case TypeDefTreatment.NormalNonAttribute:
164 typeAttributes |= TypeAttributes.Import | TypeAttributes.WindowsRuntime;
165 break;
166 case TypeDefTreatment.NormalAttribute:
167 typeAttributes |= TypeAttributes.Sealed | TypeAttributes.WindowsRuntime;
168 break;
169 case TypeDefTreatment.UnmangleWinRTName:
170 typeAttributes = (typeAttributes & ~TypeAttributes.SpecialName) | TypeAttributes.Public;
171 break;
172 case TypeDefTreatment.PrefixWinRTName:
173 typeAttributes = (typeAttributes & ~TypeAttributes.Public) | TypeAttributes.Import;
174 break;
175 case TypeDefTreatment.RedirectedToClrType:
176 typeAttributes = (typeAttributes & ~TypeAttributes.Public) | TypeAttributes.Import;
177 break;
178 case TypeDefTreatment.RedirectedToClrAttribute:
179 typeAttributes &= ~TypeAttributes.Public;
180 break;
181 }
182 if ((treatment & TypeDefTreatment.MarkAbstractFlag) != 0)
183 {
184 typeAttributes |= TypeAttributes.Abstract;
185 }
186 if ((treatment & TypeDefTreatment.MarkInternalFlag) != 0)
187 {
188 typeAttributes &= ~TypeAttributes.Public;
189 }
190 return typeAttributes;
191 }
192
194 {
196 return (Treatment & TypeDefTreatment.KindMask) switch
197 {
198 TypeDefTreatment.UnmangleWinRTName => name.SuffixRaw("<CLR>".Length),
199 TypeDefTreatment.PrefixWinRTName => name.WithWinRTPrefix(),
200 _ => name,
201 };
202 }
203
208
213
218}
ImmutableArray< TypeDefinitionHandle > GetNestedTypes(TypeDefinitionHandle typeDef)
static string InvalidTypeSize
Definition SR.cs:138
Definition SR.cs:7
GenericParameterHandleCollection FindGenericParametersForType(TypeDefinitionHandle typeDef)
TypeDefinitionHandle FindEnclosingType(TypeDefinitionHandle nestedTypeDef)
EntityHandle GetExtends(TypeDefinitionHandle handle)
StringHandle GetNamespace(TypeDefinitionHandle handle)
StringHandle GetName(TypeDefinitionHandle handle)
TypeAttributes GetFlags(TypeDefinitionHandle handle)
NamespaceDefinitionHandle GetNamespaceDefinition(TypeDefinitionHandle handle)
static TypeDefinitionHandle FromRowId(int rowId)
PropertyDefinitionHandleCollection GetProperties()
MethodImplementationHandleCollection GetMethodImplementations()
CustomAttributeHandleCollection GetCustomAttributes()
GenericParameterHandleCollection GetGenericParameters()
EventDefinitionHandleCollection GetEvents()
ImmutableArray< TypeDefinitionHandle > GetNestedTypes()
DeclarativeSecurityAttributeHandleCollection GetDeclarativeSecurityAttributes()
NamespaceDefinitionHandle GetProjectedNamespace()
MethodDefinitionHandleCollection GetMethods()
InterfaceImplementationHandleCollection GetInterfaceImplementations()
TypeDefinition(MetadataReader reader, uint treatmentAndRowId)
FieldDefinitionHandleCollection GetFields()