public void EndGame() { // Stop the game timer timer.Stop(); // Get previous highscores Highscore highscore = Highscore.ReadHighScores(); // Update highscores foreach (ClientHandler client in clients) { highscore.AddHighScore(GetSnake(client.Id).Body.Count, client.Name); } highscore.WriteHighScores(); // Send Endpacket and highscores Broadcast(TcpProtocol.EndSend()); foreach (ClientHandler client in clients) { client.Write(TcpProtocol.HighscoreSend(highscore)); } }