示例#1
0
        private static Func <object[], object> NewClass(Type item)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            Func <object> func = ResolverErrorFilter.LoginReader(item, isconnection: false) ? ConfigProperty._0001()._0001 <object>(item) : null;

            return(delegate(object[] P_0)
            {
                //Discarded unreachable code: IL_0002
                //IL_0003: Incompatible stack heights: 0 vs 1
                try
                {
                    if (P_0 != null)
                    {
                        Type[] types = P_0.Select(delegate(object res)
                        {
                            //Discarded unreachable code: IL_0002
                            //IL_0003: Incompatible stack heights: 0 vs 1
                            if (res == null)
                            {
                                throw new InvalidOperationException("Cannot pass a null parameter to the constructor.");
                            }
                            return res.GetType();
                        }).ToArray();
                        ConstructorInfo constructor = item.GetConstructor(types);
                        if (!(constructor != null))
                        {
                            throw new ListenerTestItem("No matching parameterized constructor found for '{0}'.".ListReader(CultureInfo.InvariantCulture, item));
                        }
                        return ConfigProperty._0001()._0001(constructor)(P_0);
                    }
                    if (func == null)
                    {
                        throw new ListenerTestItem("No parameterless constructor defined for '{0}'.".ListReader(CultureInfo.InvariantCulture, item));
                    }
                    return func();
                }
                catch (Exception cont)
                {
                    throw new ListenerTestItem("Error creating '{0}'.".ListReader(CultureInfo.InvariantCulture, item), cont);
                }
            });
        }
        public static ModelInstanceExpression InitIssuer(Type var1, MethodBase cfg, string[] field)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            VisitorComposer visitorComposer = ConfigProperty._0001();

            GDBD.Specifications.AdapterClassSpec <object> last = null;
            if (cfg != null)
            {
                last = visitorComposer._0001(cfg);
            }
            else if (ResolverErrorFilter.LoginReader(var1, isconnection: false))
            {
                Func <object> func = visitorComposer._0001 <object>(var1);
                last = ((object[] P_0) => func());
            }
            ModelInstanceExpression modelInstanceExpression = new ModelInstanceExpression(last);

            Newtonsoft.Rules.ClientInstanceRule <object, object> clientInstanceRule;
            Newtonsoft.Rules.ClientInstanceRule <object, object> clientInstanceRule2;
            foreach (string text in field)
            {
                MemberInfo[] member = var1.GetMember(text, BindingFlags.Instance | BindingFlags.Public);
                if (member.Length != 1)
                {
                    throw new ArgumentException("Expected a single member with the name '{0}'.".ListReader(CultureInfo.InvariantCulture, text));
                }
                MemberInfo memberInfo = member.Single();
                StubTest   stubTest   = new StubTest();
                switch (memberInfo.DefineReader())
                {
                case MemberTypes.Field:
                case MemberTypes.Property:
                    if (ResolverErrorFilter.LogoutReader(memberInfo, updateb: false))
                    {
                        stubTest._0001(visitorComposer.ValidateIssuer <object>(memberInfo));
                    }
                    if (ResolverErrorFilter.VisitReader(memberInfo, calcconnection: false, addrule: false))
                    {
                        stubTest._0001(visitorComposer.OrderIssuer <object>(memberInfo));
                    }
                    break;

                case MemberTypes.Method:
                {
                    MethodInfo methodInfo = (MethodInfo)memberInfo;
                    if (methodInfo.IsPublic)
                    {
                        ParameterInfo[] parameters = methodInfo.GetParameters();
                        if (parameters.Length == 0 && methodInfo.ReturnType != typeof(void))
                        {
                            clientInstanceRule = visitorComposer._0001 <object>(methodInfo);
                            stubTest._0001((object P_0) => clientInstanceRule(P_0, new object[0]));
                        }
                        else if (parameters.Length == 1 && methodInfo.ReturnType == typeof(void))
                        {
                            clientInstanceRule2 = visitorComposer._0001 <object>(methodInfo);
                            stubTest._0001(delegate(object P_0, object P_1)
                                {
                                    //Discarded unreachable code: IL_0002
                                    //IL_0003: Incompatible stack heights: 0 vs 1
                                    clientInstanceRule2(P_0, new object[1]
                                    {
                                        P_1
                                    });
                                });
                        }
                    }
                    break;
                }

                default:
                    throw new ArgumentException("Unexpected member type '{0}' for member '{1}'.".SelectReader(CultureInfo.InvariantCulture, memberInfo.DefineReader(), memberInfo.Name));
                }
                stubTest._0001(ResolverErrorFilter.InsertReader(memberInfo));
                modelInstanceExpression._0001()[text] = stubTest;
            }
            return(modelInstanceExpression);
        }