public object InvokeActionHandler() { if (_actionHandler != null) { object[] sendParams = null; if (_params != null) { sendParams = _params.ToArray(); int sendLength = 0; if (sendParams != null) { sendLength = sendParams.Length; } if (sendLength != _actionHandler.GetParameters().Length) { _parentHSM.Logger.Error("Parameter Count Mismatch: \n{0}({1})\ndoesn't match\n{2}({3})", Name, _params.GetParametersString(), _actionHandler.Name, GetParameterString(_actionHandler.GetParameters())); return(null); } } return(_actionHandler.Invoke(_parentHSM.HandlerClass, sendParams)); } else { return(_parentHSM.CallActionHandler(this)); } }
/// <summary> /// Get Method Info structures that match /// </summary> /// <param name="methodName"></param> /// <returns></returns> public MethodInfo GetMethod(string methodName, GQHSMParameters Params) { List <MethodInfo> methodInfos = m_classHanderMethods[methodName]; foreach (MethodInfo methodInfo in methodInfos) { ParameterInfo[] paramInfo = methodInfo.GetParameters(); bool varsMatch = true; if (paramInfo.Length == Params.Count) { for (int i = 0; i < Params.Count; i++) { // if Value is null, this is an unknown GQHSMVariable that can be mapped later if ((Params[i].Value != null) && (Params[i].Value.GetType() != paramInfo[i].ParameterType)) { varsMatch = false; break; } } } if (varsMatch) { return(methodInfo); } } if (methodInfos.Count != 0) { Logger.Debug("Unable to find matching method signature for action handler function: {0}({1});", _name, Params.GetParametersString()); } return(null); }