Ejemplo n.º 1
0
        public VariableDefinition[] ReadVariableSignature(uint signature, MethodDefinition parentMethod)
        {
            VariableDefinition[] variables = null;
            using (BinaryReader reader = GetBlobReader(signature))
            {

                byte local_sig = reader.ReadByte();

                if (local_sig != 0x7)
                    throw new ArgumentException("Signature doesn't refer to a valid local variable signature");

                uint count = ReadCompressedUInt32(reader);

                if (count == 0)
                    return null;

                variables = new VariableDefinition[count];

                for (int i = 0; i < count; i++)
                    variables[i] = new VariableDefinition(i, ReadTypeReference(reader, (ElementType)reader.ReadByte(), parentMethod));
            }
            return variables;
        }
Ejemplo n.º 2
0
        public VariableDefinition[] ReadVariableSignature(uint signature, MethodDefinition parentMethod)
        {
            VariableDefinition[] variables = null;
            BlobSignatureReader reader;
            if (TryGetBlobReader(signature, parentMethod, out reader))
            {
                using (reader)
                {
                    reader.GenericContext = parentMethod;

                    byte local_sig = reader.ReadByte();

                    if (local_sig != 0x7)
                        throw new ArgumentException("Signature doesn't refer to a valid local variable signature");

                    uint count = NETGlobals.ReadCompressedUInt32(reader);

                    if (count == 0)
                        return null;

                    variables = new VariableDefinition[count];

                    for (int i = 0; i < count; i++)
                        variables[i] = new VariableDefinition(i, reader.ReadTypeReference());
                }
            }
            return variables;
        }