コード例 #1
0
        public static TemplateProvider Build(IniSection[] sections)
        {
            Category[]       categories = BuildCategories(sections);
            TemplateProvider template   = new TemplateProvider(categories);

            KnownCategories.Instance.AddRange(template.ToStringArray());
            return(template);
        }
コード例 #2
0
ファイル: TemplateEditor.cs プロジェクト: nithinphilips/SMOz
	   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);
	   }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
0
 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);
         }
     }
 }
コード例 #7
0
ファイル: TemplateHelper.cs プロジェクト: nithinphilips/SMOz
	   public static TemplateProvider Build(IniSection[] sections) {
		  Category[] categories = BuildCategories(sections);
		  TemplateProvider template = new TemplateProvider(categories);
		  KnownCategories.Instance.AddRange(template.ToStringArray());
		  return template;
	   }
コード例 #8
0
ファイル: TemplateHelper.cs プロジェクト: nithinphilips/SMOz
	   public static void Save(TemplateProvider template, string file) {
		  Save(template.Categories, file);
	   }
コード例 #9
0
ファイル: TemplateEditor.cs プロジェクト: nithinphilips/SMOz
	   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);
			 }
		  }
	   }
コード例 #10
0
ファイル: TemplateEditor.cs プロジェクト: nithinphilips/SMOz
	   private void PopulateLookupTable(TemplateProvider template) {
		  lookupTable.Clear();
		  foreach (Category category in template.Categories) {
			 lookupTable.Add(category.ToFormat(), category);
		  }
	   }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: nithinphilips/SMOz
 private void _newTemplate_Click(object sender, EventArgs e)
 {
     this.template = new TemplateProvider();
 }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: nithinphilips/SMOz
 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);
 }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: nithinphilips/SMOz
 private void OpenTemplate(string path)
 {
     TemplateProvider template = Template.TemplateHelper.Build(path);
     OpenTemplate(template);
     this.template = template;
 }
コード例 #14
0
 public static void Save(TemplateProvider template, string file)
 {
     Save(template.Categories, file);
 }