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 BanCommand(string ServerName) : base(ServerName) { sBan = new Ban(ServerName); sUnban = new Unban(ServerName); _regex = new Regex(@"((?<year>[0-9]{4,4})(?:[\.\s]+|))?" // Year + @"((?<month>[0-9]{1,2}|[a-zóüöúőűáéí]{3,20})(?:[\.\s]+|))?" // Month + @"((?<day>[0-9]{1,2})(?:[\.\s]+|))?" // Day + @"((?<hour>[0-9]{1,2})(?:[:]|))?" // Hour + @"(?<minute>[0-9]{1,2})?" // Minute + @"((?:[\s]+)(?<text>(.*)))?", RegexOptions.Compiled | RegexOptions.IgnoreCase); _hamregex = new Regex(@"((?<hour>[0-9]{1,2})(?:[:]|))?" // Hour + @"(?<minute>[0-9]{1,2})?" // Minute + @"((?:[\s]+)(?<text>(.*)))?", RegexOptions.Compiled | RegexOptions.IgnoreCase); }