Example #1
0
        public override object Invoke(ITisInvokeParams oInvokeParams, ITisEventParams oEventParams, ref object[] InOutParams)
        {
            ValidateInvoker(oInvokeParams, TisCustomizationConsts.TIS_INVOKE_TYPE_DOTNET);

            return(m_oInvoker.InvokeMethod(
                       oInvokeParams.ModuleName,
                       oInvokeParams.ClassName,
                       oInvokeParams.MethodName,
                       ref InOutParams));
        }
Example #2
0
        private void BuildEventMethod(
            TypeBuilder oTypeBuilder,
            FieldBuilder[] TypeFields,
            MethodInfo oEventInterceptorDelegateInvokeMethod,
            ITisEventParams oEventParams)
        {
            Type oBaseReturnType = GetBaseType(oEventParams.MethodSignature.ReturnInfo.ReturnType);

            MethodBuilder oMethodBuilder = oTypeBuilder.DefineMethod(
                oEventParams.Name,
                MethodAttributes.Public,
                oBaseReturnType,
                oEventParams.MethodSignature.ParamTypes);

            ILGenerator oILGenerator = oMethodBuilder.GetILGenerator();

            LocalBuilder oLocalObjArray = PackInOutParams(oILGenerator, oEventParams.MethodSignature);

            for (int i = 0; i < TypeFields.Length; i++)
            {
                oILGenerator.Emit(OpCodes.Ldarg_0);
                oILGenerator.Emit(OpCodes.Ldfld, TypeFields[i]);
            }

            oILGenerator.Emit(OpCodes.Ldloca_S, oLocalObjArray);

            oILGenerator.Emit(OpCodes.Callvirt, oEventInterceptorDelegateInvokeMethod);


            if (!IsVoidMethod(oBaseReturnType))
            {
                LocalBuilder oResult = oILGenerator.DeclareLocal(oBaseReturnType);

                oILGenerator.Emit(OpCodes.Stloc, oResult);

                PrepareReturnValue(oILGenerator, oBaseReturnType, oResult);
            }
            else
            {
                oILGenerator.Emit(OpCodes.Pop);
            }

            PrepareOutParams(oILGenerator, oEventParams.MethodSignature, oLocalObjArray);

            if (!IsVoidMethod(oBaseReturnType))
            {
                LocalBuilder oResult = oILGenerator.DeclareLocal(oBaseReturnType);

                oILGenerator.Emit(OpCodes.Ldloc, oResult);
            }

            oILGenerator.Emit(OpCodes.Ret);
        }
        public object FireEvent(object oEventSource, ITisEventParams oEventParams, ref object[] InOutParams)
        {
            if (oEventParams != null && !DisableEvents)
            {
                ITisInvokeParams oInvokeParams;

                ITisEventInvoker oEventInvoker =
                    GetEventsInvoker(oEventSource, oEventParams.Name, out oInvokeParams);

                if (oEventInvoker != null)
                {
                    return(oEventInvoker.Invoke(oInvokeParams, oEventParams, ref InOutParams));
                }
            }
            else
            {
                if (DisableEvents)
                {
                    Log.WriteWarning("Events are disabled.");
                }
            }

            return(null);
        }
        internal object FireEvent(object oEventSource, object oEventBindingKey, string sEventName, ref object[] InOutParams)
        {
            ITisEventParams oEventParams = GetEvent(oEventSource, sEventName);

            return(FireEvent(oEventBindingKey, oEventParams, ref InOutParams));
        }
        public object FireEvent(object oEventSource, string sEventName, ref object[] InOutParams)
        {
            ITisEventParams oEventParams = GetEvent(oEventSource, sEventName);

            return(FireEvent(oEventSource, oEventParams, ref InOutParams));
        }
        public ITisInvokeParams[] GetMatchingMethodsByEvent(string sFileName, object oEventSource, string sEventName)
        {
            ITisEventParams oEvent = GetEvent(oEventSource, sEventName);

            return(GetMatchingMethodsBySignature(sFileName, oEvent.MethodSignature));
        }
Example #7
0
 public virtual object Invoke(ITisInvokeParams oInvokeParams, ITisEventParams oEventParams, ref object[] InOutParams)
 {
     return(null);
 }