예제 #1
0
        public Delegate(string name, MethodInfo methodInfo) :
            base(name)
        {
            Method = methodInfo;

            ParameterInfo[] parameters     = methodInfo.GetParameters();
            string[]        parameterNames = new string[parameters.Length];

            for (int i = 0; i < parameters.Length; i++)
            {
                parameterNames[i] = parameters[i].Name;
            }

            SetParameters(parameterNames);

            // Set up the callback to our Method
            FuncImpl.Add(new Invocation(methodInfo, GetParameters()));

            // Reset the current scope to be the parent of this script command's scope
            CelesteStack.CurrentScope = FunctionScope.ParentScope;
        }
예제 #2
0
 public static void RegisterFunction(string funcName, Type[] parameterTypes, FuncImpl body)
 {
     functions.Add(funcName.ToLower(), new FuncRegistryValue(body, parameterTypes));
 }
예제 #3
0
 public FuncRegistryValue(FuncImpl body, Type[] parameterTypes)
 {
     this.body           = body;
     this.parameterTypes = parameterTypes;
 }