예제 #1
0
        public FolderObject(string name, FolderObject fo)
        {
            this._name = name;

            _isRoot    = false;
            _bookmarks = new List <string>();
            _folders   = new List <FolderObject>();
            _parent    = fo;
        }
예제 #2
0
        private FolderObject __getFolder(string folderName)
        {
            foreach (FolderObject fo in _folders)
            {
                if (fo.Name == folderName)
                {
                    return(fo);
                }
            }
            FolderObject newFO = new FolderObject(folderName, this); _folders.Add(newFO);

            return(newFO);
        }
예제 #3
0
        private void __writeToFile(SortableBindingList <BookmarkObject> sbl)
        {
            string       output = _startOfFile;
            FolderObject root   = new FolderObject("Bookmarks", null);

            root.IsRoot = true;

            foreach (BookmarkObject bo in sbl)
            {
                root.Add(bo);
            }

            output += root.ToString();
            output += _endOfFile;
            //TextBoxPop tbp = new TextBoxPop(output);
            //tbp.Show();
        }
예제 #4
0
 private void __add(BookmarkObject bo, string currentPath)
 {
     if (string.IsNullOrEmpty(currentPath))
     {
         _bookmarks.Add(bo.ToString());
     }
     else
     {
         string nextPath   = string.Empty;
         string nextFolder = string.Empty;
         nextFolder = __getNextFolder(currentPath);
         nextPath   = __getNextPath(currentPath);
         FolderObject fo = __getFolder(nextFolder);
         fo.Parent = this;
         fo.__add(bo, nextPath);
     }
 }
예제 #5
0
 public void Add(BookmarkObject bo)
 {
     if (bo.Parent == this._name)
     {
         _bookmarks.Add(bo.ToString());
     }
     else
     {
         string nextPath   = string.Empty;
         string nextFolder = string.Empty;
         string tmpPath    = string.Empty;
         tmpPath    = __getNextPath(bo.Path);
         nextFolder = __getNextFolder(tmpPath);
         nextPath   = __getNextPath(tmpPath);
         FolderObject fo = __getFolder(nextFolder);
         fo.Parent = this;
         fo.__add(bo, nextPath);
     }
 }