Пример #1
0
        public void AddFunction(Func <int> funcInt)
        {
            FunctionToCall functionToCall = new FunctionToCall();

            functionToCall.ReturnType = ReturnType.Int;
            functionToCall.FuncInt    = funcInt;
            functionToCall.Name       = funcInt.Method.Name;
            _listFunctionToCall.Add(functionToCall);
        }
Пример #2
0
        public void AddFunction(Func <bool> funcBool)
        {
            FunctionToCall functionToCall = new FunctionToCall();

            functionToCall.ReturnType = ReturnType.Bool;
            functionToCall.FuncBool   = funcBool;
            functionToCall.Name       = funcBool.Method.Name;
            _listFunctionToCall.Add(functionToCall);
        }
Пример #3
0
        public int ExecFunc(string functionName, int param1)
        {
            FunctionToCall functionToCall = _listFunctionToCall.Where(f => f.Name.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            if (functionToCall == null)
            {
                return(0);
            }

            return(functionToCall.FuncIntRetInt.Invoke(param1));
        }
Пример #4
0
        public bool ExecFunc(string functionName)
        {
            FunctionToCall functionToCall = _listFunctionToCall.Where(f => f.Name.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            if (functionToCall == null)
            {
                return(false);
            }

            return(functionToCall.FuncBool.Invoke());
        }