/// <summary> /// Load config for template /// </summary> /// <param name="templateName"></param> /// <returns></returns> public static TemplateConfigurer LoadTemplateConfig(String templateName) { var configurer = new TemplateConfigurer(templateName); configurer.Load(templateName); return(configurer); }
void LoadAllTemplate() { var templates = TemplateConfigurer.LoadAllTemplates(); cbSupportedTemplates.Items.Clear(); foreach (var item in templates) { cbSupportedTemplates.Items.Add(item); } }
private static VelocityContext GetContext(TemplateConfigurer configurer, DatabaseType type) { var context = new VelocityContext(); context.Put("namespace", configurer.Namespace); context.Put("string", typeof(String)); context.Put("fn", typeof(StringUtils)); context.Put("providerType", String.Format("{0}.{1}", type.GetType().FullName, type)); return(context); }
private void cbTemplateFiles_SelectedIndexChanged(object sender, EventArgs e) { var selectedTemplate = cbSupportedTemplates.SelectedItem as TemplateConfigurer; if (null == selectedTemplate) { return; } var selectedConfig = cbTemplateFiles.SelectedItem as TemplateConfig; rtbTemplate.Text = TemplateConfigurer.LoadTemplateString(selectedTemplate.TemplateName, selectedConfig); }
private void SaveTemplateConfig() { var selectedTemplate = cbSupportedTemplates.SelectedItem as TemplateConfigurer; if (null == selectedTemplate) { return; } var selectedConfig = cbTemplateFiles.SelectedItem as TemplateConfig; var file = TemplateConfigurer.GetTemplateStringFile(selectedTemplate.TemplateName, selectedConfig); using (var sw = new StreamWriter(file)) { sw.Write(rtbTemplate.Text); } }