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

◆ IsCustomAttributeDefined() [2/2]

static bool System.Reflection.CustomAttribute.IsCustomAttributeDefined ( RuntimeModule decoratedModule,
int decoratedMetadataToken,
RuntimeType attributeFilterType,
int attributeCtorToken,
bool mustBeInheritable )
inlinestaticprivate

Definition at line 251 of file CustomAttribute.cs.

252 {
253 MetadataImport scope = decoratedModule.MetadataImport;
254 scope.EnumCustomAttributes(decoratedMetadataToken, out var result);
255 if (result.Length == 0)
256 {
257 return false;
258 }
259 CustomAttributeRecord customAttributeRecord = default(CustomAttributeRecord);
260 if ((object)attributeFilterType != null)
261 {
262 RuntimeType.ListBuilder<object> derivedAttributes = default(RuntimeType.ListBuilder<object>);
263 for (int i = 0; i < result.Length; i++)
264 {
265 scope.GetCustomAttributeProps(result[i], out customAttributeRecord.tkCtor.Value, out customAttributeRecord.blob);
266 if (FilterCustomAttributeRecord(customAttributeRecord.tkCtor, in scope, decoratedModule, decoratedMetadataToken, attributeFilterType, mustBeInheritable, ref derivedAttributes, out var _, out var _, out var _))
267 {
268 return true;
269 }
270 }
271 }
272 else
273 {
274 for (int j = 0; j < result.Length; j++)
275 {
276 scope.GetCustomAttributeProps(result[j], out customAttributeRecord.tkCtor.Value, out customAttributeRecord.blob);
277 if ((int)customAttributeRecord.tkCtor == attributeCtorToken)
278 {
279 return true;
280 }
281 }
282 }
283 return false;
284 }
static bool FilterCustomAttributeRecord(MetadataToken caCtorToken, in MetadataImport scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, bool mustBeInheritable, ref RuntimeType.ListBuilder< object > derivedAttributes, out RuntimeType attributeType, out IRuntimeMethodInfo ctorWithParameters, out bool isVarArg)

References System.Reflection.CustomAttributeRecord.blob, System.Reflection.MetadataImport.EnumCustomAttributes(), System.Reflection.CustomAttribute.FilterCustomAttributeRecord(), System.Reflection.MetadataImport.GetCustomAttributeProps(), System.Reflection.RuntimeModule.MetadataImport, System.Reflection.CustomAttributeRecord.tkCtor, and System.Reflection.MetadataToken.Value.