Ejemplo n.º 1
0
        /// <summary>
        /// Parses the signature.
        /// </summary>
        /// <param name="reader">The reader.</param>
        protected sealed override void ParseSignature(SignatureReader reader)
        {
            byte value = reader.ReadByte();

            // Check for instance signature
            if (HAS_THIS == (value & HAS_THIS))
            {
                HasThis = true;
            }

            if (HAS_EXPLICIT_THIS == (value & HAS_EXPLICIT_THIS))
            {
                HasExplicitThis = true;
            }

            if (GENERIC == (value & GENERIC))
            {
                MethodCallingConvention = MethodCallingConvention.Generic;
                GenericParameterCount   = reader.ReadCompressedInt32();
            }
            else if (VARARG == (value & VARARG))
            {
                MethodCallingConvention = MethodCallingConvention.VarArg;
            }
            else if (C == (value & C))
            {
            }
            else if (STDCALL == (value & STDCALL))
            {
            }
            else if (THISCALL == (value & THISCALL))
            {
            }
            else if (FASTCALL == (value & FASTCALL))
            {
            }
            else if ((value & 0x1F) != 0x00)
            {
                throw new InvalidOperationException(@"Invalid method definition signature.");
            }

            // Number of parameters
            int paramCount = reader.ReadCompressedInt32();

            Parameters = new SigType[paramCount];

            // Read the return type
            ReturnType = SigType.ParseTypeSignature(reader);

            // Read all parameters
            for (int i = 0; i < paramCount; i++)
            {
                Parameters[i] = SigType.ParseTypeSignature(reader);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses the signature.
        /// </summary>
        /// <param name="reader">The reader.</param>
        protected override void ParseSignature(SignatureReader reader)
        {
            if (reader.ReadByte() != 0x0A)
            {
                throw new InvalidOperationException(@"Invalid signature.");
            }

            int genArgCount = reader.ReadCompressedInt32();

            Types = new SigType[genArgCount];
            for (int i = 0; i < genArgCount; i++)
            {
                Types[i] = SigType.ParseTypeSignature(reader);
            }
        }
Ejemplo n.º 3
0
 protected override void ParseSignature(SignatureReader reader)
 {
     ParseModifier(reader);
     CustomMods = CustomMod.ParseCustomMods(reader);
     Type       = SigType.ParseTypeSignature(reader);
 }