// Call this on a string of text with a given variable dictionary to recursively evaluate the final value of the string.
        public static string ReplaceVariables(string text, Dictionary<string, OverlayVariableBaseModel> variableDictionary)
        {
            Regex rVariables = new Regex("#(.*?)#");
            MatchCollection variables = rVariables.Matches(text);

            VariableEvaluator ve = new VariableEvaluator(variableDictionary);
            text = rVariables.Replace(text, new MatchEvaluator(ve.EvaluateMatch));

            return text;
        }
Пример #2
0
        // Call this on a string of text with a given variable dictionary to recursively evaluate the final value of the string.
        public static string ReplaceVariables(string text, Dictionary <string, OverlayVariableBaseModel> variableDictionary)
        {
            Regex           rVariables = new Regex("#(.*?)#");
            MatchCollection variables  = rVariables.Matches(text);

            VariableEvaluator ve = new VariableEvaluator(variableDictionary);

            text = rVariables.Replace(text, new MatchEvaluator(ve.EvaluateMatch));

            return(text);
        }