internal static IUnixFileSystemEntry ToEntry(this IEntry entry, VirtualFileSystem sys, VirtualDirectory dir) { var file = entry as IFile; if (file != null) { return(file.ToFile(sys, dir)); } var folder = entry as IFolder; if (folder != null) { return(folder.ToFolder(sys, dir)); } return(null); }
internal static IUnixDirectoryEntry ToFolder(this IFolder folder, VirtualFileSystem sys, VirtualDirectory dir) { var vdir = new VirtualDirectory(sys, dir); vdir.Name = folder.Name; return(vdir); }
internal static IUnixFileEntry ToFile(this IFile file, VirtualFileSystem sys, VirtualDirectory dir) { var vfile = new VirtualFile(sys, dir); vfile.Name = file.Name; vfile.Size = file.Size; return(vfile); }
public VirtualFile(VirtualFileSystem sys, VirtualDirectory dir = null) : base(sys, dir) { }
IReadOnlyList <IUnixFileSystemEntry> GetEntries( VirtualDirectory folder, VfsFolder model) => model.Folders.OfType <IEntry>().Concat(model.Files) .Select(v => v.ToEntry(this, folder)) .ToList().AsReadOnly();
public VirtualFileSystem(VirtualFsFactory parent, string userId) { Parent = parent; UserId = userId; Root = new VirtualDirectory(this); }