예제 #1
0
        internal PropertyDefinition(MetadataImage image, MetadataRow <PropertyAttributes, uint, uint> row)
            : base(row.MetadataToken)
        {
            _image     = image;
            Attributes = row.Column1;

            _name = new LazyValue <string>(() =>
                                           image.Header.GetStream <StringStream>().GetStringByOffset(row.Column2));

            _signature = new LazyValue <PropertySignature>(()
                                                           => PropertySignature.FromReader(image, image.Header.GetStream <BlobStream>().CreateBlobReader(row.Column3)));

            _propertyMap = new LazyValue <PropertyMap>(() =>
            {
                var table  = image.Header.GetStream <TableStream>().GetTable(MetadataTokenType.PropertyMap);
                var mapRow = table.GetRowClosestToKey(1, row.MetadataToken.Rid);
                return(mapRow != null ? (PropertyMap)table.GetMemberFromRow(image, mapRow) : null);
            });

            _constant = new LazyValue <Constant>(() =>
            {
                var table       = (ConstantTable)image.Header.GetStream <TableStream>().GetTable(MetadataTokenType.Constant);
                var constantRow = table.FindConstantOfOwner(row.MetadataToken);
                return(constantRow != null ? (Constant)table.GetMemberFromRow(image, constantRow) : null);
            });

            CustomAttributes = new CustomAttributeCollection(this);
            Semantics        = new MethodSemanticsCollection(this);
        }
예제 #2
0
 internal PropertyDefinition(MetadataHeader header, MetadataToken token, MetadataRow <ushort, uint, uint> row)
     : base(header, token, row)
 {
     Attributes = (PropertyAttributes)row.Column1;
     _name      = new LazyValue <string>(() => header.GetStream <StringStream>().GetStringByOffset(row.Column2));
     _signature = new LazyValue <PropertySignature>(() => PropertySignature.FromReader(header, header.GetStream <BlobStream>().CreateBlobReader(row.Column3)));
 }
예제 #3
0
        /// <inheritdoc />
        protected override PropertySignature GetSignature()
        {
            var reader = _parentModule.DotNetDirectory.Metadata
                         .GetStream <BlobStream>()
                         .GetBlobReaderByIndex(_row.Type);

            return(PropertySignature.FromReader(_parentModule, reader));
        }