// 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)); } } }
private static Action <T, F> CreateFastFieldSetterForCecil <T, F>(FieldInfo fieldInfo) { try { return(CecilFastReflectionHelper.CreateFastFieldSetter <T, F>(fieldInfo)); } catch (Exception e1) { try { XuaLogger.Common.Warn(e1, "Failed creating fast reflection delegate through with cecil. Retrying with reflection emit..."); return(ReflectionEmitFastReflectionHelper.CreateFastFieldSetter <T, F>(fieldInfo)); } catch (Exception e2) { XuaLogger.Common.Warn(e2, "Failed creating fast reflection delegate through with reflection emit. Falling back to standard reflection..."); return((target, value) => fieldInfo.SetValue(target, value)); } } }
private static Action <T, F> CreateFastFieldSetterForCecil <T, F>(FieldInfo fieldInfo) { return(CecilFastReflectionHelper.CreateFastFieldSetter <T, F>(fieldInfo)); }
// 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));; }