コード例 #1
0
        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);
        }
コード例 #2
0
        internal static IUnixDirectoryEntry ToFolder(this IFolder folder, VirtualFileSystem sys, VirtualDirectory dir)
        {
            var vdir = new VirtualDirectory(sys, dir);

            vdir.Name = folder.Name;
            return(vdir);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public VirtualFile(VirtualFileSystem sys,
                    VirtualDirectory dir = null) : base(sys, dir)
 {
 }
コード例 #5
0
 IReadOnlyList <IUnixFileSystemEntry> GetEntries(
     VirtualDirectory folder, VfsFolder model)
 => model.Folders.OfType <IEntry>().Concat(model.Files)
 .Select(v => v.ToEntry(this, folder))
 .ToList().AsReadOnly();
コード例 #6
0
 public VirtualFileSystem(VirtualFsFactory parent, string userId)
 {
     Parent = parent;
     UserId = userId;
     Root   = new VirtualDirectory(this);
 }