protected override void Access(String Path, out FileSystem NewFileSystem, out String NewPath) { if (!AllowAccessingParent) { Path = AbsoluteNormalizePath(Path); } base.Access(CombinePath(AccessPath, Path), out NewFileSystem, out NewPath); }
public void Mount(String Path, FileSystem FileSystemToMount, String FileSystemToMountPath = "/") { String FinalPath = AbsoluteNormalizePath(Path, CurrentWorkingPath); MountedFileSystems[FinalPath] = new MountStruct() { FileSystem = FileSystemToMount, Path = FileSystemToMountPath, }; }
protected virtual void Access(String Path, out FileSystem NewFileSystem, out String NewPath) { // Normalize Components Path = AbsoluteNormalizePath(Path, CurrentWorkingPath); var ComparePath = ComparablePath(Path); // Check MountedFileSystems. foreach (var Item in MountedFileSystems) { var CheckMountedPath = ComparablePath(Item.Key); var MountInfo = Item.Value; if ( ComparePath.StartsWith(CheckMountedPath) && ( (CheckMountedPath.Length == ComparePath.Length) || (ComparePath.Substring(CheckMountedPath.Length, 1) == "/") ) ) { var NewAccessPath = ComparePath.Substring(CheckMountedPath.Length); if (MountInfo.Path != "/") { NewAccessPath = MountInfo.Path + "/" + NewAccessPath; } // Use Mounted File System. MountInfo.FileSystem.Access(NewAccessPath, out NewFileSystem, out NewPath); return; } } NewFileSystem = this; NewPath = Path; }
public ProxyFileSystem(FileSystem ParentFileSystem) { this.ParentFileSystem = ParentFileSystem; }
public FileSystemFromPath(FileSystem ParentFileSystem, String AccessPath, bool AllowAccessingParent = false) : base(ParentFileSystem) { this.AccessPath = AccessPath; this.AllowAccessingParent = AllowAccessingParent; }