FromReader() public static method

public static FromReader ( MetadataHeader header, IBinaryStreamReader reader ) : VariableSignature
header MetadataHeader
reader IBinaryStreamReader
return VariableSignature
Beispiel #1
0
        public new static LocalVariableSignature FromReader(MetadataImage image, IBinaryStreamReader reader)
        {
            var signature = new LocalVariableSignature
            {
                Attributes = (CallingConventionAttributes)reader.ReadByte()
            };

            var count = reader.ReadCompressedUInt32();

            for (int i = 0; i < count; i++)
            {
                signature.Variables.Add(VariableSignature.FromReader(image, reader));
            }
            return(signature);
        }
Beispiel #2
0
        /// <summary>
        /// Reads a single local variable signature at the current position of the provided stream reader.
        /// </summary>
        /// <param name="image">The image the signature was defined in.</param>
        /// <param name="reader">The reader to use.</param>
        /// <param name="readToEnd">Determines whether any extra data after the signature should be read and
        /// put into the <see cref="ExtendableBlobSignature.ExtraData"/> property.</param>
        /// <param name="protection">The recursion protection that is used to detect malicious loops in the metadata.</param>
        /// <returns>The read signature.</returns>
        public new static LocalVariableSignature FromReader(
            MetadataImage image,
            IBinaryStreamReader reader,
            bool readToEnd, RecursionProtection protection)
        {
            var signature = new LocalVariableSignature
            {
                Attributes = (CallingConventionAttributes)reader.ReadByte()
            };

            uint count = reader.ReadCompressedUInt32();

            for (int i = 0; i < count; i++)
            {
                signature.Variables.Add(VariableSignature.FromReader(image, reader, protection));
            }

            if (readToEnd)
            {
                signature.ExtraData = reader.ReadToEnd();
            }

            return(signature);
        }