public static TemplateProvider Build(IniSection[] sections) { Category[] categories = BuildCategories(sections); TemplateProvider template = new TemplateProvider(categories); KnownCategories.Instance.AddRange(template.ToStringArray()); return(template); }
public TemplateEditor(StartManager manager, TemplateProvider template) { InitializeComponent(); this.Icon = SMOz.Properties.Resources.Application; this.template = template; this.manager = manager; var uncategorized = from t in manager.GetByCategory("") select t.Name; InitializeTable(uncategorized.ToArray(), KnownCategories.Instance.ToArray()); AddToTable(string.Empty); }
public static TemplateProvider FromFile(string file) { TemplateProvider template = new TemplateProvider(); IniSection[] sections = IniParser.Parse(file); for (int i = 0; i < sections.Length; i++) { Category category = Category.FromFormat(sections[i].Name); template.categories.Add(category); CategoryItem[] items = new CategoryItem[sections[i].Count]; for (int j = 0; j < sections[i].Count; j++) { items[j] = CategoryItem.FromFormat(sections[i][j]); } category.AddRange(items); } return template; }
public static TemplateProvider FromFile(string file) { TemplateProvider template = new TemplateProvider(); IniSection[] sections = IniParser.Parse(file); for (int i = 0; i < sections.Length; i++) { Category category = Category.FromFormat(sections[i].Name); template.categories.Add(category); CategoryItem[] items = new CategoryItem[sections[i].Count]; for (int j = 0; j < sections[i].Count; j++) { items[j] = CategoryItem.FromFormat(sections[i][j]); } category.AddRange(items); } return(template); }
public void Merge(TemplateProvider other) { foreach (Category otherCategory in other.categories) { Category existingCategory = categories.Find( delegate(Category match) { return(string.Compare(match.ToFormat(), otherCategory.ToFormat(), Utility.IGNORE_CASE) == 0); }); if (existingCategory != null) { for (int i = 0; i < otherCategory.Count; i++) { if (!existingCategory.Contains(otherCategory[i])) { existingCategory.Add(otherCategory[i]); } } } else { categories.Add(otherCategory); } } }
public void Merge(TemplateProvider other) { foreach (Category otherCategory in other.categories) { Category existingCategory = categories.Find( delegate(Category match) { return (string.Compare(match.ToFormat(), otherCategory.ToFormat(), Utility.IGNORE_CASE) == 0); }); if (existingCategory != null) { for (int i = 0; i < otherCategory.Count; i++) { if (!existingCategory.Contains(otherCategory[i])) { existingCategory.Add(otherCategory[i]); } } } else { categories.Add(otherCategory); } } }
public static TemplateProvider Build(IniSection[] sections) { Category[] categories = BuildCategories(sections); TemplateProvider template = new TemplateProvider(categories); KnownCategories.Instance.AddRange(template.ToStringArray()); return template; }
public static void Save(TemplateProvider template, string file) { Save(template.Categories, file); }
public void PersistAllChanges(TemplateProvider template, IEnumerable<EXListViewItem> listItems) { foreach (EXListViewItem listItem in listItems) { CategoryItem catiItem = listItem.TagData as CategoryItem; if (catiItem != null) { catiItem.Value = listItem.SubItems[0].Text; catiItem.Type = (CategoryItemType)Enum.Parse(typeof(CategoryItemType), listItem.SubItems[1].Text); Category category = FindCategory(listItem.SubItems[2].Text); if (catiItem.Parent != category) { category.Add(catiItem); } catiItem.Type = (CategoryItemType)Enum.Parse(typeof(CategoryItemType), listItem.SubItems[1].Text); } } }
private void PopulateLookupTable(TemplateProvider template) { lookupTable.Clear(); foreach (Category category in template.Categories) { lookupTable.Add(category.ToFormat(), category); } }
private void _newTemplate_Click(object sender, EventArgs e) { this.template = new TemplateProvider(); }
private void OpenTemplate(TemplateProvider template) { for (int i = -1; i < template.Count; i++) { string current; current = i == -1 ? "" : template[i].Name; foreach (string str in AddCategoryToTree(current)) { // This ensures that nodes that are not explicitly listed as categories are scanned KnownCategories.Instance.Add(str); startManager.RemoveAllItems(str); AddToManager(str); } } startManager.LoadAssociationList(Utility.ASSOCIATION_LIST_FILE_PATH); }
private void OpenTemplate(string path) { TemplateProvider template = Template.TemplateHelper.Build(path); OpenTemplate(template); this.template = template; }