コード例 #1
0
ファイル: Connection.cs プロジェクト: dogbert69/fallout-mud
 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);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: dogbert69/fallout-mud
 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();
 }