public static List <Template> CreateTemplates(string templateFolder, Model.Database database, List <Setting> settings) { Config.System syscfg = Config.System.Load(); List <string> xmlFiles = new List <string>(); foreach (string item in Directory.GetFiles(templateFolder, "*.xml")) { if (false == item.EndsWith(syscfg.SettingFile, StringComparison.CurrentCultureIgnoreCase)) { xmlFiles.Add(item); } } List <Template> templates = new List <Template>(); foreach (string xmlFile in xmlFiles) { string forAttr = new TemplateBase(xmlFile).For; if (forAttr.Equals(typeof(Model.Database).Name, StringComparison.CurrentCultureIgnoreCase)) { Template generator = new DatabaseTemplate(xmlFile, settings, database); if (generator.On) { templates.Add(generator); } } else if (forAttr.Equals(typeof(Model.Table).Name, StringComparison.CurrentCultureIgnoreCase)) { foreach (Model.Table item in database.SelectedTables) { Template generator = new TableTemplate(xmlFile, settings, item); if (generator.On) { templates.Add(generator); } } } } templates.Sort(); return(templates); }
public int CompareTo(object obj) { TemplateBase t = obj as TemplateBase; return(this.Sort.CompareTo(t.Sort)); }