Ejemplo n.º 1
0
        void ReadMarshalSpecs()
        {
            if (!m_tHeap.HasTable(FieldMarshalTable.RId))
            {
                return;
            }

            FieldMarshalTable fmTable = m_tableReader.GetFieldMarshalTable();

            for (int i = 0; i < fmTable.Rows.Count; i++)
            {
                FieldMarshalRow fmRow = fmTable [i];

                if (fmRow.Parent.RID == 0)
                {
                    continue;
                }

                IHasMarshalSpec owner = null;
                switch (fmRow.Parent.TokenType)
                {
                case TokenType.Field:
                    owner = GetFieldDefAt(fmRow.Parent.RID);
                    break;

                case TokenType.Param:
                    owner = GetParamDefAt(fmRow.Parent.RID);
                    break;
                }

                owner.MarshalSpec = BuildMarshalDesc(
                    m_sigReader.GetMarshalSig(fmRow.NativeType), owner);
            }
        }
Ejemplo n.º 2
0
            public int Compare(object x, object y)
            {
                FieldMarshalRow a = x as FieldMarshalRow;
                FieldMarshalRow b = y as FieldMarshalRow;

                return(Comparer.Default.Compare(
                           Utilities.CompressMetadataToken(CodedIndex.HasFieldMarshal, a.Parent),
                           Utilities.CompressMetadataToken(CodedIndex.HasFieldMarshal, b.Parent)));
            }
Ejemplo n.º 3
0
 public override void FromRawData(byte [] buff, int offs, int numRows)
 {
     for (int i = numRows; --i >= 0;)
     {
         Row row = new FieldMarshalRow(this);
         row.FromRawData(buff, offs);
         Add(row);
         offs += FieldMarshalRow.LogicalSize;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Reads the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="result">The result.</param>
        public void Read(TokenTypes token, out FieldMarshalRow result)
        {
            if ((token & TokenTypes.TableMask) != TokenTypes.FieldMarshal)
            {
                throw new ArgumentException("Invalid token type for FieldMarshalRow.", "token");
            }

            using (BinaryReader reader = CreateReaderForToken(token))
            {
                result = new FieldMarshalRow(ReadIndexValue(reader, IndexType.HasFieldMarshal), ReadIndexValue(reader, IndexType.BlobHeap));
            }
        }
Ejemplo n.º 5
0
        private void AddFieldMarshal(MetadataToken ownerToken, IHasFieldMarshal owner)
        {
            if (owner.MarshalDescriptor is null)
            {
                return;
            }

            var table   = Metadata.TablesStream.GetSortedTable <IHasFieldMarshal, FieldMarshalRow>(TableIndex.FieldMarshal);
            var encoder = Metadata.TablesStream.GetIndexEncoder(CodedIndex.HasFieldMarshal);

            var row = new FieldMarshalRow(
                encoder.EncodeToken(ownerToken),
                Metadata.BlobStream.GetBlobIndex(this, owner.MarshalDescriptor, DiagnosticBag));

            table.Add(owner, row);
        }
Ejemplo n.º 6
0
 public virtual void VisitFieldMarshalRow(FieldMarshalRow row)
 {
 }
Ejemplo n.º 7
0
        void IMetadataProvider.Read(TokenTypes token, out FieldMarshalRow result)
        {
            TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables];

            theap.Read(token, out result);
        }
 public virtual void VisitFieldMarshalRow(FieldMarshalRow row)
 {
 }