Exemplo n.º 1
0
        /// <summary>
        /// Returns the target if the collection is a mount point or the collection itself
        /// </summary>
        /// <param name="collection">The collection to found the mount destination for</param>
        /// <param name="mountPointProvider">The mount point provider</param>
        /// <returns>The <paramref name="collection"/> or the destination collection if a mount point existed</returns>
        public static async Task <IEntry> GetMountTargetEntryAsync(this ICollection collection, IMountPointProvider mountPointProvider)
        {
            IFileSystem fileSystem;

            if (mountPointProvider != null && mountPointProvider.TryGetMountPoint(collection.Path, out fileSystem))
            {
                return(await fileSystem.Root);
            }
            return(collection);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the target if the collection is a mount point or the collection itself
        /// </summary>
        /// <param name="collection">The collection to found the mount destination for</param>
        /// <param name="mountPointProvider">The mount point provider</param>
        /// <returns>The <paramref name="collection"/> or the destination collection if a mount point existed</returns>
        public static async Task <ICollection> GetMountTargetAsync([NotNull] this ICollection collection, [CanBeNull] IMountPointProvider mountPointProvider)
        {
            IFileSystem fileSystem;

            if (mountPointProvider != null && mountPointProvider.TryGetMountPoint(collection.Path, out fileSystem))
            {
                return(await fileSystem.Root);
            }
            return(collection);
        }