コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 public FileServerOptions()
     : base(new SharedOptions())
 {
     StaticFileOptions       = new StaticFileOptions(SharedOptions);
     DirectoryBrowserOptions = new DirectoryBrowserOptions(SharedOptions);
     DefaultFilesOptions     = new DefaultFilesOptions(SharedOptions);
 }
コード例 #2
0
        public DirectoryBrowserMiddleware(AppFunc next, DirectoryBrowserOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException("next");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _options  = options;
            _matchUrl = options.RequestPath + "/";
            _next     = next;
        }
コード例 #3
0
        /// <summary>
        /// Creates a new instance of the SendFileMiddleware.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The configuration for this middleware.</param>
        public DirectoryBrowserMiddleware(AppFunc next, DirectoryBrowserOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException("next");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (options.Formatter == null)
            {
                throw new ArgumentException(Resources.Args_NoFormatter);
            }
            if (options.FileSystem == null)
            {
                options.FileSystem = new PhysicalFileSystem("." + options.RequestPath.Value);
            }

            _next     = next;
            _options  = options;
            _matchUrl = options.RequestPath;
        }
コード例 #4
0
 /// <summary>
 /// Specifies component that examines a request and selects a directory view formatter.
 /// </summary>
 /// <param name="formatSelector"></param>
 /// <returns>this</returns>
 public FileServerOptions WithFormatSelector(IDirectoryFormatSelector formatSelector)
 {
     DirectoryBrowserOptions.WithFormatSelector(formatSelector);
     return(this);
 }