internal MetadataFieldInfo(IMetadataImport importer, int fieldToken, MetadataType declaringType) { m_importer = importer; m_fieldToken = fieldToken; m_declaringType = declaringType; // Initialize int mdTypeDef; int pchField, pcbSigBlob, pdwCPlusTypeFlab, pcchValue, pdwAttr; IntPtr ppvSigBlob; IntPtr ppvRawValue; m_importer.GetFieldProps(m_fieldToken, out mdTypeDef, null, 0, out pchField, out pdwAttr, out ppvSigBlob, out pcbSigBlob, out pdwCPlusTypeFlab, out ppvRawValue, out pcchValue ); StringBuilder szField = new StringBuilder(pchField); m_importer.GetFieldProps(m_fieldToken, out mdTypeDef, szField, szField.Capacity, out pchField, out pdwAttr, out ppvSigBlob, out pcbSigBlob, out pdwCPlusTypeFlab, out ppvRawValue, out pcchValue ); m_fieldAttributes = (FieldAttributes)pdwAttr; m_name = szField.ToString(); // Get the values for static literal fields with primitive types FieldAttributes staticLiteralField = FieldAttributes.Static | FieldAttributes.HasDefault | FieldAttributes.Literal; if ((m_fieldAttributes & staticLiteralField) == staticLiteralField) { m_value = ParseDefaultValue(declaringType, ppvSigBlob, ppvRawValue, pcchValue); } // [Xamarin] Expression evaluator. MetadataHelperFunctionsExtensions.GetCustomAttribute(m_importer, m_fieldToken, typeof(DebuggerBrowsableAttribute)); }
internal MetadataFieldInfo(CorApi.Portable.IMetaDataImport importer, int fieldToken, MetadataType declaringType) { unsafe { m_importer = importer; m_fieldToken = fieldToken; m_declaringType = declaringType; // Initialize int mdTypeDef; int pchField, pcbSigBlob, pdwCPlusTypeFlab, pcchValue, pdwAttr; IntPtr ppvSigBlob; IntPtr ppvRawValue; m_importer.GetFieldProps(m_fieldToken, out mdTypeDef, IntPtr.Zero, 0, out pchField, out pdwAttr, out ppvSigBlob, out pcbSigBlob, out pdwCPlusTypeFlab, out ppvRawValue, out pcchValue ); var szField = stackalloc char[pchField]; m_importer.GetFieldProps(m_fieldToken, out mdTypeDef, (IntPtr)szField, pchField, out pchField, out pdwAttr, out ppvSigBlob, out pcbSigBlob, out pdwCPlusTypeFlab, out ppvRawValue, out pcchValue ); m_fieldAttributes = (FieldAttributes)pdwAttr; m_name = new string(szField, 0, pchField - 1); // Get the values for static literal fields with primitive types FieldAttributes staticLiteralField = FieldAttributes.Static | FieldAttributes.HasDefault | FieldAttributes.Literal; if ((m_fieldAttributes & staticLiteralField) == staticLiteralField) { m_value = ParseDefaultValue(declaringType, ppvSigBlob, ppvRawValue, pcchValue); } // [Xamarin] Expression evaluator. MetadataHelperFunctionsExtensions.GetCustomAttribute(m_importer, m_fieldToken, typeof(DebuggerBrowsableAttribute)); } }
internal MetadataPropertyInfo(IMetadataImport importer, int propertyToken, MetadataType declaringType) { m_importer = importer; m_propertyToken = propertyToken; m_declaringType = declaringType; int mdTypeDef; int pchProperty; int pdwPropFlags; IntPtr ppvSig; int pbSig; int pdwCPlusTypeFlag; IntPtr ppDefaultValue; int pcchDefaultValue; int rmdOtherMethod; int pcOtherMethod; m_importer.GetPropertyProps( m_propertyToken, out mdTypeDef, null, 0, out pchProperty, out pdwPropFlags, out ppvSig, out pbSig, out pdwCPlusTypeFlag, out ppDefaultValue, out pcchDefaultValue, out m_pmdSetter, out m_pmdGetter, out rmdOtherMethod, 0, out pcOtherMethod); StringBuilder szProperty = new StringBuilder(pchProperty); m_importer.GetPropertyProps( m_propertyToken, out mdTypeDef, szProperty, pchProperty, out pchProperty, out pdwPropFlags, out ppvSig, out pbSig, out pdwCPlusTypeFlag, out ppDefaultValue, out pcchDefaultValue, out m_pmdSetter, out m_pmdGetter, out rmdOtherMethod, 0, out pcOtherMethod); m_propAttributes = (PropertyAttributes)pdwPropFlags; m_name = szProperty.ToString(); MetadataHelperFunctionsExtensions.GetCustomAttribute(importer, propertyToken, typeof(System.Diagnostics.DebuggerBrowsableAttribute)); if (!m_importer.IsValidToken((uint)m_pmdGetter)) { m_pmdGetter = 0; } if (!m_importer.IsValidToken((uint)m_pmdSetter)) { m_pmdSetter = 0; } }
internal MetadataPropertyInfo(CorApi.Portable.IMetaDataImport importer, int propertyToken, MetadataType declaringType) { unsafe { m_importer = importer; m_propertyToken = propertyToken; m_declaringType = declaringType; int mdTypeDef; int pchProperty; int pdwPropFlags; IntPtr ppvSig; int pbSig; int pdwCPlusTypeFlag; IntPtr ppDefaultValue; int pcchDefaultValue; int[] rmdOtherMethod = new int[0]; int pcOtherMethod; m_importer.GetPropertyProps( m_propertyToken, out mdTypeDef, IntPtr.Zero, 0, out pchProperty, out pdwPropFlags, out ppvSig, out pbSig, out pdwCPlusTypeFlag, out ppDefaultValue, out pcchDefaultValue, out m_pmdSetter, out m_pmdGetter, rmdOtherMethod, 0, out pcOtherMethod); var szProperty = stackalloc char[pchProperty]; m_importer.GetPropertyProps( m_propertyToken, out mdTypeDef, (IntPtr)szProperty, pchProperty, out pchProperty, out pdwPropFlags, out ppvSig, out pbSig, out pdwCPlusTypeFlag, out ppDefaultValue, out pcchDefaultValue, out m_pmdSetter, out m_pmdGetter, rmdOtherMethod, 0, out pcOtherMethod); m_propAttributes = (PropertyAttributes)pdwPropFlags; m_name = new string(szProperty, 0, pchProperty - 1); } MetadataHelperFunctionsExtensions.GetCustomAttribute(importer, propertyToken, typeof(System.Diagnostics.DebuggerBrowsableAttribute)); if (!m_importer.IsValidToken(m_pmdGetter)) { m_pmdGetter = 0; } if (!m_importer.IsValidToken(m_pmdSetter)) { m_pmdSetter = 0; } }