private void SafeInvokeMessageRecevied(MessageReceivedEventArgs eventArgs)
        {
            if (this.RemoteMessage == null)
            {
                return; //No Listeners
            }

            MessageReceivedEvent listener = null;
            Delegate[] dels = this.RemoteMessage.GetInvocationList();

            foreach (Delegate del in dels)
            {
                try
                {
                    listener = (MessageReceivedEvent)del;
                    listener.Invoke(eventArgs);
                }
                catch (Exception)
                {
                    //Could not reach the destination, so remove it
                    //from the list
                    this.RemoteMessage -= listener;
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Display messages from the target process
 /// </summary>
 /// <param name="message"></param>
 void CaptureInterface_RemoteMessage(MessageReceivedEventArgs message)
 {
     txtDebugLog.Invoke(new MethodInvoker(delegate()
         {
             txtDebugLog.Text = String.Format("{0}\r\n{1}", message, txtDebugLog.Text);
         })
     );
 }
        private void CaptureInterfaceOnRemoteMessage(MessageReceivedEventArgs message)
        {
            switch (message.MessageType)
            {
                case MessageType.Debug:
                    Log.Debug(message.Message);
                    break;
                case MessageType.Error:
                    directXErrorCount++;
                    Log.Error(message.Message);
                    if (directXErrorCount >= 10)
                    {
                        dontUseDirectX = true;
                        DettachHookFromProcess();
                    }
                    break;
                case MessageType.Warning:
                    Log.Warn(message.Message);
                    break;
                case MessageType.Information:
                    Log.Info(message.Message);
                    break;
                case MessageType.Trace:
                    TraceLog.Log(message.Message);
                    break;
            }

            message.Dispose();
        }
 void CaptureInterface_RemoteMessage(MessageReceivedEventArgs message)
 {
     System.Diagnostics.Debugger.Log(0, "CaptureInterface: Remote Message", message.MessageType +  ": " + message.Message);
 }
 void CaptureInterface_RemoteMessage(MessageReceivedEventArgs message)
 {
     txtDebugLog.Invoke(new MethodInvoker(delegate ()
         {
             txtDebugLog.Text = String.Format("{0}\r\n{1}", message, txtDebugLog.Text);
             if (txtDebugLog.Text.Length > 1000)
             {
                 txtDebugLog.Text = txtDebugLog.Text.Substring(0, 1000);
             }
         })
     );
 }