コード例 #1
0
        public ScriptMethodHandler(string name, object instance, params MethodParameterHandler[] parameters)
        {
            Name       = name;
            Parameters = parameters;
            SortParameters();
            Instance = instance;
            var methodInfo = instance.GetType().GetMethod(Name);
            var ins        = instance;

            CHandler = new CustomCodeMethodHandler(ins, methodInfo);
            Instance = ins;
        }
コード例 #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);
        }