예제 #1
0
 private IEnumerable <string> Split(IBackupDirectory path)
 {
     if (path == null)
     {
         throw new ArgumentNullException("path");
     }
     if (path.Parent != null)
     {
         foreach (var d in Split(path.Parent))
         {
             yield return(d);
         }
     }
     yield return(path.Name);
 }
예제 #2
0
        private Branch GetTree(IBackupDirectory directory, Branch parentBranch)
        {
            foreach (var currentDirectory in directory.GetDirectories())
            {
                var newBranch = new Branch(currentDirectory.Name);
                parentBranch.Subtrees.Add(GetTree(currentDirectory, newBranch));
            }

            foreach (var file in directory.GetFiles())
            {
                var hash = Hasher.GetFileHash(file);
                parentBranch.Nodes.Add(new Node(file, hash));
            }

            return(parentBranch);
        }
예제 #3
0
 public void AddDirectoryToCatalog(IBackupDirectory directory)
 {
     Logger.LogDebug($"Adding Backup Directory {directory.FullName}");
     Catalog.AddBackupDirectory(directory);
 }
예제 #4
0
 public void AddBackupDirectory(IBackupDirectory directory)
 {
     BackupDirectories.Add(directory.FullName);
 }