コード例 #1
0
        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");
            }
        }
コード例 #2
0
 public FullPath(RootVolume root, IDirectory dir, string hashedTarget) : this(root, dir.FullName, hashedTarget, true)
 {
     Directory = dir ?? throw new ArgumentNullException("dir", "IDirectory cannot be null");
 }
コード例 #3
0
 public FullPath(RootVolume root, IFile file, string hashedTarget) : this(root, file.FullName, hashedTarget, false)
 {
     File = file ?? throw new ArgumentNullException("file", "IFile cannot be null");
 }