bool RestoreMethod(MethodDef method)
        {
            int?methodId = GetMethodId(method);

            if (methodId == null)
            {
                return(false);
            }

            var parameters = method.Parameters;
            var methodInfo = methodInfos[methodId.Value];

            methodInfos.Remove(methodId.Value);
            var methodReader = new MethodReader(module, methodInfo.data, parameters);

            methodReader.HasDelegateTypeFlag = MethodReaderHasDelegateTypeFlag;
            methodReader.Read();

            RestoreMethod(method, methodReader);
            if (methodReader.DelegateType != null)
            {
                delegateTypes.Add(methodReader.DelegateType);
            }

            return(true);
        }
        bool restoreMethod(MethodDef method)
        {
            int methodId = getMethodId(method);

            if (methodId == INVALID_METHOD_ID)
            {
                return(false);
            }

            var parameters = method.Parameters;
            var methodInfo = methodInfos[methodId];

            methodInfos.Remove(methodId);
            var methodReader = new MethodReader(module, methodInfo.data, parameters);

            methodReader.read();

            restoreMethod(method, methodReader);
            delegateTypes.Add(methodReader.DelegateType);

            return(true);
        }
 static void RestoreMethod(MethodDef method, MethodReader methodReader)
 {
     // body.MaxStackSize = <let dnlib calculate this>
     method.Body.InitLocals = methodReader.InitLocals;
     methodReader.RestoreMethod(method);
 }
Exemple #4
0
 static void restoreMethod(MethodDefinition method, MethodReader methodReader)
 {
     // body.MaxStackSize = <let Mono.Cecil calculate this>
     method.Body.InitLocals = methodReader.InitLocals;
     methodReader.restoreMethod(method);
 }