public void Setup(string ServerName, bool LoadConfig = false) { _servername = ServerName; sCalendarCommand = new CalendarCommand(ServerName); sBirthdayCommand = new BirthdayCommand(ServerName); sBanCommand = new BanCommand(ServerName); sBan = new Ban(ServerName); if(IRCConfig.List[ServerName].ServerId == 1 || LoadConfig) _config = new AddonConfig(Name, ".yml"); _calendar = new Calendar(ServerName); _calendar.Start(); sIrcBase.Networks[ServerName].IrcRegisterHandler("PRIVMSG", HandlePrivmsg); InitIrcCommand(); SchumixBase.DManager.Update("banned", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); SchumixBase.DManager.Update("birthday", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); SchumixBase.DManager.Update("calendar", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); if(CleanConfig.Database) { SchumixBase.sCleanManager.CDatabase.CleanTable("banned"); SchumixBase.sCleanManager.CDatabase.CleanTable("birthday"); SchumixBase.sCleanManager.CDatabase.CleanTable("calendar"); } }
public int Reload(string RName, bool LoadConfig, string SName = "") { try { switch(RName.ToLower()) { case "config": if(IRCConfig.List[_servername].ServerId == 1 || LoadConfig) _config = new AddonConfig(Name, ".yml"); return 1; case "command": InitIrcCommand(); RemoveIrcCommand(); return 1; } } catch(Exception e) { Log.Error("CalendarAddon", sLConsole.GetString("Reload: ") + sLConsole.GetString("Failure details: {0}"), e.Message); return 0; } return -1; }