internal IPath Create(string path, PlatformPathTypes platformPathType, PathTypes pathType, string[] components) { switch (platformPathType) { case PlatformPathTypes.Infer: return Create(path, InferPlatformPathType(path), pathType, components); case PlatformPathTypes.Windows: switch (pathType) { case PathTypes.Root: return new WinRootPath(this, platformPathType, pathType, path, components); case PathTypes.Directory: return new WinDirectoryPath(this, platformPathType, pathType, path, components); case PathTypes.File: return new WinFilePath(this, platformPathType, pathType, path, components); default: throw new ArgumentOutOfRangeException("pathType", pathType, null); } case PlatformPathTypes.Unix: switch (pathType) { case PathTypes.Root: return new UnixRootPath(this, platformPathType, pathType, path, components); case PathTypes.Directory: return new UnixDirectoryPath(this, platformPathType, pathType, path, components); case PathTypes.File: return new UnixFilePath(this, platformPathType, pathType, path, components); default: throw new ArgumentOutOfRangeException("pathType", pathType, null); } ; default: throw new ArgumentOutOfRangeException("platformPathType", platformPathType, null); } }
protected BasePath(PathFactory factory, PlatformPathTypes platformPathType, PathTypes pathType, string path, string[] components) { Factory = factory; PlatformPathType = platformPathType; PathType = pathType; Components = components; Path = path; }
public IPath Create(string path, PlatformPathTypes platformPathType) { switch (platformPathType) { case PlatformPathTypes.Infer: return Create(path, InferPlatformPathType(path)); default: // TODO manage UNC and URI { var components = path.Split('/', '\\'); var parts = _partFactory.MakeParts(path); components = PathUtility.CleanUp(components); return Create(path, platformPathType, InferPathType(path, components), components); } } }
protected WinPath(PathFactory factory, PlatformPathTypes platformPathType, PathTypes pathType, string path, string[] components) : base(factory, platformPathType, pathType, path, components) { var firstComponent = components.FirstOrDefault(); Drive = PathUtility.GetDrive(firstComponent); }
public UnixRootPath(PathFactory factory, PlatformPathTypes platformPathType, PathTypes pathType, string path, string[] components) { throw new NotImplementedException(); }
public UnixDirectoryPath(PathFactory factory, PlatformPathTypes platformPathType, PathTypes pathType, string path, string[] components) { }
public WinFilePath(PathFactory factory, PlatformPathTypes platformPathType, PathTypes pathType, string path, string[] components) : base(factory, platformPathType, pathType, path, components) { }