public string hostGame(string userName, string hostAddress, string WordToScramble) { if(currentUserHostingGame != null) { GameBeingHostedFault alreadyThere = new GameBeingHostedFault(); alreadyThere.userName = userName; alreadyThere.problem = "You cannot join as host to a game already being hosted."; throw new FaultException<GameBeingHostedFault>(alreadyThere); } //add the host's userName as host currentUserHostingGame = userName; //scramble the host's word gameWord.unscrambledWord = WordToScramble; gameWord.scrambledWord = scrambleWord(WordToScramble); // return the scrambled word to the host. return gameWord.scrambledWord; }
public string hostGame(string userName, string hostAddress, string WordToScramble) { if (currentUserHostingGame != null) { GameBeingHostedFault alreadyThere = new GameBeingHostedFault(); alreadyThere.userName = userName; alreadyThere.problem = "You cannot join as host to a game already being hosted."; throw new FaultException <GameBeingHostedFault>(alreadyThere); } //add the host's userName as host currentUserHostingGame = userName; //scramble the host's word gameWord.unscrambledWord = WordToScramble; gameWord.scrambledWord = scrambleWord(WordToScramble); // return the scrambled word to the host. return(gameWord.scrambledWord); }