コード例 #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);
 }