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