/// <summary> /// This event is raised when the game sends a debugging message to the IDE. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The event information.</param> private void m_Communicator_MessageArrived(object sender, MessageEventArgs e) { // Invoke the message handling on the IDE's thread. Central.Manager.IDE.Invoke(new Action(() => { if (e.Message is WaitMessage) { // This is the game signalling that it is ready to receive // message requests such as setting breakpoints before the // game starts executing. foreach (IBreakpoint b in this.Breakpoints) { BreakpointSetAlwaysMessage bm = new BreakpointSetAlwaysMessage(); bm.FileName = b.SourceFile; bm.LineNumber = b.SourceLine; this.m_Communicator.Send(bm); Thread.Sleep(10); // Give the game a little bit of time to receive the message. } // After we have set breakpoints, we must tell the game to // continue executing. this.m_Communicator.Send(new ContinueMessage()); } else if (e.Message is BreakMessage) { // This is the game signalling that it has hit a breakpoint // and is now paused. // Open the designer window for the specified file. Moai.Platform.Management.File f = Central.Manager.ActiveProject.GetByPath((e.Message as BreakMessage).FileName); IDesigner d = Central.Manager.DesignersManager.OpenDesigner(f); if (d is IDebuggable) { // We can only go to a specific line in the file if the // designer supports it. (d as IDebuggable).Debug(f, (e.Message as BreakMessage).LineNumber); // Set current active line information so when we resume we can // send the EndDebug call. this.m_ActiveDesigner = d as IDebuggable; } // Inform the IDE that the game is now paused. this.p_Paused = true; if (this.DebugPause != null) { this.DebugPause(this, new EventArgs()); } } else if (e.Message is ExcpInternalMessage) { /* FIXME: Implement this. * ExcpInternalMessage m = e.Message as ExcpInternalMessage; * ExceptionDialog d = new ExceptionDialog(); * d.IDEWindow = this.p_Parent.IDEWindow; * d.MessageInternal = m; * d.Show(); */ // TODO: Indicate to the UI that the game is now paused. } else if (e.Message is ExcpUserMessage) { /* FIXME: Implement this. * ExcpUserMessage m = e.Message as ExcpUserMessage; * ExceptionDialog d = new ExceptionDialog(); * d.IDEWindow = this.p_Parent.IDEWindow; * d.MessageUser = m; * d.Show(); */ // TODO: Indicate to the UI that the game is now paused. } else if (e.Message is ResultMessage) { ResultMessage m = e.Message as ResultMessage; // TODO: Use a queue to track messages sent to the engine and match them up with the result messages. } else { // Unknown message! // TODO: Handle this properly? Central.Platform.UI.ShowMessage(e.Message.ID); } })); }
public void Debug(Moai.Platform.Management.File file, uint line) { throw new NotImplementedException(); }