コード例 #1
0
        protected override void ReadMetadataInformation()
        {
            base.ReadMetadataInformation();
            NuGenAssembly assembly = BaseTypeDefinition.ModuleScope.Assembly;

            try
            {
                assembly.OpenMetadataInterfaces();

                if ((Flags & CorFieldAttr.fdHasDefault) == CorFieldAttr.fdHasDefault)
                {
                    object defaultValueNumber;
                    DefaultValueAsString = NuGenHelperFunctions.ReadDefaultValue(DefaultValueType, DefaultValue, DefaultValueLength, out defaultValueNumber);
                    DefaultValueNumber   = defaultValueNumber;
                }

                if ((Flags & CorFieldAttr.fdHasFieldMarshal) == CorFieldAttr.fdHasFieldMarshal)
                {
                    MarshalAsTypeString = string.Format("marshal({0})", NuGenHelperFunctions.ReadMarshalDescriptor(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly.AllTokens, Token, 0));
                }

                if ((Flags & CorFieldAttr.fdPinvokeImpl) == CorFieldAttr.fdPinvokeImpl)
                {
                    PinvokeMap = NuGenHelperFunctions.ReadPinvokeMap(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly, Token);
                }

                CustomAttributes = NuGenHelperFunctions.EnumCustomAttributes(assembly.Import, BaseTypeDefinition.ModuleScope.Assembly, this);
            }
            finally
            {
                assembly.CloseMetadataInterfaces();
            }
        }
コード例 #2
0
ファイル: NuGenParameter.cs プロジェクト: carlhuth/GenXSource
        private void ReadDefaultValue()
        {
            if ((AttributeFlags & CorParamAttr.pdHasDefault) == CorParamAttr.pdHasDefault)
            {
                StringBuilder defaultValue = new StringBuilder();
                defaultValue.Append(".param [");
                defaultValue.Append(OrdinalIndex);
                defaultValue.Append("] = ");

                object defaultValueNumber;
                defaultValue.Append(NuGenHelperFunctions.ReadDefaultValue(ElementType, DefaultValue, DefaultValueLength, out defaultValueNumber));

                DefaultValueAsString = defaultValue.ToString();
            }
        }