public void PrintCurrentApp(TextWriter writer) { MHApplication application = CurrentApp(); application.Print(writer, 0); }
public bool Launch(MHObjectRef target, bool fIsSpawn) { string csPath = GetPathName(target.GroupId); // Get path relative to root. if (csPath.Length == 0) { return(false); // No file name. } if (m_fInTransition) { Logging.Log(Logging.MHLogWarning, "Launch during transition - ignoring"); return(false); } // Check that the file exists before we commit to the transition. // This may block if we cannot be sure whether the object is present. byte[] text; if (!m_Context.GetCarouselData(csPath, out text)) { return(false); } m_fInTransition = true; // Starting a transition try { if (CurrentApp() != null) { if (fIsSpawn) { // Run the CloseDown actions. AddActions(CurrentApp().CloseDown); RunActions(); } if (CurrentScene() != null) { CurrentScene().Destruction(this); } CurrentApp().Destruction(this); if (!fIsSpawn) { m_ApplicationStack.Pop(); // Pop and delete the current app. } } MHApplication pProgram = (MHApplication)ParseProgram(text); if ((Logging.GetLoggingLevel() & Logging.MHLogScenes) != 0) // Print it so we know what's going on. { pProgram.Print(Logging.GetLoggingStream(), 0); } if (!pProgram.IsApp) { throw new MHEGException("Expected an application"); } // Save the path we use for this app. pProgram.Path = csPath; // Record the path int nPos = pProgram.Path.LastIndexOf('/'); if (nPos < 0) { pProgram.Path = ""; } else { pProgram.Path = pProgram.Path.Substring(0, nPos); } // Have now got the application. m_ApplicationStack.Push(pProgram); // This isn't in the standard as far as I can tell but we have to do this because // we may have events referring to the old application. m_EventQueue.Clear(); // Activate the application. .... CurrentApp().Activation(this); m_fInTransition = false; // The transition is complete return(true); } catch (MHEGException) { m_fInTransition = false; // The transition is complete return(false); } }