Exemplo n.º 1
0
        private int addFolder(TreeTraverser.FolderEntry folder)
        {
            foreach (BackendBase backend in this.backends)
            {
                this.reportBackupAction(new BackupActionItem(null, folder.RelPath, BackupActionEntity.Folder, BackupActionOperation.Add, backend.Name));
                backend.CreateFolder(folder.RelPath, folder.Attributes);
                this.Logger.Info("{0}: Added folder: {1}", backend.Name, folder.RelPath);
            }
            int insertedId = this.fileDatabase.AddFolder(folder.RelPath);

            return(insertedId);
        }
Exemplo n.º 2
0
 private void checkFolder(TreeTraverser.FolderEntry folder)
 {
     foreach (BackendBase backend in this.backends)
     {
         if (!backend.FolderExists(folder.RelPath))
         {
             this.reportBackupAction(new BackupActionItem(null, folder.RelPath, BackupActionEntity.Folder, BackupActionOperation.Add, backend.Name));
             backend.CreateFolder(folder.RelPath, folder.Attributes);
             this.Logger.Info("{0}: Folder missing from backend, so re-creating: {1}", backend.Name, folder.RelPath);
         }
     }
 }
Exemplo n.º 3
0
        public void Populate(string startDir, string ignoreRules)
        {
            // Get rid of anything there before
            this.tree.Nodes.Clear();
            // aaand start again!
            TreeTraverser treeTraverser = new TreeTraverser(startDir, ignoreRules);
            TreeNodeTri   node;

            TreeTraverser.FolderEntry root = treeTraverser.ListFolders(0).First();
            foreach (TreeTraverser.FolderEntry folder in root.GetFolders())
            {
                node = new TreeNodeTri(folder, this.tree.ImageList, this.IgnoredFiles, this.IgnoredFolders, this.tree);
                node.Populate();
                this.tree.Nodes.Add(node);
            }
            foreach (TreeTraverser.FileEntry file in root.GetFiles())
            {
                this.tree.Nodes.Add(new TreeNodeTri(file, this.tree.ImageList, this.IgnoredFiles, this.IgnoredFolders, this.tree));
            }
        }
Exemplo n.º 4
0
            public TreeNodeTri(TreeTraverser.FolderEntry folderEntry, ImageList imageList, HashSet <string> ignoredFiles, HashSet <string> ignoredFolders, TreeView parentTree, CheckedState defaultState = CheckedState.Checked)
                : base(folderEntry.Name)
            {
                this.imageList = imageList;
                if (ignoredFolders.Contains(folderEntry.FullPath))
                {
                    this.State = CheckedState.Unchecked;
                    // No children yet to update
                }
                else
                {
                    this.State = defaultState;
                }
                this.StateImageIndex = (int)this.State;

                this.ignoredFiles   = ignoredFiles;
                this.ignoredFolders = ignoredFolders;
                this.parentTree     = parentTree;

                this.folderEntry = folderEntry;

                this.ImageIndex         = 0;
                this.SelectedImageIndex = 0;
            }
Exemplo n.º 5
0
            public TreeNodeTri(TreeTraverser.FolderEntry folderEntry, ImageList imageList, HashSet<string> ignoredFiles, HashSet<string> ignoredFolders, TreeView parentTree, CheckedState defaultState=CheckedState.Checked)
                    : base(folderEntry.Name) {

                this.imageList = imageList;
                if (ignoredFolders.Contains(folderEntry.FullPath)) {
                    this.State = CheckedState.Unchecked;
                    // No children yet to update
                }
                else
                    this.State = defaultState;
                this.StateImageIndex = (int)this.State;

                this.ignoredFiles = ignoredFiles;
                this.ignoredFolders = ignoredFolders;
                this.parentTree = parentTree;

                this.folderEntry = folderEntry;

                this.ImageIndex = 0;
                this.SelectedImageIndex = 0;
            }