/// <summary> /// Initializes a new instance of the <see cref="InMemoryFileSystem"/> class. /// </summary> /// <param name="mountPoint">The mount point where this file system should be included</param> /// <param name="pathTraversalEngine">The engine to traverse paths</param> /// <param name="systemClock">Interface for the access to the systems clock</param> /// <param name="lockManager">The global lock manager</param> /// <param name="propertyStoreFactory">The store for dead properties</param> public InMemoryFileSystem( ICollection mountPoint, IPathTraversalEngine pathTraversalEngine, ISystemClock systemClock, ILockManager lockManager = null, IPropertyStoreFactory propertyStoreFactory = null) { SystemClock = systemClock; LockManager = lockManager; _pathTraversalEngine = pathTraversalEngine; var rootPath = mountPoint?.Path ?? new Uri(string.Empty, UriKind.Relative); RootCollection = new InMemoryDirectory(this, mountPoint, rootPath, mountPoint?.Name ?? rootPath.GetName(), true); Root = new AsyncLazy <ICollection>(() => Task.FromResult <ICollection>(RootCollection)); PropertyStore = propertyStoreFactory?.Create(this); }
/// <summary> /// Initializes a new instance of the <see cref="DotNetFileSystem"/> class. /// </summary> /// <param name="options">The options for this file system</param> /// <param name="mountPoint">The mount point where this file system should be included</param> /// <param name="rootFolder">The root folder</param> /// <param name="pathTraversalEngine">The engine to traverse paths</param> /// <param name="lockManager">The global lock manager</param> /// <param name="propertyStoreFactory">The store for dead properties</param> public DotNetFileSystem( [NotNull] DotNetFileSystemOptions options, [CanBeNull] ICollection mountPoint, [NotNull] string rootFolder, [NotNull] IPathTraversalEngine pathTraversalEngine, ILockManager lockManager = null, IPropertyStoreFactory propertyStoreFactory = null) { LockManager = lockManager; RootDirectoryPath = rootFolder; _pathTraversalEngine = pathTraversalEngine; Options = options; PropertyStore = propertyStoreFactory?.Create(this); var rootPath = mountPoint?.Path ?? new Uri(string.Empty, UriKind.Relative); var rootDir = new DotNetDirectory(this, mountPoint, new DirectoryInfo(rootFolder), rootPath, mountPoint?.Name ?? rootPath.GetName(), true); Root = new AsyncLazy <ICollection>(() => Task.FromResult <ICollection>(rootDir)); }
/// <summary> /// Initializes a new instance of the <see cref="SQLiteFileSystem"/> class. /// </summary> /// <param name="options">The options for this file system</param> /// <param name="mountPoint">The mount point where this file system should be included</param> /// <param name="connection">The SQLite database connection</param> /// <param name="pathTraversalEngine">The engine to traverse paths</param> /// <param name="lockManager">The global lock manager</param> /// <param name="propertyStoreFactory">The store for dead properties</param> public SQLiteFileSystem( [NotNull] SQLiteFileSystemOptions options, [CanBeNull] ICollection mountPoint, [NotNull] db::SQLiteConnection connection, [NotNull] IPathTraversalEngine pathTraversalEngine, [CanBeNull] ILockManager lockManager = null, [CanBeNull] IPropertyStoreFactory propertyStoreFactory = null) { RootDirectoryPath = Path.GetDirectoryName(connection.DatabasePath); LockManager = lockManager; _connection = connection; _pathTraversalEngine = pathTraversalEngine; Options = options; PropertyStore = propertyStoreFactory?.Create(this); var rootEntry = connection.Table <FileEntry>().Where(x => x.Id == string.Empty).ToList().Single(); var rootPath = mountPoint?.Path ?? new Uri(string.Empty, UriKind.Relative); var rootDir = new SQLiteCollection(this, mountPoint, rootEntry, rootPath, mountPoint?.Name ?? rootPath.GetName(), true); Root = new AsyncLazy <ICollection>(() => Task.FromResult <ICollection>(rootDir)); }