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

◆ RuntimeCustomAttributeData() [1/2]

System.Reflection.RuntimeCustomAttributeData.RuntimeCustomAttributeData ( RuntimeModule scope,
MetadataToken caCtorToken,
in ConstArray blob )
inlineprivate

Definition at line 319 of file RuntimeCustomAttributeData.cs.

320 {
321 m_scope = scope;
322 m_ctor = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(scope, caCtorToken);
324 {
325 Type type = scope.ResolveType(scope.MetadataImport.GetParentToken(caCtorToken), null, null);
326 m_ctor = (RuntimeConstructorInfo)scope.ResolveMethod(caCtorToken, type.GenericTypeArguments, null).MethodHandle.GetMethodInfo();
327 }
328 ParameterInfo[] parametersNoCopy = m_ctor.GetParametersNoCopy();
329 m_ctorParams = new CustomAttributeCtorParameter[parametersNoCopy.Length];
330 for (int i = 0; i < parametersNoCopy.Length; i++)
331 {
332 m_ctorParams[i] = new CustomAttributeCtorParameter(InitCustomAttributeType((RuntimeType)parametersNoCopy[i].ParameterType));
333 }
334 FieldInfo[] fields = m_ctor.DeclaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
335 PropertyInfo[] properties = m_ctor.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
336 m_namedParams = new CustomAttributeNamedParameter[properties.Length + fields.Length];
337 for (int j = 0; j < fields.Length; j++)
338 {
339 m_namedParams[j] = new CustomAttributeNamedParameter(fields[j].Name, CustomAttributeEncoding.Field, InitCustomAttributeType((RuntimeType)fields[j].FieldType));
340 }
341 for (int k = 0; k < properties.Length; k++)
342 {
343 m_namedParams[k + fields.Length] = new CustomAttributeNamedParameter(properties[k].Name, CustomAttributeEncoding.Property, InitCustomAttributeType((RuntimeType)properties[k].PropertyType));
344 }
345 m_members = new MemberInfo[fields.Length + properties.Length];
346 fields.CopyTo(m_members, 0);
347 properties.CopyTo(m_members, fields.Length);
348 CustomAttributeEncodedArgument.ParseAttributeArguments(blob, ref m_ctorParams, ref m_namedParams, m_scope);
349 }
virtual ParameterInfo[] GetParametersNoCopy()
RuntimeMethodHandle MethodHandle
Definition MethodBase.cs:84
static CustomAttributeType InitCustomAttributeType(RuntimeType parameterType)
readonly CustomAttributeNamedParameter[] m_namedParams
readonly CustomAttributeCtorParameter[] m_ctorParams
FieldInfo[] GetFields()
Definition Type.cs:616
PropertyInfo[] GetProperties()
Definition Type.cs:877
virtual bool IsGenericType
Definition Type.cs:111
IRuntimeMethodInfo GetMethodInfo()

References System.Reflection.MemberInfo.DeclaringType, System.Type.GetFields(), System.RuntimeType.GetMethodBase(), System.Reflection.MethodBase.GetParametersNoCopy(), System.Reflection.MetadataImport.GetParentToken(), System.Type.GetProperties(), System.Reflection.RuntimeCustomAttributeData.InitCustomAttributeType(), System.Type.IsGenericType, System.Reflection.RuntimeCustomAttributeData.m_ctor, System.Reflection.RuntimeCustomAttributeData.m_ctorParams, System.Reflection.RuntimeCustomAttributeData.m_members, System.Reflection.RuntimeCustomAttributeData.m_namedParams, System.Reflection.RuntimeCustomAttributeData.m_scope, System.Reflection.RuntimeModule.MetadataImport, System.Reflection.Name, System.Reflection.CustomAttributeEncodedArgument.ParseAttributeArguments(), System.Reflection.RuntimeModule.ResolveMethod(), System.Reflection.RuntimeModule.ResolveType(), and System.type.

Referenced by System.Reflection.RuntimeCustomAttributeData.GetCombinedList(), and System.Reflection.RuntimeCustomAttributeData.GetCustomAttributes().