Example #1
0
        public void Run(UserConsole user)
        {
            Instance     = this;
            this.Console = user;

            this.NetworkManager = new ServerNetworkManager();
            this.NetworkManager.Start();

            this.UserManager           = new ChatUserManager();
            this.UserManager.Logined  += this.OnUserManagerLogined;
            this.UserManager.Logouted += this.OnUserManagerLogouted;

            this.TickThread = new Thread(this.Ticking);
            this.TickThread.Start();

            while (true)
            {
                var input = user.ReadInput().ToLowerInvariant();

                if (input.Equals("stop") == true)
                {
                    this.Stop();
                    return;
                }
            }
        }
Example #2
0
        public ClienNetworkManager(ServerNetworkManager server, TcpClient client)
        {
            this.Server = server;

            this.Client    = client;
            this.Stream    = client.GetStream();
            this.ReadQueue = new Queue <Packet>();

            this.CloseMessage = null;

            var handler = new PacketHandlerHandshake(this);

            handler.LoginSuccess += this.OnLoginSuccess;
            this.Handler          = handler;
        }