void SessionTimeoutMessage(string text) { m_buffer = new OutputBuffer(null); m_buffer.OutputText(text); m_buffer.AddJavaScriptToBuffer("sessionTimeout"); ClearJavaScriptBuffer(); }
protected void cmdSubmit_Click(object sender, EventArgs e) { if (m_player == null) { SessionTimeoutMessage("<b>Sorry, your session has expired and the game has finished.</b><br/><br/>Press your browser's Refresh button to start again."); return; } int tickCount = 0; if (fldUITickCount.Value.Length > 0) { int.TryParse(fldUITickCount.Value, out tickCount); fldUITickCount.Value = ""; } if (fldUIMsg.Value.Length > 0) { string[] args = fldUIMsg.Value.Split(new[] { ' ' }, 2); switch (args[0]) { case "command": m_player.SendCommand(args[1], tickCount); break; case "endwait": m_player.EndWait(); break; case "endpause": m_player.EndPause(); break; case "choice": m_player.SetMenuResponse(args[1]); break; case "choicecancel": m_player.CancelMenu(); break; case "msgbox": m_player.SetQuestionResponse(args[1]); break; case "event": SendEvent(args[1]); break; case "tick": m_player.Tick(tickCount); break; case "save": string unescapedHtml = args[1].Replace(">", ">").Replace("<", "<").Replace("&", "&"); m_player.RequestSave(unescapedHtml); break; } fldUIMsg.Value = ""; } string output = m_player.ClearBuffer(); m_buffer.OutputText(output); ClearJavaScriptBuffer(); }
private void LogError(string errorMessage) { m_buffer.OutputText("[Sorry, an error occurred]"); Logging.Log.Error(errorMessage); }