Exemplo n.º 1
0
        // wrapped method calls to ensure the class is not initialized if unavailable
        private static FastReflectionDelegate GetFastDelegateForCecil(MethodBase method, bool directBoxValueAccess, bool forceNonVirtCall)
        {
            try
            {
                return(CecilFastReflectionHelper.CreateFastDelegate(method, directBoxValueAccess, forceNonVirtCall));
            }
            catch (Exception e1)
            {
                try
                {
                    XuaLogger.Common.Warn(e1, "Failed creating fast reflection delegate through with cecil. Retrying with reflection emit...");

                    return(ReflectionEmitFastReflectionHelper.CreateFastDelegate(method, directBoxValueAccess, forceNonVirtCall));;
                }
                catch (Exception e2)
                {
                    XuaLogger.Common.Warn(e2, "Failed creating fast reflection delegate through with reflection emit. Falling back to standard reflection...");

                    return((target, args) => method.Invoke(target, args));
                }
            }
        }
Exemplo n.º 2
0
 // wrapped method calls to ensure the class is not initialized if unavailable
 private static FastReflectionDelegate GetFastDelegateForCecil(MethodBase method, bool directBoxValueAccess, bool forceNonVirtCall)
 {
     return(CecilFastReflectionHelper.CreateFastDelegate(method, directBoxValueAccess, forceNonVirtCall));;
 }