示例#1
0
 public void StartGame(string adress, int port)
 {
     _client = new TcpClient();
     try
     {
         _client.Connect(adress, port);
         _stream = _client.GetStream();
         string message = string.Concat("referee:", _wordProvider.GetRandomWord());
         byte[] data    = Encoding.Unicode.GetBytes(message);
         _stream.Write(data, 0, data.Length);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     finally
     {
         Disconnect();
     }
 }
示例#2
0
 public ActionResult Reset()
 {
     Game = new HangmanGame(_wordProvider.GetRandomWord());
     Session["HangmanGame"] = Game;
     return(View("ShowGame", Game));
 }