public static string Run(string message) { // todo try { if (ChatBlock) { const RegexOptions Options = RegexOptions.IgnoreCase; IEnumerable <Regex> badWordMatchers = ChatBlockWords.ToArray().Select(x => new Regex(string.Format(PatternTemplate, x), Options)); string output = badWordMatchers.Aggregate(message, (current, matcher) => matcher.Replace(current, CensoredText)); return(output); } if (LanguageBlock) { const RegexOptions Options = RegexOptions.IgnoreCase; IEnumerable <Regex> badWordMatchers = LanguageBlockWords.ToArray().Select(x => new Regex(string.Format(PatternTemplate, x), Options)); string output = badWordMatchers.Aggregate(message, (current, matcher) => matcher.Replace(current, CensoredText)); return(output); } } catch (Exception ex) { ErrorLogging.Run(ex); } return(message); }
public static void Run(bool silentExecution, SvPlayer player = null, bool IsFirstReload = false) { try { if (!silentExecution && player != null) { player.SendChatMessage("[WAIT] Reloading all files.."); } CheckFiles.Run(); ReadFile.Run(SettingsFile); ReadStream.Run(LanguageBlockFile, LanguageBlockWords); ReadStream.Run(ChatBlockFile, ChatBlockWords); ReadStream.Run(AdminListFile, AdminsListPlayers); ReadCustomCommands.Run(); ReadGroups.Run(); LanguageBlockWords = LanguageBlockWords.ConvertAll(d => d.ToLower()); ChatBlockWords = ChatBlockWords.ConvertAll(d => d.ToLower()); if (DownloadIdList && player == null) // do not download every time a player /reloads { GetIdList.Run(false); } else { ReadFile.Run(IdListItemsFile); ReadFile.Run(IdListVehicleFile); } ReadFile.Run(AnnouncementsFile); ReadFile.Run(GodListFile); ReadFile.Run(MuteListFile); ReadFile.Run(AfkListFile); ReadFile.Run(RulesFile); if (!silentExecution && player != null) { player.SendChatMessage("[OK] Critical config files reloaded"); } } catch (Exception ex) { ErrorLogging.Run(ex); } }