internal static void ParseAttributeArguments(ConstArray attributeBlob, ref CustomAttributeCtorParameter[] customAttributeCtorParameters, ref CustomAttributeNamedParameter[] customAttributeNamedParameters, RuntimeModule customAttributeModule)
 {
     if (customAttributeModule == null)
     {
         throw new ArgumentNullException("customAttributeModule");
     }
     if ((customAttributeCtorParameters.Length != 0) || (customAttributeNamedParameters.Length != 0))
     {
         ParseAttributeArguments(attributeBlob.Signature, attributeBlob.Length, ref customAttributeCtorParameters, ref customAttributeNamedParameters, (RuntimeAssembly) customAttributeModule.Assembly);
     }
 }
 internal static unsafe void ParseAttributeArguments(ConstArray attributeBlob, ref CustomAttributeCtorParameter[] customAttributeCtorParameters, ref CustomAttributeNamedParameter[] customAttributeNamedParameters, Module customAttributeModule)
 {
     if (customAttributeModule == null)
     {
         throw new ArgumentNullException("customAttributeModule");
     }
     if (customAttributeNamedParameters == null)
     {
         customAttributeNamedParameters = new CustomAttributeNamedParameter[0];
     }
     CustomAttributeCtorParameter[] parameterArray = customAttributeCtorParameters;
     CustomAttributeNamedParameter[] customAttributeTypedArgument = customAttributeNamedParameters;
     ParseAttributeArguments(attributeBlob.Signature, attributeBlob.Length, ref parameterArray, ref customAttributeTypedArgument, (IntPtr) customAttributeModule.Assembly.AssemblyHandle.Value);
     customAttributeCtorParameters = parameterArray;
     customAttributeNamedParameters = customAttributeTypedArgument;
 }
 internal static unsafe void ParseAttributeArguments(ConstArray attributeBlob, ref CustomAttributeCtorParameter[] customAttributeCtorParameters, ref CustomAttributeNamedParameter[] customAttributeNamedParameters, Module customAttributeModule)
 {
     if (customAttributeModule == null)
     {
         throw new ArgumentNullException("customAttributeModule");
     }
     if (customAttributeNamedParameters == null)
     {
         customAttributeNamedParameters = new CustomAttributeNamedParameter[0];
     }
     CustomAttributeCtorParameter[]  parameterArray = customAttributeCtorParameters;
     CustomAttributeNamedParameter[] customAttributeTypedArgument = customAttributeNamedParameters;
     ParseAttributeArguments(attributeBlob.Signature, attributeBlob.Length, ref parameterArray, ref customAttributeTypedArgument, (IntPtr)customAttributeModule.Assembly.AssemblyHandle.Value);
     customAttributeCtorParameters  = parameterArray;
     customAttributeNamedParameters = customAttributeTypedArgument;
 }
예제 #4
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        private CustomAttributeData(RuntimeModule scope, CustomAttributeRecord caRecord)
        {
            m_scope = scope;
            m_ctor = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(scope, caRecord.tkCtor);

            ParameterInfo[] parameters = m_ctor.GetParametersNoCopy();            
            m_ctorParams = new CustomAttributeCtorParameter[parameters.Length];
            for (int i = 0; i < parameters.Length; i++)
                m_ctorParams[i] = new CustomAttributeCtorParameter(InitCustomAttributeType((RuntimeType)parameters[i].ParameterType));

            FieldInfo[] fields = m_ctor.DeclaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            PropertyInfo[] properties = m_ctor.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            m_namedParams = new CustomAttributeNamedParameter[properties.Length + fields.Length];
            for (int i = 0; i < fields.Length; i++)
                m_namedParams[i] = new CustomAttributeNamedParameter(
                    fields[i].Name, CustomAttributeEncoding.Field, InitCustomAttributeType((RuntimeType)fields[i].FieldType));
            for (int i = 0; i < properties.Length; i++)
                m_namedParams[i + fields.Length] = new CustomAttributeNamedParameter(
                    properties[i].Name, CustomAttributeEncoding.Property, InitCustomAttributeType((RuntimeType)properties[i].PropertyType));

            m_members = new MemberInfo[fields.Length + properties.Length];
            fields.CopyTo(m_members, 0);
            properties.CopyTo(m_members, fields.Length);

            CustomAttributeEncodedArgument.ParseAttributeArguments(caRecord.blob, ref m_ctorParams, ref m_namedParams, m_scope);
        }
예제 #5
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static void ParseAttributeArguments(ConstArray attributeBlob, 
            ref CustomAttributeCtorParameter[] customAttributeCtorParameters,
            ref CustomAttributeNamedParameter[] customAttributeNamedParameters,
            RuntimeModule customAttributeModule)
        {
            if (customAttributeModule == null)
                throw new ArgumentNullException("customAttributeModule");
            Contract.EndContractBlock();

            Contract.Assert(customAttributeCtorParameters != null);
            Contract.Assert(customAttributeNamedParameters != null);

            if (customAttributeCtorParameters.Length != 0 || customAttributeNamedParameters.Length != 0)
            {
                unsafe
                {
                    ParseAttributeArguments(
                        attributeBlob.Signature,
                        (int)attributeBlob.Length,
                        ref customAttributeCtorParameters,
                        ref customAttributeNamedParameters,
                        (RuntimeAssembly)customAttributeModule.Assembly);
                }
            }
        }
예제 #6
0
 private static extern void ParseAttributeArguments(
     IntPtr pCa, 
     int cCa, 
     ref CustomAttributeCtorParameter[] CustomAttributeCtorParameters,
     ref CustomAttributeNamedParameter[] CustomAttributeTypedArgument,
     RuntimeAssembly assembly);
        internal static void ParseAttributeArguments(ConstArray attributeBlob, 
            ref CustomAttributeCtorParameter[] customAttributeCtorParameters,
            ref CustomAttributeNamedParameter[] customAttributeNamedParameters,
            Module customAttributeModule)
        {
            if (customAttributeModule == null)
                throw new ArgumentNullException("customAttributeModule");

            if (customAttributeNamedParameters == null)
                customAttributeNamedParameters = new CustomAttributeNamedParameter[0];

            CustomAttributeCtorParameter[] _customAttributeCtorParameters = customAttributeCtorParameters;
            CustomAttributeNamedParameter[] _customAttributeNamedParameters = customAttributeNamedParameters;

            unsafe 
            {
                ParseAttributeArguments(
                    attributeBlob.Signature, 
                    (int)attributeBlob.Length, 
                    ref _customAttributeCtorParameters, 
                    ref _customAttributeNamedParameters,
                    (IntPtr)customAttributeModule.Assembly.AssemblyHandle.Value);
            }

            customAttributeCtorParameters = _customAttributeCtorParameters;
            customAttributeNamedParameters = _customAttributeNamedParameters;
        }