Exemple #1
0
        public IList <IFileSystemStructureLinkInfo> GetLinks(DirectoryLink directory, FileSystem.ListingOptions options)
        {
            lock (Client)
            {
                string text;
                try
                {
                    text = Client.DownloadString(PathHelper.Combine(_address, directory.FullName, _directoryInfoFileName));
                }
                catch (System.Net.WebException e) when((e.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.NotFound)
                {
                    return(null);
                }

                if (!string.IsNullOrEmpty(text))
                {
                    return(ParseDirectoryInfo(directory.FullName, text).ToList());
                }
            }

            return(null);
        }
        public IList <IFileSystemStructureLinkInfo> GetLinks(DirectoryLink directory, FileSystem.ListingOptions options)
        {
            var items = new List <IFileSystemStructureLinkInfo>();

            lock (Client)
            {
                foreach (var line in Client.GetListing(directory.FullName, FtpListOption.SizeModify))
                {
                    if (line.Type == FtpFileSystemObjectType.Link)// || IgnoredFiles.Contains(line.Name))
                    {
                        continue;
                    }

                    var item = GetInfo(PathHelper.Combine(directory.FullName, line.Name), line);
                    items.Add(item);
                }
            }

            return(items);
        }
        public IList <IFileSystemStructureLinkInfo> GetLinks(DirectoryLink directory, FileSystem.ListingOptions options)
        {
            var directoryName = GetDirectoryCorrectName(directory.FullName);

            lock (File)
            {
                return(File.Cast <ZipEntry>()
                       .Where(x => x.Name != directoryName && x.Name.StartsWith(directoryName))
                       .Select(x => GetInfo(x.Name, x))
                       .Cast <IFileSystemStructureLinkInfo>()
                       .ToList());
            }
        }