Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
 public Result AddMacro(string id, MacroDelegate method)
 {
     return(_context.MacroManager.Add(new Macro
     {
         Name = id,
         Method = method,
         SkipArgumentRuntimeCheck = true
     }));
 }
Exemplo n.º 4
0
 public Result AddMacro(string id, SdmapTypes[] arguments, MacroDelegate method)
 {
     return(_context.MacroManager.Add(new Macro
     {
         Name = id,
         Arguments = arguments,
         Method = method,
     }));
 }
Exemplo n.º 5
0
 public Macro(MacroDelegate func, General.UcodeCmds[] cmds)
 {
     Function = func;
     Commands = cmds;
 }
Exemplo n.º 6
0
 /// <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));
 }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
 public Macro(MacroDelegate func, General.UcodeCmds[] cmds)
 {
     Function = func;
     Commands = cmds;
 }