public void GhostEventInvokeTest()
        {
            GhostEventHandler ghostEventHandler = new Regulus.Remote.GhostEventHandler();

            bool     invokeEnable  = false;
            TestType ghostTestType = new GhostTestType(ghostEventHandler) as TestType;

            ghostTestType.TestEvent += () =>
            {
                invokeEnable = true;
            };
            ghostEventHandler.Invoke(1);


            Assert.Equal(true, invokeEnable);
        }
        private void _InvokeEvent(long ghost_id, int event_id, long handler_id, byte[][] event_params)
        {
            IGhost ghost = _FindGhost(ghost_id);

            if (ghost == null)
            {
                return;
            }

            MemberMap map  = _Protocol.GetMemberMap();
            EventInfo info = map.GetEvent(event_id);



            object instance = ghost.GetInstance();
            Type   type     = instance.GetType();


            var       fieldName  = _GetFieldName(info);
            FieldInfo eventInfos = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public);
            object    fieldValue = eventInfos.GetValue(instance);

            if (fieldValue is GhostEventHandler)
            {
                GhostEventHandler fieldValueDelegate = fieldValue as GhostEventHandler;

                object[] pars = (from a in event_params select _Serializer.Deserialize(a)).ToArray();
                try
                {
                    fieldValueDelegate.Invoke(handler_id, pars);
                }
                catch (TargetInvocationException tie)
                {
                    Regulus.Utility.Log.Instance.WriteInfo(string.Format("Call event error in {0}:{1}. \n{2}", type.FullName, info.Name, tie.InnerException.ToString()));
                    throw tie;
                }
                catch (Exception e)
                {
                    Regulus.Utility.Log.Instance.WriteInfo(string.Format("Call event error in {0}:{1}.", type.FullName, info.Name));
                    throw e;
                }
            }
        }
 public GhostTestType(Regulus.Remote.GhostEventHandler handler)
 {
     _TestEvent = handler;
 }