コード例 #1
0
        Directory GetRootDirectory(PathName name)
        {
            string root = Path.GetPathRoot(name.GetAbsolutePath());

            var di = new DirectoryInfo(root);

            return new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName));
        }
コード例 #2
0
        public static FileName GetFileName(PathName pathName)
        {
            if (pathName is RelativePathName)
                return new RelativeFileName(((RelativePathName)pathName));

            if (pathName is AbsolutePathName)
                return new AbsoluteFileName(((AbsolutePathName)pathName));

            throw new InvalidOperationException("Unable to convert path: " + pathName);
        }
コード例 #3
0
        File ResolveFile(PathName name)
        {
            Directory rootDirectory = GetRootDirectory(name);

            string relativePath = name.GetAbsolutePath().Substring(rootDirectory.Name.GetPath().Length);

            string[] names = relativePath.Split('\\', '/');

            return ResolveFile(rootDirectory, names);
        }
コード例 #4
0
 public abstract PathName Combine(PathName child);
コード例 #5
0
 public abstract DirectoryName Combine(PathName child);
コード例 #6
0
 public static DirectoryName GetDirectoryName(PathName pathName)
 {
     return GetDirectoryName(pathName.GetPath());
 }