private void ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { this.ReloadConfig(bot); } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { this.LoadSettings(bot); } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { this.Server = bot.Configuration.GetString(this.InternalName, "server", this.Server); } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { this._sendLogon = bot.Configuration.GetBoolean(this.InternalName, "send_logon", this._sendLogon); } }
private void ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section != this.InternalName) { return; } this.LoadConfiguration(bot); }
internal void OnConfigurationChanged(BotShell bot, ConfigurationChangedArgs e) { if (this.ConfigurationChangedEvent != null) { try { this.ConfigurationChangedEvent(bot, e); } catch { } } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { if (e.Key == "group") { this._bot.UsersOverride(new VhanetMembers(this._bot, (string)e.Value, this._database)); } } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section.Equals(this.InternalName, StringComparison.CurrentCultureIgnoreCase)) { switch (e.Key.ToLower()) { case "include_notify": this.IncludeNotifyList = (bool)e.Value; break; case "include_pg": this.IncludePrivateChannel = (bool)e.Value; break; case "seperate_sections": this.SeperateSections = (bool)e.Value; break; case "display_org": this.DisplayOrganization = (string)e.Value; break; case "display_ranks": this.DisplayRanks = (bool)e.Value; break; case "display_mode": this.DisplayMode = (string)e.Value; break; case "display_afk": this.DisplayAfk = (bool)e.Value; break; case "display_alts": this.DisplayAlts = (bool)e.Value; break; case "display_headers": this.DisplayHeaders = (string)e.Value; break; case "send_logon": this.SendLogon = (bool)e.Value; break; case "auto_afk": this.AutoAFK = (bool)e.Value; break; } } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { switch (e.Key) { case "user": case "password": case "host": case "port": case "database": this.RebuildConnection(true); break; } } }
private void Events_ConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName.ToLower()) { switch (e.Key) { case "syntax": bot.CommandSyntax = (string)e.Value; break; case "maxwindowsize_privatemessage": bot.MaxWindowSizePrivateMessage = (int)e.Value; break; case "maxwindowsize_privatechannel": bot.MaxWindowSizePrivateChannel = (int)e.Value; break; case "maxwindowsize_organization": bot.MaxWindowSizeOrganization = (int)e.Value; break; case "color_header": bot.ColorHeaderHex = (string)e.Value; break; case "color_header_detail": bot.ColorHeaderDetailHex = (string)e.Value; break; case "color_highlight": bot.ColorHighlightHex = (string)e.Value; break; case "color_normal": bot.ColorNormalHex = (string)e.Value; break; } } }
public void OnConfigurationChangedEvent(BotShell bot, ConfigurationChangedArgs e) { if (e.Section == this.InternalName) { if (e.Key == "allowedclan") { bot.Bans.AllowedClan = (bool)e.Value; } if (e.Key == "allowedneutral") { bot.Bans.AllowedNeutral = (bool)e.Value; } if (e.Key == "allowedomni") { bot.Bans.AllowedOmni = (bool)e.Value; } if (e.Key == "levelreq") { bot.Bans.LevelRequirement = (int)e.Value; } } }
public bool Set(ConfigType type, string plugin, string key, object value) { if (!this.IsRegistered(plugin, key)) { return(false); } ConfigType dbType = this.GetType(plugin, key); if (dbType != type) { throw new InvalidCastException("Can't replace type " + dbType.ToString() + " with type " + type.ToString() + " at " + key + "@" + plugin); } if (type == ConfigType.Custom) { throw new ArgumentException("Can not set type Custom!"); } plugin = plugin.ToLower(); key = key.ToLower(); string format; if (!this.Exists(plugin, key)) { format = "INSERT INTO CORE_Settings VALUES ('{0}', '{1}', '{2}', '{3}')"; } else { format = "UPDATE CORE_Settings SET Value = '{3}', Type = '{2}' WHERE Section = '{0}' AND Key = '{1}'"; } try { string valueString; switch (type) { case ConfigType.Color: if (!Regex.Match((string)value, "^[#]?[0-9a-f]{6}$", RegexOptions.IgnoreCase).Success) { return(false); } valueString = (string)value; if (valueString.Length == 7) { valueString = valueString.Substring(1); } break; case ConfigType.String: valueString = (string)value; ConfigurationEntry stringEntry = this.GetEntry(plugin, key); if (stringEntry.Values != null && stringEntry.Values.Length > 0) { List <object> values = new List <object>(stringEntry.Values); if (!values.Contains(value)) { return(false); } } break; case ConfigType.Password: valueString = (string)value; break; case ConfigType.Integer: valueString = ((Int32)value).ToString(); ConfigurationEntry intEntry = this.GetEntry(plugin, key); bool result = (intEntry.Values.Length < 1); foreach (object intEntryValue in intEntry.Values) { try { if ((Int32)intEntryValue == (Int32)value) { result = true; } } catch { } } if (!result) { return(false); } break; case ConfigType.Boolean: valueString = "false"; if ((Boolean)value) { valueString = "true"; } break; case ConfigType.Date: valueString = TimeStamp.FromDateTime((DateTime)value).ToString(); break; case ConfigType.Time: valueString = ((TimeSpan)value).Ticks.ToString(); break; case ConfigType.Dimension: valueString = ((Server)value).ToString(); break; case ConfigType.Username: if (this.Parent.GetUserID((string)value) < 1) { return(false); } valueString = (string)value; break; default: return(false); } string query = string.Format(format, Config.EscapeString(plugin), Config.EscapeString(key), type.ToString(), Config.EscapeString(valueString)); if (this.Config.ExecuteNonQuery(query) > 0) { ConfigurationChangedArgs args = new ConfigurationChangedArgs(type, plugin, key, value); this.Parent.Events.OnConfigurationChanged(this.Parent, args); return(true); } } catch { } return(false); }