public void Process(IConoConnect connect, Packet packet) { FrontUser user = (FrontUser)connect.GetOwner(); if (user == null) { Console.WriteLine("???"); return; } if (user.startProcessRequest(packet) == false) { Console.WriteLine("????"); } else { ClientFrontPacket.LoginReqPacket loginReqPacket = (ClientFrontPacket.LoginReqPacket)packet; string loginToken = loginReqPacket.loginToken; FrontManager.Instance.GetOwnerManager((int)NETWORK_MODULE.NETWORK_MODULE_CLIENT).GetOwner(); DJLogin job = new DJLogin(user); job.LoginToken = loginToken; job.SessionId = user.SessionId; ConoDB.Instance.ProcessQuery(job); } }
public bool AddFrontUser(string loginToken, FrontUser user) { user.DisconnectTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; if (loginTokenDict.ContainsKey(loginToken) == false) { loginTokenDict.Add(loginToken, user); return(true); } else { if (loginTokenDict[loginToken] == user) { return(true); } else { // Todo. dup user exist ( process it ) Console.WriteLine("AddConnectUser"); return(false); } } }
public override void Connect(ConoConnect connect) { if (connect == null) { Console.WriteLine("connect null"); return; } FrontUser user = new FrontUser(connect); user.Connect = connect; connect.SetOwner(user); ClientFrontPacket.ConnectInfoNotifyPacket packet = new ClientFrontPacket.ConnectInfoNotifyPacket(); packet.sessionId = user.SessionId; byte[] data = ClientFrontPacket.Serialize(packet); connect.Send(data, data.Length); }
public void Process(IConoConnect connect, Packet packet) { FrontLobbyPacket.EnterUserResPacket eurPacket = (FrontLobbyPacket.EnterUserResPacket)packet; long userNo = eurPacket.userNo; FrontUser user = (FrontUser)FrontManager.Instance.GetOwnerManager((int)NETWORK_MODULE.NETWORK_MODULE_CLIENT).GetOwner(userNo); if (user == null) { Console.WriteLine("user null - userNo : " + userNo); } ClientFrontPacket.LoginResPacket lrPacket = new ClientFrontPacket.LoginResPacket(); lrPacket.userNo = eurPacket.userNo; lrPacket.ip = ((LobbyOwner)connect.GetOwner()).ClientIp; lrPacket.port = ((LobbyOwner)connect.GetOwner()).ClientPort; byte[] data = ClientFrontPacket.Serialize(lrPacket); user.Connect.Send(data, data.Length); }
public override void Process(IConoDBConnection dbConnection) { string selectSql = "SELECT * FROM Account WHERE loginToken = \"" + loginToken + "\";"; MySqlCommand selectCommand = new MySqlCommand(); selectCommand.Connection = dbConnection.Conn; selectCommand.CommandText = selectSql; DataSet ds = new DataSet(); MySqlDataAdapter da = new MySqlDataAdapter(selectSql, dbConnection.Conn); da.Fill(ds); DataRow row = ds.Tables[0].Rows[0]; if (row == null) { Console.WriteLine("Process not exist user"); } else { long userNo = (long)row["accountNo"]; //string nickname = (string)row["nickname"]; //int exp = (int)row["exp"]; //int jam = (int)row["jam"]; //int gold = (int)row["gold"]; //int mileage = (int)row["mileage"]; //int advTicket = (int)row["advTicket"]; //DateTime advTicketUseTime = (DateTime)row["advTicketUseTime"]; //Console.WriteLine(string.Format("이름 : " + userNo + ", " + nickname + ", " + exp + ", " + jam + ", " + gold + ", " + mileage + ", " + advTicket + ", " + advTicketUseTime.ToLongDateString())); ((FrontUser)user).OwnerNo = userNo; FrontManager.Instance.GetOwnerManager((int)NETWORK_MODULE.NETWORK_MODULE_CLIENT).AddConnectOwner(userNo, (FrontUser)user); Owner owner = FrontManager.Instance.GetOwnerManager((int)NETWORK_MODULE.NETWORK_MODULE_LOBBY).GetFreeOwner(); if (owner == null) { Console.WriteLine("lobby owner"); FrontUser frontUser = (FrontUser)user; //frontUser.Connect.Send(); return; } FrontLobbyPacket.EnterUserReqPacket packet = new FrontLobbyPacket.EnterUserReqPacket(); packet.userNo = userNo; packet.sessionId = sessionId; byte[] data = FrontLobbyPacket.Serialize(packet); owner.Connect.Send(data, data.Length); } //foreach (DataRow row in ds.Tables[0].Rows) //{ //} }
public DJLogin(FrontUser user) : base(user) { }