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); }
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); }
public void AddDirectoryToCatalog(IBackupDirectory directory) { Logger.LogDebug($"Adding Backup Directory {directory.FullName}"); Catalog.AddBackupDirectory(directory); }
public void AddBackupDirectory(IBackupDirectory directory) { BackupDirectories.Add(directory.FullName); }