예제 #1
0
파일: List.cs 프로젝트: jhogan/qed
 private void _allDescendents(Entry ent, Entries ents)
 {
     ents.Add(ent);
     foreach (Entry child in ent.Entries) {
         _allDescendents(child, ents);
     }
 }
예제 #2
0
파일: List.cs 프로젝트: jhogan/qed
 public Entry Add(string key, string val)
 {
     /* Used to add a new category entry to an existing entry: ent.Entries.Add("myKey", "myVal"); */
     Entry ent = new Entry(key, this._catList);
     ent.Value = val;
     ent.IsLeaf = true;
     ent.ParentId = _parEnt.Id;
     this._catList.Entries.Add(ent);
     ent.BusinessCollection = this._catList.Entries;
     List.Add(ent); return ent;
 }
예제 #3
0
파일: List.cs 프로젝트: jhogan/qed
 public bool Contains(Entry obj)
 {
     foreach(Entry ent in List) {
         if (ent.Equals(obj)){
             return true;
         }
     }
     return false;
 }
예제 #4
0
파일: List.cs 프로젝트: jhogan/qed
 public Entry Add(Entry ent)
 {
     /* Used by CatList.Entries. See Entries.Add(string key)*/
     ent.BusinessCollection = this;
     List.Add(ent); return ent;
 }
예제 #5
0
파일: List.cs 프로젝트: jhogan/qed
 public Entry Add(string key)
 {
     /* Used to add a new leaf entry to an existing entry: ent.Entries.Add("MyNewEntry"); */
     Entry ent = new Entry(key, this._catList);
     ent.ParentId = _parEnt.Id;
     ent.IsLeaf = false;
     this._catList.Entries.Add(ent);
     ent.BusinessCollection = this._catList.Entries;
     List.Add(ent); return ent;
 }
예제 #6
0
파일: List.cs 프로젝트: jhogan/qed
 public Entries(Entry ent, CatList cl)
 {
     _parEnt = ent;
     _catList = cl;
 }
예제 #7
0
파일: List.cs 프로젝트: jhogan/qed
        public Entry Entry(string key)
        {
            Entry ent;
            Entry root = new Entry();
            key = key.ToUpper();
            string[] path = key.Split("/".ToCharArray());
            foreach(Entry rootEnt in this.RootEntries) {
                if (rootEnt.Key.ToUpper() == path[1]){
                    root = rootEnt; break;
                }
            }
            if (root != null){
                ent = root;
                for(int i = 2; i<path.Length; i++){
                    foreach (Entry child in ent.Entries) {
                        if (child.Key.ToUpper() == path[i]){
                            ent = child; break;
                        }
                    }
                }

                /* I don't know why I did this but it didn't work when I wanted to get a category entry with this method
                if (ent.IsLeaf)
                    return ent;
                else
                    return null;*/
                return ent;
            }
            return null;
        }
예제 #8
0
파일: List.cs 프로젝트: jhogan/qed
 public Entry AddRoot(string key)
 {
     Entry ent = new Entry(key, this);
     ent.IsLeaf = false;
     ent.Value = "";
     ent.BusinessCollection = this.Entries;
     this.Entries.Add(ent);
     return ent;
 }
예제 #9
0
파일: Main.cs 프로젝트: jhogan/qed
		private void AddEntToKVP(Entry ent) {
			ListViewItem item = new ListViewItem(new string[]{ent.Key, ent.Value});
			item.Tag = ent;
			lvKVP.Items.Add(item);
		}
예제 #10
0
파일: Main.cs 프로젝트: jhogan/qed
		private void LoadEntry(Entry ent, TreeNode lastTn){
			TreeNode tn = new TreeNode();
			if ( !ent.IsLeaf){
				tn = new TreeNode(ent.Key);
				tn.Tag = ent;
				if (ent.IsRoot){
					tvwHier.Nodes.Add(tn);
				}else{
					lastTn.Nodes.Add(tn);
				}
				foreach(Entry childEnt in ent.Entries){
					this.LoadEntry(childEnt, tn);
				}
				tn = tn.Parent;
			}
		}