Example #1
0
        IMethod ResolveEazCall_Helper(
            Int32 value, Type[] genericTypes, Type[] declaringGenericTypes, Boolean flag)
        {
            this.Stream.Position = value;

            if (this.Version == SerializationVersion.V1)
            {
                if (this.Reader.ReadByte() != 0)
                {
                    throw new InvalidDataException();
                }
            }

            EazCallData data = new EazCallData(this.Reader);

            var delcaringType = (this.ResolveType_NoLock(data.DeclaringType) as TypeDef);

            if (delcaringType == null)
            {
                throw new Exception("Unable to resolve the declaring type of the Eaz_Call method operand");
            }

            var methodSig = GetMethodSig(data);

            // Todo: Factor in generics?
            var method = delcaringType.FindMethodCheckBaseType(data.Name, methodSig);

            if (method == null)
            {
                throw new Exception("Unable to resolve Eaz_Call operand from declaring type + method name");
            }

            return(method);
        }
Example #2
0
        /// <summary>
        /// Convert some EazCall data into a method signature.
        /// </summary>
        /// <param name="data">Data</param>
        /// <returns>Signature</returns>
        MethodSig GetMethodSig(EazCallData data)
        {
            var returnType = this.ResolveType_NoLock(data.ReturnType).ToTypeSig(true);
            var paramTypes = data.Parameters.Select((p) => {
                return(this.ResolveType_NoLock(p.Type).ToTypeSig(true));
            }).ToArray();

            // Unsure about how EazCallData stores/handles generics

            if (data.IsStatic)
            {
                return(MethodSig.CreateStatic(returnType, paramTypes));
            }
            else
            {
                paramTypes = paramTypes.Skip(1).ToArray();
                return(MethodSig.CreateInstance(returnType, paramTypes));
            }
        }
Example #3
0
        IMethod ResolveEazCall_Helper(
			Int32 value, Type[] genericTypes, Type[] declaringGenericTypes, Boolean flag)
        {
            this.Stream.Position = value;

            // The virtual machine does this check:
            if (this.Reader.ReadByte() != 0)
                throw new InvalidDataException();

            EazCallData data = new EazCallData(this.Reader);

            var delcaringType = (this.ResolveType_NoLock(data.DeclaringType) as TypeDef);
            if (delcaringType == null)
                throw new Exception("Unable to resolve the declaring type of the Eaz_Call method operand");

            var methodSig = GetMethodSig(data);

            // Todo: Factor in generics?
            var method = delcaringType.FindMethodCheckBaseType(data.Name, methodSig);
            if (method == null)
                throw new Exception("Unable to resolve Eaz_Call operand from declaring type + method name");

            return method;
        }
Example #4
0
        /// <summary>
        /// Convert some EazCall data into a method signature.
        /// </summary>
        /// <param name="data">Data</param>
        /// <returns>Signature</returns>
        MethodSig GetMethodSig(EazCallData data)
        {
            var returnType = this.ResolveType_NoLock(data.ReturnType).ToTypeSig(true);
            var paramTypes = data.Parameters.Select((p) => {
                return this.ResolveType_NoLock(p.Type).ToTypeSig(true);
            }).ToArray();

            // Unsure about how EazCallData stores/handles generics

            if (data.IsStatic)
                return MethodSig.CreateStatic(returnType, paramTypes);
            else
            {
                paramTypes = paramTypes.Skip(1).ToArray();
                return MethodSig.CreateInstance(returnType, paramTypes);
            }
        }