Exemplo n.º 1
0
        public string Generalize(string input)
        {
            // we only use static map (dynamic seems to be too volatile)
            foreach (KeyValuePair <string, IStringMacroResolver> mapping in resolverTable)
            {
                IStringMacroResolver resolver = mapping.Value;
                if (!resolver.IsGeneralizable)
                {
                    continue;
                }

                string value;
                if (resolver.Resolve(mapping.Key, null, out value))
                {
                    input = input.Replace(value, "$(" + mapping.Key + ")");
                }
            }
            return(input);
        }
Exemplo n.º 2
0
 public void AddDynamicMapping(string name, IStringMacroResolver stringMacroResolver)
 {
     resolverTable.Add(name, stringMacroResolver);
 }