private static bool TryParseDefaultProperties( LitePeer peer, Operation operation, Hashtable propertyTable, SendParameters sendParameters, out byte?maxPlayer, out bool?isOpen, out bool?isVisible, out object[] properties) { string debugMessage; if (!GameParameterReader.TryReadDefaultParameter(propertyTable, out maxPlayer, out isOpen, out isVisible, out properties, out debugMessage)) { var response = new OperationResponse { OperationCode = operation.OperationRequest.OperationCode, ReturnCode = (short)ErrorCode.OperationInvalid, DebugMessage = debugMessage }; peer.SendOperationResponse(response, sendParameters); return(false); } return(true); }
public bool TrySetProperties(Hashtable gameProperties, out bool changed, out string debugMessage) { changed = false; byte?maxPlayer; bool?isOpen; bool?isVisible; object[] propertyFilter; if (!GameParameterReader.TryReadDefaultParameter(gameProperties, out maxPlayer, out isOpen, out isVisible, out propertyFilter, out debugMessage)) { return(false); } if (maxPlayer.HasValue && maxPlayer.Value != this.MaxPlayer) { this.MaxPlayer = maxPlayer.Value; this.properties[(byte)GameParameter.MaxPlayer] = (byte)this.MaxPlayer; changed = true; } if (isOpen.HasValue && isOpen.Value != this.IsOpen) { this.IsOpen = isOpen.Value; this.properties[(byte)GameParameter.IsOpen] = this.MaxPlayer; changed = true; } if (isVisible.HasValue && isVisible.Value != this.IsVisible) { this.IsVisible = isVisible.Value; changed = true; } this.properties.Clear(); foreach (DictionaryEntry entry in gameProperties) { if (entry.Value != null) { this.properties[entry.Key] = entry.Value; } } debugMessage = string.Empty; return(true); }