/// <summary> /// Unregisters a peer from the server. Returns true if the existed and were removed. /// </summary> /// <param name="aInfo"></param> /// <returns>Returns false if the user was not found or their were multiple users removed</returns> public bool Unregister(NetworkPeerInfo aInfo) { if(aInfo == null) { return false; } return m_RegisteredUsers.RemoveWhere(Element => Element.username == aInfo.username) == 1; }
/// <summary> /// Registers a user with the server. /// </summary> /// <param name="aInfo"></param> /// <returns></returns> public bool Register(NetworkPeerInfo aInfo) { if(aInfo == null) { return false; } NetworkPeerInfo exists = m_RegisteredUsers.First(Element => Element.username == aInfo.username); if(exists != null) { return false; } m_RegisteredUsers.Add(aInfo); return true; }
/// <summary> /// Adds a request to the queue /// </summary> /// <param name="aInfo"></param> public static void SendUnregisterRequest(NetworkPeerInfo aInfo) { instance.m_UnregisterRequests.Enqueue(aInfo); }
/// <summary> /// Determines if a peer exists or not within the server /// </summary> /// <param name="aInfo"></param> /// <returns>Returns true if they do exist, returns false if they do not</returns> public bool Authenticate(NetworkPeerInfo aInfo) { return m_RegisteredUsers.First(Element => Element.username == aInfo.username) != null; }
/// <summary> /// Adds a request to the queue /// </summary> /// <param name="aInfo"></param> public static void SendAuthenticationRequest(NetworkPeerInfo aInfo) { instance.m_AuthenticationRequests.Enqueue(aInfo); }