/// <summary> /// Replace special chars \r \n \t \\ \" /// </summary> /// <param name="message">input text</param> /// <returns></returns> public static string ReplaceSpecialChars(string message) { List <string> macros = Macro.GetMacros(message); message = Macro.NamesToNumbers(message, macros); message = message.Replace(@"\r", "\r"). Replace(@"\n", "\n"). Replace(@"\t", "\t"). Replace("\\\"", "\""). Replace(@"\\", "\\"); message = Macro.NumbersToNames(message, macros); return(message); }
/// <summary> /// Get list of macros from all translation. /// </summary> /// <returns></returns> public List <string> GetMacros() { var macros = new List <string>(); foreach (KeyValuePair <string, TranslationClasses> classes in this) { foreach (KeyValuePair <string, TranslationProperties> properties in this[classes.Key]) { foreach (KeyValuePair <string, TranslationProperty> property in this[classes.Key][properties.Key]) { foreach (string macro in Macro.GetMacros(this[classes.Key][properties.Key][property.Key].Message)) { if (macros.Contains(macro) == false) { macros.Add(macro); } } } } } return(macros); }