public void EnableRequiredOptions() { Backup(); var boolFields = new string[] {"chatlog", "mission_text_log", "rcon_start"}; foreach (var field in boolFields) SetBool("system", field, true); if (RconIP == null || RconIP.Equals(default(IPAddress))) SetString("system", "rcon_ip", "127.0.0.1"); if (RconPort <= 0 || RconPort > 65535) { int minPort = 8800; int maxPort = 8891; for (; minPort < maxPort;minPort ++ ) { Net.TestTCPPort("localhost", minPort, (entry, e) => { if (e == null && entry.AddressList.Count() == 0) { SetInt("system", "rcon_port", minPort); minPort = maxPort; } }); } } ReadConfig(); }
private void Initialize() { ReadConfig(); if (!IsMissionTextLogEnabled || !IsChatLogEnabled || !IsRconEnabled || RconPort <= 0 || RconPort > 65535 || RconIP == null || RconIP.Equals(default(IPAddress)) ) { IsConfigReady = false; EnableRequiredOptions(); } else { IsConfigReady = true; } }