private void enqueueDirectory(ListingInfo l, ListingOptions options)
        {
            if (options.ShouldFetch != null)
            {
                var args = new ShouldFetchEventArgs(new Link(l.Uri, l.Uri));
                options.ShouldFetch(this, args);
                if (args.Cancel)
                {
                    return;
                }
            }

            toVisit.Enqueue(l.Uri);
        }
        /// <summary>
        /// Creates a new ListingFile instance from a ListingInfo
        /// </summary>
        public static ListingFile Create(ListingInfo entity)
        {
            if (entity.IsDirectory)
            {
                throw new ArgumentException("Must be a file");
            }

            return(new ListingFile()
            {
                IsDirectory = false,
                Uri = entity.Uri,
                Parent = entity.Parent,
                FileName = entity.FileName,
                FileExtension = entity.FileExtension,
                FileSize = entity.FileSize,
                Size = entity.Size,
                LastModified = entity.LastModified,
            });
        }
Example #3
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ListingDirectory(ListingInfo entity)
 {
     Directories = new List <ListingDirectory>();
     Files       = new List <ListingFile>();
     Entity      = entity;
 }