public static StringBuilder ReplaceWord(StringBuilder sb, bool bWordToCode) { if (!PatchFinalList.UseReplaceWord) { return(sb); } if (bWordToCode) { ReplaceItem[] rEPLACE_ITEMS = PatchFinalList.REPLACE_ITEMS; for (int i = 0; i < rEPLACE_ITEMS.Length; i++) { ReplaceItem replaceItem = rEPLACE_ITEMS[i]; sb = sb.Replace(replaceItem.word, replaceItem.code); } } else { ReplaceItem[] rEPLACE_ITEMS2 = PatchFinalList.REPLACE_ITEMS; for (int j = 0; j < rEPLACE_ITEMS2.Length; j++) { ReplaceItem replaceItem2 = rEPLACE_ITEMS2[j]; sb = sb.Replace(replaceItem2.code, replaceItem2.word); } } return(sb); }
public static string ReplaceWord(string str, bool bWordToCode) { if (!PatchFinalList.UseReplaceWord) { return(str); } StringBuilder stringBuilder = new StringBuilder(512); if (bWordToCode) { stringBuilder.Append(str.ToLower()); ReplaceItem[] rEPLACE_ITEMS = PatchFinalList.REPLACE_ITEMS; for (int i = 0; i < rEPLACE_ITEMS.Length; i++) { ReplaceItem replaceItem = rEPLACE_ITEMS[i]; stringBuilder = stringBuilder.Replace(replaceItem.word, replaceItem.code); } } else { ReplaceItem[] rEPLACE_ITEMS2 = PatchFinalList.REPLACE_ITEMS; for (int j = 0; j < rEPLACE_ITEMS2.Length; j++) { ReplaceItem replaceItem2 = rEPLACE_ITEMS2[j]; stringBuilder = stringBuilder.Replace(replaceItem2.code, replaceItem2.word); } } return(stringBuilder.ToString()); }