/// <summary> /// Formats the section. /// </summary> /// <param name="sectionTemplate">The section template.</param> /// <param name="emailTemplate">The email template.</param> /// <param name="parameterHash">The parameter hash.</param> /// <param name="htmlEncode">if set to <c>true</c> [HTML encode].</param> /// <returns>String</returns> protected string FormatSection(string sectionTemplate, EmailTemplate emailTemplate, ParameterCollection parameterHash, bool htmlEncode) { string text = sectionTemplate; IDictionaryEnumerator hashEnum = parameterHash.GetEnumerator(); while (hashEnum.MoveNext()) { object key = hashEnum.Key; object value = hashEnum.Value; if (key != null && value != null) text = FormatOneField(text, emailTemplate, key.ToString(), value.ToString(), htmlEncode); } return text; }
private string FormatText(string text, ParameterCollection parameterCollection) { Antlr.StringTemplate.StringTemplate template = new Antlr.StringTemplate.StringTemplate(text); IDictionaryEnumerator enumerator = parameterCollection.GetEnumerator(); while (enumerator.MoveNext()) { string key = enumerator.Key as string; object obj2 = enumerator.Value; template.SetAttribute(key, obj2); } return template.ToString(); }