protected override void LoadConfig() { base.LoadConfig(); try { _config = Config.ReadObject <PluginConfig>(); if (_config == null) { throw new JsonException(); } if (!_config.ToDictionary().Keys.SequenceEqual(Config.ToDictionary(x => x.Key, x => x.Value).Keys)) { PrintWarning("Config was updated"); SaveConfig(); } } catch { PrintWarning("Invalid config, default config has been loaded."); LoadDefaultConfig(); } }
protected override void LoadConfig() { base.LoadConfig(); try { _config = Config.ReadObject <PluginConfig>(); if (_config == null) { throw new JsonException(); } if (!_config.ToDictionary().Keys.SequenceEqual(Config.ToDictionary(x => x.Key, x => x.Value).Keys)) { PrintWarning($"PluginConfig file {Name}.json updated."); SaveConfig(); } } catch { LoadDefaultConfig(); PrintError("Config file contains an error and has been replaced with the default file."); } }