/// <summary>
 /// Checks if the specified server excludes all the specified properties.
 /// </summary>
 /// <param name="server">Server to check.</param>
 /// <param name="properties">Properties to check.</param>
 /// <returns>True if the specified server excludes all the specified properties; false otherwise.</returns>
 protected virtual bool ServerExcludesProperties(RegisteredGameServer server, Property[] properties)
 {
     foreach (var property in properties)
     {
         if (server.properties.Find(x => x.name == property.name && x.value == property.value) != null)
         {
             return(false);
         }
     }
     return(true);
 }
        /// <summary>
        /// Registers the game server with the specified information in the master server.
        /// </summary>
        /// <param name="connection">Network connection of the game server to register.</param>
        /// <param name="msg">The network message containing the information of the game server to register.</param>
        protected virtual void RegisterGameServer(NetworkConnection connection, RegisterGameServerMessage msg)
        {
            var gameServer = new RegisteredGameServer();

            gameServer.connection   = connection;
            gameServer.id           = gameServerId++;
            gameServer.ip           = msg.ip;
            gameServer.port         = msg.port;
            gameServer.name         = msg.name;
            gameServer.maxPlayers   = msg.maxPlayers;
            gameServer.password     = msg.password;
            gameServer.hideWhenFull = msg.hideWhenFull;
            gameServer.properties   = new List <Property>(msg.properties);
            registeredGameServers.Add(gameServer);
            Debug.Log("Registered game server (id = " + gameServer.id + ") with IP address = " + gameServer.ip + " and port = " + gameServer.port + ".");
        }
 /// <summary>
 /// Checks if the specified server is hidden from the matchmaking results.
 /// </summary>
 /// <param name="server">Server to check.</param>
 /// <returns>True if the specified server is hidden from the matchmaking results; false otherwise.</returns>
 protected virtual bool ServerIsHiddenFromMatchmaking(RegisteredGameServer server)
 {
     return(server.hideWhenFull && server.numPlayers >= server.maxPlayers);
 }