protected override void LoadConfig() { base.LoadConfig(); try { _config = Config.ReadObject <Configuration>(); if (_config == null) { throw new Exception(); } } catch { PrintError("Your configuration file contains an error. Using default configuration values."); LoadDefaultConfig(); } }
private void ValidateConfig() { this.LoadConfig(); try { object version = Config.Get("VERSION"); if (version == null) { this.LoadDefaultConfig(); } else if (version.Equals("2.1.10")) { this.Data = new ConfigData { Settings = new ConfigData.SettingsWrapper { Cooldown = this.GetSetting("cooldownMinutes", 5f), RefundRatio = this.GetSetting("refundRatio", 0.5f), RadiationMax = this.GetSetting("radiationMax", 1f), NPCOnly = this.GetSetting("NPCOnly", false), NPCIds = this.GetSetting("NPCIDs", new List <object>()), RecyclableTypes = this.GetSetting("recyclableTypes", new List <object>() { "Ammunition", "Attire", "Common", "Component", "Construction", "Electrical", "Fun", "Items", "Medical", "Misc", "Tool", "Traps", "Weapon" }), Blacklist = this.GetSetting("blacklist", new List <object>()), AllowedInSafeZones = this.GetSetting("allowSafeZone", true) } }; this.UpdateAndSave(); } else if (version.Equals("3.0.0") || version.Equals("3.0.1") || version.Equals("3.0.3")) { /* All of these versions should handle updating fine due to * the ConfigData object having defaults */ this.Data = Config.ReadObject <ConfigData>(); if (this.Data == null || this.Data.Settings == null) { this.LoadDefaultConfig(); } else { this.UpdateAndSave(); } } } catch (NullReferenceException) {} }
protected void LoadConfigValues() { Settings = Config.ReadObject <NotificationConfigContainer>(); UserLastNotified = new List <NotificationCooldown>(); if (Settings.SlackConfig.DoLinkSteamProfile) { SlackMethodName = "FancyMessage"; } else { SlackMethodName = "SimpleMessage"; } DiscordMethodName = "SendMessage"; }
protected override void LoadConfig() { base.LoadConfig(); try { FConfig = Config.ReadObject <ConfigData>(); if (FConfig == null) { LoadDefaultConfig(); } } catch { LoadDefaultConfig(); } SaveConfig(); }
void LoadConfigValues() { _config = Config.ReadObject <PluginConfig>(); var defaultConfig = DefaultConfig(); Merge(_config.Settings, defaultConfig.Settings); Merge(_config.VoteSettings, defaultConfig.VoteSettings); Merge(_config.Reward, defaultConfig.Reward, true); Merge(_config.Variables, defaultConfig.Variables); if (!configChanged) { return; } PrintWarning("Configuration file updated!"); Config.WriteObject(_config); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config == null) { LoadDefaultConfig(); } } catch { LoadDefaultConfig(); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { configData = Config.ReadObject <ConfigData>(); if (configData == null) { throw new JsonException(); } } catch { LoadDefaultConfig(); SaveConfig(); } }
private const string UsePermission = "clanclothing.use"; //Plugin use permission #endregion #region Loading & Setup // ReSharper disable once UnusedMember.Local private void Loaded() { LoadLang(); _pluginConfig = ConfigOrDefault(Config.ReadObject <PluginConfig>()); Config.WriteObject(_pluginConfig, true); _storedData = Interface.Oxide.DataFileSystem.ReadObject <StoredData>("ClanClothing"); //Add the chat commands from the config cmd.AddChatCommand(_pluginConfig.Commands["CheckCost"], this, CheckCostChatCommand); cmd.AddChatCommand(_pluginConfig.Commands["ViewClanClothing"], this, ViewClanClothingChatCommand); cmd.AddChatCommand(_pluginConfig.Commands["ClaimCommand"], this, RedeemChatCommand); cmd.AddChatCommand(_pluginConfig.Commands["AddCommand"], this, AddChatCommand); cmd.AddChatCommand(_pluginConfig.Commands["RemoveCommand"], this, RemoveChatCommand); permission.RegisterPermission(UsePermission, this); }
void Init() { try { chatCommands = Config.ReadObject <Dictionary <string, string> >(); } catch (Exception ex) { Puts($"ERROR: Config file is formatted incorrectly! EasyChatCommands are NOT LOADED!!!"); return; } foreach (string command in chatCommands.Keys) { cmd.AddChatCommand(command, this, "OnChatInfoCommand"); Puts("Added a command"); } Puts("Loaded Chat Commands successfully."); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <ConfigFile>(); if (config == null) { LoadDefaultConfig(); } } catch { PrintError("The configuration file is corrupted"); LoadDefaultConfig(); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <ConfigData>(); if (config == null) { LoadDefaultConfig(); } } catch { PrintError("Configuration file is corrupt! Check your config file at https://jsonlint.com/"); LoadDefaultConfig(); return; } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config == null) { throw new Exception(); } SaveConfig(); } catch { PrintError("Error loading config, using default values"); LoadDefaultConfig(); } }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config == null) { throw new Exception(); } } catch { Config.WriteObject(config, false, $"{Interface.Oxide.ConfigDirectory}/{Name}.jsonError"); PrintError("The configuration file contains an error and has been replaced with a default config.\n" + "The error configuration file was saved in the .jsonError extension"); LoadDefaultConfig(); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <PluginConfig>(); if (config == null) { LoadDefaultConfig(); } } catch { LoadDefaultConfig(); Logger("ConfigError"); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { configData = Config.ReadObject <ConfigData>(); if (configData == null) { LoadDefaultConfig(); } } catch { PrintError("Config has corrupted or incorrectly formatted"); LoadDefaultConfig(); } SaveConfig(); }
private new bool LoadConfig() { try { Config.Settings = new JsonSerializerSettings(); if (!Config.Exists()) { return(CreateDefaultConfig()); } _config = Config.ReadObject <ConfigData>(); } catch (Exception e) { Puts("Config load failed: {0}{1}{2}", e.Message, Environment.NewLine, e.StackTrace); return(false); } return(true); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config == null) { LoadDefaultConfig(); SaveConfig(); } } catch { PrintWarning($"Creating new config file."); LoadDefaultConfig(); } }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config?.UnderwaterPercent == null) { LoadDefaultConfig(); SaveConfig(); } } catch { LogWarning($"Could not read oxide/config/{Name}.json, creating new config file"); LoadDefaultConfig(); } }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config?.MoneyStealing == null) { LoadDefaultConfig(); } } catch { PrintWarning($"Could not read oxide/config/{Name}.json, creating new config file"); LoadDefaultConfig(); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { configData = Config.ReadObject <ConfigData>(); if (configData == null) { LoadDefaultConfig(); } } catch (Exception ex) { PrintError($"The configuration file is corrupted. \n{ex}"); LoadDefaultConfig(); } SaveConfig(); }
void Loaded() { Cfg = Config.ReadObject <ConfigFile>(); _mySqlConnection = _mySql.OpenDb(Cfg.Host, Cfg.Port, Cfg.Database, Cfg.User, Cfg.Password, this); if (_mySqlConnection == null) { Puts("Can't connect to the database!"); return; } var sql = Sql.Builder.Append(@"CREATE TABLE IF NOT EXISTS xpsync ( id BIGINT(32), xp FLOAT );"); _mySql.ExecuteNonQuery(sql, _mySqlConnection); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <Configuration>(); if (config == null) { throw new JsonException(); } SaveConfig(); Config.WriteObject(config); } catch (Exception e) { // Likely to be a pretty insane exception. It is probably just invalid JSON Puts("Configuration is syntactically invalid! Validate your configuration. Loading defaults {0}", e.ToString()); LoadDefaultConfig(); return; } }
protected override void LoadConfig() { base.LoadConfig(); try { Settings = Config.ReadObject <PluginSettings>(); if (Settings == null || Settings.FileNames == null) { throw new JsonException(); } } catch { LoadDefaultConfig(); } }
private void LoadVariables() { configs = Config.ReadObject <ConfigData>(); if (configs == null) { LoadDefaultConfig(); } storedData = Interface.Oxide.DataFileSystem.ReadObject <StoredData>("Timber"); if (storedData == null) { storedData = new StoredData(); } SaveConfig(); SaveStored(); }
protected override void LoadConfig() { base.LoadConfig(); try { CFile = Config.ReadObject <ConfigFile>(); if (CFile == null) { Regenerate(); return; } if (CFile.Blueprint == null) { CFile.Blueprint = new BlueprintSettings(); SaveConfig(); } } catch { Regenerate(); } }
protected override void LoadConfig() { try { base.LoadConfig(); configData = Config.ReadObject <ConfigData>(); if (configData == null) { LoadDefaultConfig(); } } catch { LoadDefaultConfig(); } surnameList = configData.SurnameList.Split(',').Distinct().ToList(); SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <ConfigData>(); if (config == null) { LoadDefaultConfig(); } } catch { PrintError("Configuration file is corrupt! Unloading plugin..."); Interface.Oxide.RootPluginManager.RemovePlugin(this); return; } SaveConfig(); }
private void OnServerInitialized() { LoadConfig(); var configFileName = Manager.ConfigPath + "/server_info_text.json"; _settings = null; try { var settingsDict = Config.Get("settings") as Dictionary <string, object>; _settings = JsonConvert.DeserializeObject <Settings>(JsonConvert.SerializeObject(settingsDict)); } catch (Exception) { Puts("ServerInfo: Failed to load config"); return; } _settings = _settings ?? Settings.CreateDefault(); if (!_settings.UpgradedConfig && Config.Exists(configFileName)) { try { Puts("ServerInfo: Upgrading settings from server_info_text.json"); _settings = Config.ReadObject <Settings>(configFileName); _settings.UpgradedConfig = true; Puts("ServerInfo: Successfully upgraded config"); } catch (Exception) { Puts("ServerInfo: Failed to upgrade config. Manual editing is required."); Puts("ServerInfo: Copy your settings by parts to new config in ServerInfo.json"); } } foreach (var player in BasePlayer.activePlayerList) { AddHelpButton(player); } Config.Set("settings", _settings); SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { config = Config.ReadObject <ConfigData>(); if (config?.normal == null || config?.blocked == null) { LoadDefaultConfig(); } } catch { LoadDefaultConfig(); } SaveConfig(); }
protected override void LoadConfig() { base.LoadConfig(); try { _config = Config.ReadObject <Configuration>(); if (_config == null) { throw new System.Exception(); } SaveConfig(); } catch { PrintWarning("Error loading config (either corrupt or does not exist), using default values"); LoadDefaultConfig(); } }