コード例 #1
0
ファイル: DotNetFileSystem.cs プロジェクト: mutac/FtpServer
 /// <inheritdoc/>
 public Task<IUnixFileSystemEntry> GetEntryByNameAsync(IUnixDirectoryEntry directoryEntry, string name, CancellationToken cancellationToken)
 {
     var searchDirInfo = ((DotNetDirectoryEntry)directoryEntry).Info;
     var fullPath = Path.Combine(searchDirInfo.FullName, name);
     IUnixFileSystemEntry result;
     if (File.Exists(fullPath))
         result = new DotNetFileEntry(this, new FileInfo(fullPath));
     else if (Directory.Exists(fullPath))
         result = new DotNetDirectoryEntry(this, new DirectoryInfo(fullPath), false);
     else
         result = null;
     return Task.FromResult(result);
 }
コード例 #2
0
        /// <inheritdoc/>
        public Task <IUnixFileSystemEntry> GetEntryByNameAsync(IUnixDirectoryEntry directoryEntry, string name, CancellationToken cancellationToken)
        {
            var searchDirInfo = ((DotNetDirectoryEntry)directoryEntry).Info;
            var fullPath      = Path.Combine(searchDirInfo.FullName, name);
            IUnixFileSystemEntry result;

            if (File.Exists(fullPath))
            {
                result = new DotNetFileEntry(this, new FileInfo(fullPath));
            }
            else if (Directory.Exists(fullPath))
            {
                result = new DotNetDirectoryEntry(this, new DirectoryInfo(fullPath), false);
            }
            else
            {
                result = null;
            }
            return(Task.FromResult(result));
        }