public string ReplaceKeyword(string input) { var KeywordReplace = LoadDataConfig.LoadListKeywordReplace(); //NLogManager.LogMessage(JsonConvert.SerializeObject(KeywordReplace)); if (KeywordReplace.Count > 0) { foreach (var item in KeywordReplace) { input = input.Replace(item.text, item.replace); } } return(input); }
private void DeleteAccountBlock(string key) { try { XDocument xmldoc = XDocument.Load(ACCOUNTBLOCK_FILE); XElement xmlelement = xmldoc.Element("AccountBlock").Elements("key").Single(x => (string)x.Attribute("key") == key); xmlelement.Remove(); xmldoc.Save(ACCOUNTBLOCK_FILE); //BicCache.Remove("ACCOUNTBLOCK_FILE"); LoadDataConfig.ForceGetListAccBlock(); } catch (Exception ex) { NLogManager.PublishException(ex); } }
public string ReturnCheckBanUsers(string username) { string message = ""; var ListAccountBlock = LoadDataConfig.LoadListAccountBlock(); if (ListAccountBlock.Count > 0) { foreach (var item in ListAccountBlock) { if (item.name == username) { message = string.Format("<span style='color:red; font-weight:bold'>Tài khoản đang bị Block, lý do: {0} - Thời hạn đến: {1}</span>", item.namereasonblock, item.endtimeblock); } } } return(message); }
public string RemoveBadWords(string input, out bool Flag) { Flag = false; var BadWords = LoadDataConfig.LoadListBadWords(); int bwLength = BadWords.Count; for (int i = 0; i < bwLength; i++) { try { input = input.Replace(BadWords[i].ToString(), "***"); } catch (Exception ex) { NLogManager.PublishException(ex); } } return(input); }
public bool CheckBanUsers(string username) { var ListAccountBlock = LoadDataConfig.LoadListAccountBlock(); if (ListAccountBlock.Count > 0) { foreach (var item in ListAccountBlock) { if (item.name.Trim() == username.Trim()) { if (DateTime.Now >= DateTime.Parse(item.endtimeblock)) { DeleteAccountBlock(item.key); return(false); } return(true); } } } return(false); //Bỏ Return đọc từ file txt cũ - huandh //return BanUsers.Contains(username); }
private void LoadListAdmin() { ADMINS = LoadDataConfig.LoadListAdmin(); }