public void Add(Entities.User u) { uint sessionId = 0; do { sessionId++; } while (Sessions.ContainsKey(sessionId)); u.SetSession(sessionId); Sessions.TryAdd(sessionId, new Entities.Session(sessionId, u.ID, u.Name, u.Displayname)); }
public bool Add(uint sessionId, Entities.User u) { if (!Sessions.ContainsKey(sessionId)) { u.SetSession(sessionId); if (Sessions.TryAdd(sessionId, u)) { if (Sessions.Count > playerPeak) { playerPeak = Sessions.Count; } return(true); } } return(false); }