public ServerSettings(string serverName, int port, int queryPort, int maxPlayers, bool isPublic, bool enableUPnP) { ServerLog = new ServerLog(serverName); Voting = new Voting(); Whitelist = new WhiteList(); BanList = new BanList(); ExtraCargo = new Dictionary <ItemPrefab, int>(); PermissionPreset.LoadAll(PermissionPresetFile); InitProjSpecific(); ServerName = serverName; Port = port; QueryPort = queryPort; //EnableUPnP = enableUPnP; this.maxPlayers = maxPlayers; this.isPublic = isPublic; netProperties = new Dictionary <UInt32, NetPropertyData>(); using (MD5 md5 = MD5.Create()) { var saveProperties = SerializableProperty.GetProperties <Serialize>(this); foreach (var property in saveProperties) { object value = property.GetValue(this); if (value == null) { continue; } string typeName = SerializableProperty.GetSupportedTypeName(value.GetType()); if (typeName != null || property.PropertyType.IsEnum) { NetPropertyData netPropertyData = new NetPropertyData(this, property, typeName); UInt32 key = ToolBox.StringToUInt32Hash(property.Name, md5); if (netProperties.ContainsKey(key)) { throw new Exception("Hashing collision in ServerSettings.netProperties: " + netProperties[key] + " has same key as " + property.Name + " (" + key.ToString() + ")"); } netProperties.Add(key, netPropertyData); } } } }