Exemple #1
0
 /// <summary>
 /// Searches for a backup node by its source path
 /// </summary>
 /// <param name="path">
 /// The original source path of the backup node
 /// </param>
 /// <returns>
 /// The requested backup node if found
 /// Null otherwise
 /// </returns>
 public Backup.Node LookupNode(IO.Path path)
 {
     if (path.IsEmpty)
        throw new ArgumentException("path");
     var node = this.Roots.FirstOrDefault(
        r => new IO.Path(r.Name).IsAncestor(path)
     );
     if (node != null)
     {
        var rootPath = (IO.Path)node.Name;
        foreach (var pathElem in path.Skip(rootPath.Count()))
        {
       node = GetChildren(node).FirstOrDefault(n => n.NameEquals(pathElem));
       if (node == null)
          break;
        }
     }
     return node;
 }