private ITisQueryFilter GetQueryFilter(string sFileName, ITisMethodSignature oMethodSignature) { ITisExplorerSupportsQueryFilter oExplorerWithQueryFilter = m_oMethodsExplorer.SupportsQueryFilter(sFileName); if (oExplorerWithQueryFilter != null) { ArrayList oArrayList = new ArrayList(); foreach (ITisMethodParam oMethodParam in oMethodSignature.Params) { oArrayList.Add(oMethodParam.ParamType.AssemblyQualifiedName); } return(oExplorerWithQueryFilter.GetQueryFilter( String.Empty, oMethodSignature.Params.Length, (string[])oArrayList.ToArray(typeof(string)), oMethodSignature.ReturnInfo.ReturnType.Name)); } else { return(null); } }
private void PrepareOutParams( ILGenerator oILGenerator, ITisMethodSignature oMethodSignature, LocalBuilder oLocalObjArray) { Type oBaseType; for (int i = 0; i < oMethodSignature.Params.Length; i++) { if (oMethodSignature.Params[i].IsOut) { oILGenerator.Emit(OpCodes.Ldarg, i + 1); oILGenerator.Emit(OpCodes.Ldloc, oLocalObjArray); oILGenerator.Emit(OpCodes.Ldc_I4, i); oILGenerator.Emit(OpCodes.Ldelem_Ref); oBaseType = GetBaseType(oMethodSignature.ParamTypes[i]); if (oBaseType.IsValueType) { oILGenerator.Emit(OpCodes.Unbox, oBaseType); oILGenerator.Emit(OpCodes.Ldobj, oBaseType); oILGenerator.Emit(OpCodes.Stobj, oBaseType); } else { oILGenerator.Emit(OpCodes.Castclass, oBaseType); oILGenerator.Emit(OpCodes.Stind_Ref); } } } }
private LocalBuilder PackInOutParams( ILGenerator oILGenerator, ITisMethodSignature oMethodSignature) { LocalBuilder oLocalObjArray = oILGenerator.DeclareLocal(typeof(object[])); oILGenerator.Emit(OpCodes.Ldc_I4, oMethodSignature.Params.Length); oILGenerator.Emit(OpCodes.Newarr, typeof(object)); oILGenerator.Emit(OpCodes.Stloc, oLocalObjArray); Type oBaseType; for (int i = 0; i < oMethodSignature.Params.Length; i++) { oILGenerator.Emit(OpCodes.Ldloc, oLocalObjArray); oILGenerator.Emit(OpCodes.Ldc_I4, i); oILGenerator.Emit(OpCodes.Ldarg, i + 1); if (oMethodSignature.Params[i].IsOut) { oILGenerator.Emit(OpCodes.Ldind_Ref); } oBaseType = GetBaseType(oMethodSignature.ParamTypes[i]); if (oBaseType.IsValueType) { oILGenerator.Emit(OpCodes.Box, oBaseType); } oILGenerator.Emit(OpCodes.Stelem_Ref); } return(oLocalObjArray); }
public ITisInvokeParams[] GetMatchingMethodsBySignature(string sFileName, ITisMethodSignature oMethodSignature) { //m_oCustomAssemblyResolver.CustomizationDir = CustomizationDir; using (TisEventsExplorer oEventsExplorer = new TisEventsExplorer(m_oCustomAssemblyResolver)) { return(oEventsExplorer.GetMatchingMethodsBySignature(sFileName, oMethodSignature)); } }
public ITisInvokeParams[] GetMatchingMethodsBySignature(string sFileName, ITisMethodSignature oMethodSignature) { m_oAssemblyResolver.ValidateFile(ref sFileName); m_sFileName = sFileName; ITisQueryFilter oQueryFilter = GetQueryFilter(sFileName, oMethodSignature); ITisExplorerQuery oQuery = m_oMethodsExplorer.QueryMethods(sFileName, oQueryFilter); return(GetInvokeParams(oQuery)); }
private bool ValidateMethodParameters( ITisMethodSignature validationMethodSignature, object[] validationMethodParameters) { bool validParams = true; int paramsCount = validationMethodSignature.Params.Length; if (paramsCount != validationMethodParameters.Length) { validParams = false; } if (validParams) { for (int i = 0; i < paramsCount; i++) { if (validationMethodParameters[i] != null) { Type declaredParameterType = validationMethodSignature.ParamTypes[i]; Type providedParameterType = validationMethodParameters[i].GetType(); if (declaredParameterType != providedParameterType && !declaredParameterType.IsAssignableFrom(providedParameterType)) { if (declaredParameterType.IsByRef && providedParameterType.MakeByRefType() != declaredParameterType) { validParams = false; break; } } } } } return(validParams); }
public TisValidationMethod(MethodInfo method, int methodOrder, bool isCustomCodeProvider) { m_name = method.Name; if (method.DeclaringType != null) { m_fullName = method.DeclaringType.FullName + Type.Delimiter + m_name; } else { m_fullName = m_name; } m_isCustomCodeProvider = isCustomCodeProvider; m_method = method; m_methodOrder = methodOrder; m_oMethodSignature = new MethodSignature(m_method.GetParameters(), m_method.ReturnType); }
public TisEventParams(EventInfo oEventInfo) { m_oEventInfo = oEventInfo; m_oMethodSignature = new MethodSignature(m_oEventInfo.EventHandlerType); }