public void UpdateWith(ConnectionRecord me) { PlayerName = me.PlayerName; PlayerEndPoint = me.PlayerEndPoint; GameServerId = me.GameServerId; TableId = me.TableId; }
public new ConnectionRecord Clone() { ConnectionRecord newRecord = new ConnectionRecord(); newRecord.PlayerName = PlayerName; newRecord.PlayerEndPoint = PlayerEndPoint; newRecord.GameServerId = GameServerId; newRecord.TableId = TableId; return newRecord; }
public void AddOrUpdateRecord(ConnectionRecord item) { Validate(item); lock (RecordsSyncLock) { DataRow existing = Records.Rows.Find(item.PlayerName); if (existing != null) { //-- PlayerName is readonly. existing[TableColumns.PlayerEndPointIndex] = item.PlayerEndPoint.ToString(); existing[TableColumns.GameServerIdIndex] = item.GameServerId; existing[TableColumns.TableIdIndex] = item.TableId; } else Records.Rows.Add(item.PlayerName, item.PlayerEndPoint.ToString(), item.GameServerId, item.TableId); } }
protected override void OnRun(IncomingMessage message) { LoginRequest login = Manager.Serializer.GetObject<LoginRequest>(message.Data); LoginResponse response = new LoginResponse(); response.ResponseId = login.RequestId; if (string.IsNullOrEmpty(login.PlayerName) == false && string.IsNullOrEmpty(login.Password) == false) { //-- Tell the other servers to log this player out. string logoutMessage = "You have been logged out because you have connected to the Poker Reloaded Network on a different client application."; Manager.SendPlayerRemovalRequest(login.PlayerName, true, logoutMessage); response.AvailableFunds = 3000; response.HasLoginSucceeded = true; response.PlayerName = login.PlayerName; //-- Remove this player's record if they have previously logged in.. //-- Could just to an update here.. List<ConnectionRecord> list = Manager.PlayerConnectionTracker.GetRecordsByNameOrEndPoint(login.PlayerName, message.Sender); foreach (ConnectionRecord record in list) { Manager.SendLogoutRequest(record.PlayerName, logoutMessage); Manager.CleanPlayerFootprint(record.PlayerName, GatewayNetworkManager2.PlayerFootprintCleanupType.CleanForSuccessfulLogin); } ConnectionRecord cr = new ConnectionRecord(login.PlayerName, message.Sender); Manager.PlayerConnectionTracker.AddOrUpdateRecord(cr); ServerUIShell.WriteLine("-Player has logged in (" + login.PlayerName + ")"); } else { response.HasLoginSucceeded = false; response.ServerMessage = "Your username and password were incorrect."; } Manager.SendMessageToPlayers(GameMessageType.Client_ReceivePlayerLoginResponse, Manager.Serializer.GetBytes(response), message.Sender.ToList()); message.WasMessageHandled = true; }
private void Validate(ConnectionRecord item) { if (string.IsNullOrEmpty(item.PlayerName)) throw new InvalidOperationException("Invalid ConnectionRecord: PlayerName must be supplied."); if (item.PlayerEndPoint == null) throw new InvalidOperationException("Invalid ConnectionRecord: PlayerEndPoint must be supplied."); }