static void userLoggedOff() { Log.Main.Inform("User logged off"); stop_userLoggedOn_t(); TcpServer.Stop(); MpegStream.Stop(); currentUserName = null; }
void run() { while (thread != null) { TcpMessage m = TcpMessage.Receive(stream); Log.Main.Inform("Tcp message received: " + m.Name + "\r\n" + m.BodyAsText); InfoWindow.Create("Tcp message received: " + m.Name + "\r\n" + m.BodyAsText, null, "OK", null); string reply = TcpMessage.Success; try { switch (m.Name) { case TcpMessage.FfmpegStart: uint sessionId = WinApi.Wts.WTSGetActiveConsoleSessionId(); MpegStream.Start(sessionId, m.BodyAsText); break; case TcpMessage.FfmpegStop: MpegStream.Stop(); break; case TcpMessage.SslStart: if (stream is SslStream) { throw new Exception("SSL is already started."); } break; default: throw new Exception("Unknown message: " + m.Name); } } catch (Exception e) { reply = e.Message; } Log.Main.Inform("Tcp message sending: " + m.Name + "\r\n" + reply); m.Reply(stream, reply); if (m.Name == TcpMessage.SslStart && reply == TcpMessage.Success) { startSsl(); } } }