public FullPath(RootVolume root, string path, string hashedTarget, bool isDirectory) { RootVolume = root ?? throw new ArgumentNullException("root", "RootVolume cannot be null"); HashedTarget = hashedTarget; IsDirectory = isDirectory; if (path.StartsWith(root.RootDirectory)) { if (path.Length == root.RootDirectory.Length) { RelativePath = string.Empty; } else { RelativePath = path.Substring(root.RootDirectory.Length + 1); } } else { throw new InvalidOperationException("path must be in the root directory or a subdirectory thereof"); } }
public FullPath(RootVolume root, IDirectory dir, string hashedTarget) : this(root, dir.FullName, hashedTarget, true) { Directory = dir ?? throw new ArgumentNullException("dir", "IDirectory cannot be null"); }
public FullPath(RootVolume root, IFile file, string hashedTarget) : this(root, file.FullName, hashedTarget, false) { File = file ?? throw new ArgumentNullException("file", "IFile cannot be null"); }