示例#1
0
        public IEnumerable <SimpleDirectoryInfo> GetDirectories(string path)
        {
            FtpListItem[] result = null;

            if (!mCache.IsValid("L", path))
            {
                result = mClient.GetListing(path, FtpListOption.AllFiles);
                mCache.ClearAllChildren(path);
                mCache.Add("L", path, result);
            }
            else
            {
                result = (FtpListItem[])mCache.Get("L", path);
            }

            foreach (var entry in result)
            {
                if (entry.Type == FtpFileSystemObjectType.Directory)
                {
                    yield return(GetDirectoryInfoImpl(path, entry));
                }
            }
        }