/// <summary> /// Replace all macros in message. /// </summary> /// <param name="message">Message to replace.</param> /// <param name="macros">List of macros.</param> /// <param name="macroDelegate">Delegate executed to each string macro.</param> /// <returns></returns> public static string Replace(string message, List <string> macros, MacroDelegate macroDelegate) { foreach (string macro in macros) { message = message.Replace("$(" + macro + ")", macroDelegate(macro)); } return(message); }
/// <summary> /// Replace all macros in message. /// </summary> /// <param name="message">Message to replace.</param> /// <param name="macroDelegate">Delegate executed to each string macro.</param> /// <returns></returns> public static string Replace(string message, MacroDelegate macroDelegate) { foreach (string macro in GetMacros(message)) { message = message.Replace("$(" + macro + ")", macroDelegate(macro)); } return(message); }
public Result AddMacro(string id, MacroDelegate method) { return(_context.MacroManager.Add(new Macro { Name = id, Method = method, SkipArgumentRuntimeCheck = true })); }
public Result AddMacro(string id, SdmapTypes[] arguments, MacroDelegate method) { return(_context.MacroManager.Add(new Macro { Name = id, Arguments = arguments, Method = method, })); }
public Macro(MacroDelegate func, General.UcodeCmds[] cmds) { Function = func; Commands = cmds; }
/// <summary> /// Replace all macros in message. /// </summary> /// <param name="message">Message to replace.</param> /// <param name="macroDelegate">Delegate executed to each string macro.</param> /// <returns></returns> public string ReplaceMacros(string message, MacroDelegate macroDelegate) { return(Macro.Replace(message, GetMacros(), macroDelegate)); }
/// <summary> /// Gets the translation text of class and property in specified language. /// </summary> /// <param name="language">The language.</param> /// <param name="className">Name of the class.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="macroDelegate">Delegate executed to each string macro.</param> /// <returns></returns> public TranslationProperty GetProperty(string language, string className, string propertyName, MacroDelegate macroDelegate) { TranslationProperty property = GetProperty(language, className, propertyName); property.Message = ReplaceMacros(property.Message, macroDelegate); return(property); }