コード例 #1
0
ファイル: Constant.cs プロジェクト: zsr2531/AsmResolver
        internal Constant(MetadataImage image, MetadataRow <ElementType, byte, uint, uint> row)
            : base(row.MetadataToken)
        {
            _image = image;

            ConstantType = row.Column1;

            _parent = new LazyValue <IHasConstant>(() =>
            {
                var tableStream      = image.Header.GetStream <TableStream>();
                var hasConstantToken = tableStream.GetIndexEncoder(CodedIndex.HasConstant).DecodeIndex(row.Column3);
                return(hasConstantToken.Rid != 0 ? (IHasConstant)image.ResolveMember(hasConstantToken) : null);
            });

            _value = new LazyValue <DataBlobSignature>(() =>
                                                       DataBlobSignature.FromReader(image.Header.GetStream <BlobStream>().CreateBlobReader(row.Column4)));
        }
コード例 #2
0
        public MemberReference(MetadataImage image, MetadataRow <uint, uint, uint> row)
            : base(row.MetadataToken)
        {
            _image = image;
            var tableStream = image.Header.GetStream <TableStream>();

            _parent = new LazyValue <IMemberRefParent>(() =>
            {
                var parentToken = tableStream.GetIndexEncoder(CodedIndex.MemberRefParent).DecodeIndex(row.Column1);
                return(parentToken.Rid != 0 ? (IMemberRefParent)image.ResolveMember(parentToken) : null);
            });

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

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

            CustomAttributes = new CustomAttributeCollection(this);
        }
コード例 #3
0
        internal SecurityDeclaration(MetadataImage image, MetadataRow <SecurityAction, uint, uint> row)
            : base(row.MetadataToken)
        {
            _image = image;
            var tableStream = image.Header.GetStream <TableStream>();

            Action = row.Column1;

            _parent = new LazyValue <IHasSecurityAttribute>(() =>
            {
                var parentToken = tableStream.GetIndexEncoder(CodedIndex.HasDeclSecurity).DecodeIndex(row.Column2);
                return(parentToken.Rid != 0 ? (IHasSecurityAttribute)_image.ResolveMember(parentToken) : null);
            });

            _permissionSet = new LazyValue <PermissionSetSignature>(() =>
                                                                    PermissionSetSignature.FromReader(image,
                                                                                                      tableStream.MetadataHeader.GetStream <BlobStream>().CreateBlobReader(row.Column3)));

            CustomAttributes = new CustomAttributeCollection(this);
        }