Beispiel #1
0
        public ScriptMethodHandler(CodeMethodHandler method)
        {
            Name = method.Method.Name;
            List <MethodParameterHandler> pars = new List <MethodParameterHandler>();

            foreach (var par in method.Method.GetParameters())
            {
                var name = par.Name;
                var type = par.ParameterType;
                var req  = !par.IsOptional;
                var def  = par.DefaultValue;
                MethodParameterHandler hand = new MethodParameterHandler(name, type, req, def);
            }
            Instance = method.Target;
            Handler  = method;
        }
Beispiel #2
0
        public ScriptMethodHandler(string methodName, Type from)
        {
            var method = from.GetMethod(methodName);

            Name = method.Name;
            List <MethodParameterHandler> pars = new List <MethodParameterHandler>();

            foreach (var par in method.GetParameters())
            {
                var name = par.Name;
                var type = par.ParameterType;
                var req  = !par.IsOptional;
                var def  = par.DefaultValue;
                MethodParameterHandler hand = new MethodParameterHandler(name, type, req, def);
                pars.Add(hand);
            }
            Parameters = pars.ToArray();
            StaticType = from;
            CHandler   = new CustomCodeMethodHandler(StaticType, method);
        }