예제 #1
0
        public string Execute(string[] args, TcpClient client)
        {
            Game      game = model.GetGame(client);
            TcpClient dest;

            if (game.GetHome().Equals(client))
            {
                dest = game.GetAway();
            }
            else
            {
                dest = game.GetHome();
            }
            string  name    = game.Maze.Name;
            JObject playObj = new JObject();

            playObj["Name"]      = name;
            playObj["Direction"] = args[1];
            NetworkStream stream = dest.GetStream();
            BinaryWriter  writer = new BinaryWriter(stream);

            writer.Flush();
            writer.Write(playObj.ToString());
            writer.Flush();
            return(playObj.ToString());
        }
예제 #2
0
        /// <summary>
        /// Executes the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        /// <param name="client">The client.</param>
        /// <returns>System.String.</returns>
        public string Execute(string[] args, TcpClient client)
        {
            Game      game = model.GetGame(client);
            TcpClient dest;

            if (game.GetHome().Equals(client))
            {
                dest = game.GetAway();
            }
            else
            {
                dest = game.GetHome();
            }
            JObject playObj = new JObject();

            playObj["isClose"] = true;
            NetworkStream stream = dest.GetStream();
            BinaryWriter  writer = new BinaryWriter(stream);

            writer.Flush();
            writer.Write("closeNow");
            //writer.Write(playObj.ToString());
            writer.Flush();
            return(playObj.ToString());
        }