public void Save(string path = null) { var newline = new [] { Environment.NewLine }; _config.Administrators.Clear(); foreach (var admin in Administrators.Split(newline, StringSplitOptions.RemoveEmptyEntries)) { _config.Administrators.Add(admin); } _config.Banned.Clear(); foreach (var banned in Banned.Split(newline, StringSplitOptions.RemoveEmptyEntries)) { _config.Banned.Add(ulong.Parse(banned)); } _config.Mods.Clear(); foreach (var mod in Mods.Split(newline, StringSplitOptions.RemoveEmptyEntries)) { if (ulong.TryParse(mod, out ulong modId)) { _config.Mods.Add(modId); } else { Log.Warn($"'{mod}' is not a valid mod ID."); } } _config.Save(path); }
public void Save(string path = null) { Validate(); // Never ever _config.IgnoreLastSession = true; _config.Save(path); }
public void Save(string path = null) { Validate(); _config.SessionSettings = _sessionSettings; // Never ever //_config.IgnoreLastSession = true; _config.Save(path); }
/// <summary> /// Ensures that the given path is a valid server instance. /// </summary> private void ValidateInstance(string path) { Directory.CreateDirectory(Path.Combine(path, "Saves")); Directory.CreateDirectory(Path.Combine(path, "Mods")); var configPath = Path.Combine(path, CONFIG_NAME); if (File.Exists(configPath)) { return; } var config = new MyConfigDedicated <MyObjectBuilder_SessionSettings>(configPath); config.Save(configPath); }