Exemple #1
0
        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));
                }
            }
        }
Exemple #2
0
 private static Action <T, F> CreateFastFieldSetterForCecil <T, F>(FieldInfo fieldInfo)
 {
     return(CecilFastReflectionHelper.CreateFastFieldSetter <T, F>(fieldInfo));
 }