protected void MsgLogin(BinaryReader reader) { var packet = new LoginPacket(); packet.Unserialize(reader); IPacket s; if (Server.ValidateLogin(this, packet.UserName, packet.Password, packet.Subscription, packet.CDKey)) { s = new LoginOkPacket { SessionId1 = SessionId1, SessionId2 = SessionId2 }; if (Server.OnConnect != null) { Server.OnConnect(this); } } else { s = new LoginFailPacket { ResultCode = 1 }; _disconnect = true; } var data = CreatePacket(s); Socket.BeginSend(data, 0, data.Length, EndSend, true); }
protected override void MsgLoginOk(BinaryReader reader) { Console.WriteLine("Received Login Ok"); var packet = new LoginOkPacket(); packet.Unserialize(reader); CConnectionState = 2; SessionId = (packet.SessionId1 << 32) | packet.SessionId2; SendServerListEx(SessionId); }