protected internal void CacheProperties(Hashtable propertiesToCache)
{
if (propertiesToCache == null || propertiesToCache.Count == 0 || this.customPropertiesField.Equals(propertiesToCache))
{
return;
}
// check of this game was removed from the list. in that case, we don't
// need to read any further properties
// list updates will remove this game from the game listing
if (propertiesToCache.ContainsKey(GameProperties.Removed))
{
this.removedFromList = (Boolean)propertiesToCache[GameProperties.Removed];
if (this.removedFromList)
{
return;
}
}
// fetch the "well known" properties of the room, if available
if (propertiesToCache.ContainsKey(GameProperties.MaxPlayers))
{
this.maxPlayersField = (byte)propertiesToCache[GameProperties.MaxPlayers];
}
if (propertiesToCache.ContainsKey(GameProperties.IsOpen))
{
this.openField = (bool)propertiesToCache[GameProperties.IsOpen];
}
if (propertiesToCache.ContainsKey(GameProperties.IsVisible))
{
this.visibleField = (bool)propertiesToCache[GameProperties.IsVisible];
}
if (propertiesToCache.ContainsKey(GameProperties.PlayerCount))
{
this.playerCount = (int)((byte)propertiesToCache[GameProperties.PlayerCount]);
}
if (propertiesToCache.ContainsKey(GameProperties.CleanupCacheOnLeave))
{
this.autoCleanUpField = (bool)propertiesToCache[GameProperties.CleanupCacheOnLeave];
}
//if (propertiesToCache.ContainsKey(GameProperties.PropsListedInLobby))
//{
// // could be cached but isn't useful
//}
// merge the custom properties (from your application) to the cache (only string-typed keys will be kept)
this.customPropertiesField.MergeStringKeys(propertiesToCache);
}