public ManagerController() { ManagerSettingsLoadedFromFile = false; ManagerSettings = new ManagerSettings(); _backupController = new BackupController(); _LoadCommandDefinitions(); _LoadSettings(); ServerSettings = new AvorionServerSettings(); ServerSettingLoadedFromFile = false; LoadServerSettings(); BackupSettings = new BackupSettings(); BackupSettingsLoadedFromFile = false; LoadBackupSettings(); }
private void _LoadSettings() { if (!Directory.Exists(Constants.SettingsFolderName)) { Directory.CreateDirectory(Constants.SettingsFolderName); } else { if (File.Exists(Path.Combine(Constants.SettingsFolderName, Constants.ManagerSettingsFileName))) { using (StreamReader file = File.OpenText(Path.Combine(Constants.SettingsFolderName, Constants.ManagerSettingsFileName))) { JsonSerializer serializer = new JsonSerializer(); ManagerSettings = (ManagerSettings)serializer.Deserialize(file, typeof(ManagerSettings)); ManagerSettingsLoadedFromFile = true; } } } }