Esempio n. 1
0
        public bool Helper_Prepare(Type type, Type ntype, MethodInfo method, EnumInfo enumInfo, List <MethodInfo> actions, List <EnumItemInfo> toilInfo)
        {
            if (PrepareMethod == null)
            {
                return(true);
            }
            var param     = PrepareMethod.GetParameters();
            var inp3      = param[3];
            var inp5      = param[5];
            var inp5_Type = inp5.ParameterType.GetInterface(typeof(IEnumerable <>).Name).GenericTypeArguments.First();

            if (!enumInfo.TryCastTo(inp3.ParameterType, out var cenumInfo))
            {
                Log.Error($"[[LC]AutoPatcher] TempError 468735468: {PrepareMethod.DeclaringType} : {PrepareMethod}\n" +
                          $"{enumInfo.GetType()} -> {inp3.ParameterType}");
                return(false);
            }
            if (!toilInfo.TryCastTo <EnumItemInfo>(inp5_Type, out var ctoilInfo))
            {
                Log.Error($"[[LC]AutoPatcher] TempError 879466879: {PrepareMethod.DeclaringType} : {PrepareMethod}\n" +
                          $"{toilInfo.GetType()} -> {inp5.ParameterType}");
                return(false);
            }
            var res = (bool)PrepareMethod.Invoke(null, new object[] { type, ntype, method, cenumInfo, actions, ctoilInfo });

            return(res);
        }