Ejemplo n.º 1
0
 public Connection(Socket socket, ConnectionManager server)
 {
     _clientSocket = socket;
     _parent = server;
     this.CommandBuffer = new StringBuilder();
     var remoteEndPoint = (IPEndPoint)_clientSocket.RemoteEndPoint;
     _connected = true;
     this.Ip = remoteEndPoint.Address;
     _buffer = new byte[1];
     _parser = new InputParser();
     _parser.UserCommandReceived += new UserCommandEventHandler(ParserUserCommandReceived);
 }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     ObjectFactory.Initialize(e =>
     {
         e.For<IPlayerRepository>().Use<PlayerRepository>();
         e.For<IMapRepository>().Use<MapRepository>();
         e.For<IOutputParser>().Use<AsciiOutputParser>();
     });
     Repo.Initialize();
     ConnectionManager server = new ConnectionManager();
     server.UserDisconnected += new UserDisconnectedEventHandler(_server_UserDisconnected);
     server.UserConnected += new UserConnectedEventHandler(_server_UserConnected);
     server.Start();
     string input;
     while ((input = Console.ReadLine()) != "quit")
     {
         server.Broadcast(System.Environment.NewLine + "Admin mowi: " +input);
     }
     server.Stop();
 }