public static IConfigurationBuilder AddYamlFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("InvalidFilePath", nameof(path));
            }

            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path = Path.GetFileName(path);
            }
            var source = new YamlConfigurationSource
            {
                FileProvider = provider,
                Path = path,
                Optional = optional,
                ReloadOnChange = reloadOnChange
            };
            builder.Add(source);
            return builder;
        }
 public RSS20ContentProvider(IFileProvider fileProvider, Func<IEnumerable<Dictionary<string, string>>> getContentData, string feedTitle, string feedDescription, string feedLink)
     : base(fileProvider, getContentData)
 {
     this._feedTitle = feedTitle;
     this._feedDescription = feedDescription;
     this._feedLink = feedLink;
 }
 public PluginCompositeFileProvider(IPluginManager pluginManager, IFileProvider defaultFileProvider, string subfolder=null)
 {
     var pluginsFileProviders = new List<IFileProvider>(pluginManager.LoadedPlugins.Count()+1);
     pluginsFileProviders.Add(defaultFileProvider);
     pluginsFileProviders.AddRange(GetPluginFileProviders(pluginManager, subfolder));
     _fileProvider = new CompositeFileProvider(pluginsFileProviders);
 }
 public VirtualPathRazorPageFactory(string rootDirectory, IExecutionContext executionContext, Type basePageType)
 {
     _rootDirectory = rootDirectory;
     _fileProvider = new PhysicalFileProvider(rootDirectory);
     _razorcompilationService = new RazorCompilationService(executionContext, basePageType);
     _executionContext = executionContext;
 }
 public bool TryResolveHandler(IFileProvider fileProvider, string subpath, out IDocumentHandler handler)
 {
     handler = GetHandlers(fileProvider, subpath)
         .Where(x => x.CanHandleRequest)
         .FirstOrDefault();
     return handler != null;
 }
 public BaseDocumentHandler(IFileProvider fileProvider, string subpath)
 {
     FileInfo = AcceptedExtensions
         .Select(x => fileProvider.GetFileInfo(subpath + x))
         .Where(x => x.Exists)
         .FirstOrDefault();
 }
Beispiel #7
0
 // Internal for unit testing
 internal DefaultChunkTreeCache(
     IFileProvider fileProvider,
     MemoryCacheOptions options)
 {
     _fileProvider = fileProvider;
     _chunkTreeCache = new MemoryCache(options);
 }
 /// <summary>
 /// Constructs an instance of the <see cref="CssDataUriTransform"/> class with a custom set of exclusions
 /// </summary>
 /// <param name="fileProvider">A wrapper for access to the file system</param>
 /// <param name="exclusions">The exclusions to apply to matches</param>
 public CssDataUriTransform(IFileProvider fileProvider, params IExclude[] exclusions) : this(fileProvider)
 {
     foreach (var exclusion in exclusions)
     {
         _exclusions.Add(exclusion);
     }
 }
 public Properties(IFileProvider fileProvider, string filename)
 {
     _list = new Dictionary<String, object>();
     _fileProvider = fileProvider;
     _filename = filename;
     LoadFromFile(_filename,"");
 }
 public ResourceDeployment(IFileProvider fileProvider, string path, string destination, IResourceTransform[] transforms)
 {
     this.FileProvider = fileProvider;
     this.ResourcePath = path;
     this.Destination = destination;
     this.Transforms = transforms;
 }
Beispiel #11
0
 public HomeworkController(IFileProvider fileProvider, IStudentHomeworkProvider studentHWProvider, IModuleProvider moduleProvider, IHomeworkProvider homeworkProvider)
 {
     _moduleProvider = moduleProvider;
     _homeworkProvider = homeworkProvider;
     _studentHWProvider = studentHWProvider;
     _fileProvider = fileProvider;
 }
 public TemplatingContext(string basePath, TemplateData data, IEnumerable<IAssetUriResolver> resolvers, IFileProvider fileProvider)
 {
     this.BasePath = basePath;
     this.TemplateData = data;
     this.AssetUriResolvers = resolvers.ToArray();
     this.FileProvider = fileProvider;
 }
        public FileProviderGlobbingDirectory(
            [NotNull] IFileProvider fileProvider,
            IFileInfo fileInfo,
            FileProviderGlobbingDirectory parent)
        {
            _fileProvider = fileProvider;
            _fileInfo = fileInfo;
            _parent = parent;

            if (_fileInfo == null)
            {
                // We're the root of the directory tree
                RelativePath = string.Empty;
                _isRoot = true;
            }
            else if (!string.IsNullOrEmpty(parent?.RelativePath))
            {
                // We have a parent and they have a relative path so concat that with my name
                RelativePath = _parent.RelativePath + DirectorySeparatorChar + _fileInfo.Name;
            }
            else
            {
                // We have a parent which is the root, so just use my name
                RelativePath = _fileInfo.Name;
            }
        }
 public FileEffectiveRights53EntityOperationEvaluator(
     FileEffectiveRightsObjectCollector objectCollector, IFileProvider fileProvider)
 {
     this.FileEffectiveRights53SystemDataSource = objectCollector;
     this.FileProvider = fileProvider;
     this.PathOperatorEvaluator = new PathOperatorEvaluator(fileProvider, FamilyEnumeration.windows);
 }
Beispiel #15
0
 public Template(IFileProvider fileProvider)
 {
     this._fileProvider = fileProvider;
     this._fileResolver = new FileResolver();
     this._resolvers = new List<IAssetUriResolver>();
     this._resolvers.Add(this._fileResolver);
     this._resolvers.Add(new MsdnResolver());
 }
Beispiel #16
0
 public BasePanelViewModel(IFileProvider fileProvider, IDirectory currentDirectory)
 {
     this.fileProvider = fileProvider;
     this.fileProvider.FileChangedEvent += FileProviderOnFileChangedEvent;
     this.currentDirectory = currentDirectory;
     openCommand = new OpenFileCommand(this);
     FillDirectoryFiles();
 }
 public OddrDeviceService(IFileProvider fileProvider, string pathToOddrProperties)
 {
     
     var properties = new Properties(fileProvider, pathToOddrProperties);
     _oddrService = new ODDRService(fileProvider);
     var defaultVocabularyIri = properties.GetProperty("oddr.vocabulary.device");
     _oddrService.Initialize(defaultVocabularyIri, properties);
 }
 // TODO we can eliminate the TemplateResolver here once we remove it as a requirement for the Template class
 public TemplateInfo(IFileProvider source, string path, string name, TemplateParameterInfo[] parameters, TemplateInfo inheritedTemplate)
 {
     this.Source = source;
     this.Name = name;
     this.Parameters = parameters;
     this.Path = path;
     this.Inherits = inheritedTemplate;
 }
        public PhysicalAppDataFolder(IAppDataFolderRoot root,
            ILoggerFactory loggerFactory)
        {
            _fileProvider = new PhysicalFileProvider(root.RootFolder);
            _logger = loggerFactory.CreateLogger<PhysicalAppDataFolder>();

            T = NullLocalizer.Instance;
        }
 public RazorCompilationService(ICompilationService compilationService,
                                IMvcRazorHost razorHost,
                                IOptions<RazorViewEngineOptions> viewEngineOptions)
 {
     _compilationService = compilationService;
     _razorHost = razorHost;
     _fileProvider = viewEngineOptions.Options.FileProvider;
 }
 public AtomContentProvider(IFileProvider fileProvider, Func<IEnumerable<Dictionary<string, string>>> getContentData, string feedTitle, string feedLink, string feedAuthor, string feedId)
     : base(fileProvider, getContentData)
 {
     this._feedTitle = feedTitle;
     this._feedAuthor = feedAuthor;
     this._feedLink = feedLink;
     this._feedId = feedId;
 }
 public DirectoryHandler(IFileProvider fileProvider, string path, DirectoryOptions options)
 {
     _fileProvider = fileProvider;
     _path = path;
     _extensionsOptionsRegex = new Regex(String.Join("|", options.DirectoryBrowsingStripExtensions.Select(i => String.Concat(i.FirstOrDefault() == '.' ? @"\" : "", i, @"$"))));
     _directoryOptions = options;
     CanHandleRequest = _fileProvider.GetDirectoryContents(_path).Exists;
 }
        public FileSystemPublishedContentCache(IApplicationEnvironment appEnv)
        {
            if (appEnv == null) throw new ArgumentNullException(nameof(appEnv));
            _appEnv = appEnv;
            _fileProvider = new PhysicalFileProvider(appEnv.ApplicationBasePath);

            _fileCache = new Lazy<IDictionary<Guid, Tuple<IPublishedContent, IFileInfo>>>(() => FindAllContent("UmbracoContent"));
        }
Beispiel #24
0
 internal void ResolveFileProvider(IHostingEnvironment hostingEnv)
 {
     if (this.FileProvider != null)
         return;
     this.FileProvider = hostingEnv.WebRootFileProvider;
     if (this.FileProvider == null)
         throw new InvalidOperationException("Missing FileProvider.");
 }
 public PluginAssemblyProvider(IFileProvider fileProvider, ILoggerFactory loggerFactory,
     IAssemblyLoadContextAccessor loadContextAccessor, IAssemblyLoaderContainer assemblyLoaderContainer)
 {
     _logger = loggerFactory.CreateLogger<PluginAssemblyProvider>();
     _fileProvider = fileProvider;
     _loadContextAccessor = loadContextAccessor;
     _assemblyLoaderContainer = assemblyLoaderContainer;
     _candidates = new Lazy<IEnumerable<Assembly>>(FindPluginAssemblies);
 }
Beispiel #26
0
 /// <summary>
 /// Creates a new instance of <see cref="FileVersionProvider"/>.
 /// </summary>
 /// <param name="fileProvider">The file provider to get and watch files.</param>
 /// <param name="applicationName">Name of the application.</param>
 /// <param name="cache"><see cref="IMemoryCache"/> where versioned urls of files are cached.</param>
 public FileVersionProvider(
     [NotNull] IFileProvider fileProvider,
     [NotNull] IMemoryCache cache,
     [NotNull] PathString requestPathBase)
 {
     _fileProvider = fileProvider;
     _cache = cache;
     _requestPathBase = requestPathBase;
 }
 public SpwReaderPlugin(IObjectModifier modifier, IObjectsRepository repository, IPersonalSettings personalSettings, IFileProvider fileProvider)
 {
     _objectModifier = modifier;
     _objectsRepository = repository;
     _pilotTypes = _objectsRepository.GetTypes();
     _loader = new ObjectLoader(repository);
     _dataObjects = new List<IDataObject>();
     _fileProvider = fileProvider;
 }
 /// <summary>
 /// Constructs an instance of the <see cref="FileSizeExclusion"/> class
 /// </summary>
 /// <param name="fileProvider">A wrapper for access to the file system</param>
 /// <param name="maxFileSize">The maximumfile size in bytes</param>
 public FileSizeExclusion(IFileProvider fileProvider, int maxFileSize)
 {
     if (null == fileProvider)
     {
         throw new ArgumentNullException("fileProvider");
     }
     _fileProvider = fileProvider;
     _maxFileSize = maxFileSize;
 }
Beispiel #29
0
 public Resource(string conditional, XPathVariable[] variables,  IFileProvider fileProvider, string source, string output, ResourceTransform[] transformers)
 {
     this.ConditionExpression = conditional;
     this.FileProvider = fileProvider;
     this.Source = source;
     this.Output = output;
     this.Variables = variables;
     this.Transforms = transformers;
 }
        public IFileProvider GetFileProvider(string path)
        {
            IEnumerable<IFileProvider> fileProviders = new IFileProvider[] { new PhysicalFileProvider(path) };

              return new CompositeFileProvider(
            fileProviders.Concat(
              new Assembly[] { Assembly.Load(new AssemblyName("AspNet5Resources.Resources")) }.Select(a => new EmbeddedFileProvider(a, a.GetName().Name))
            )
              );
        }
Beispiel #31
0
        public MainViewModel(IDataObject obj, IObjectsRepository objectsRepository, FileModifier fileModifier, IFileProvider fileProvider, ITabServiceProvider tabServiceProvider)
        {
            _obj                = obj;
            _fileProvider       = fileProvider;
            _objectsRepository  = objectsRepository;
            _tabServiceProvider = tabServiceProvider;

            AttributesVm = new AttributesViewModel(_obj);
            TypeVm       = new TypeViewModel(_obj.Type);
            CreatorVm    = new CreatorViewModel(_obj.Creator);
            FilesVm      = new FilesViewModel(obj.Id, _obj.Files, _fileProvider, fileModifier);
            SnapshotsVm  = new SnapshotsViewModel(_obj.Id, _obj.PreviousFileSnapshots, _fileProvider);

            AccessVm     = new AccessViewModel(_obj.Access2);
            RelationsVm  = new RelationsViewModel(obj.Relations, _objectsRepository, _fileProvider, _tabServiceProvider, fileModifier);
            StateInfoVm  = new StateInfoViewModel(obj.ObjectStateInfo);
            ChildrenVm   = new ChildrenViewModel(obj.Children, _objectsRepository, _fileProvider, _tabServiceProvider, fileModifier);
            PeopleVm     = new PeopleViewModel(_objectsRepository.GetPeople());
            OrgUnitsVm   = new OrgUnitsViewModel(_objectsRepository.GetOrganisationUnits());
            TypesVm      = new TypesViewModel(_objectsRepository.GetTypes());
            UserStatesVm = new UserStatesViewModel(_objectsRepository.GetUserStates());

            _objectsRepository.GetOrganisationUnits();
        }
 public IsSpaViewFilter(IFileProvider fileProvider)
 {
     _fileProvider = fileProvider ?? throw new ArgumentNullException(nameof(fileProvider));
 }
 public CustomChecker(IFileProvider fileProvider)
 {
     FileProvider = fileProvider;
 }
Beispiel #34
0
 public UploadController(IFileProvider fileProvider)
 {
     this.fileProvider = fileProvider;
 }
Beispiel #35
0
 public ContentManager(IServiceProvider services, IFileProvider fileProvider)
 {
     Services     = services;
     FileProvider = fileProvider;
 }
Beispiel #36
0
 /// <summary>
 /// Chains another file provider to this tenants file system, so that the tenant can access those additional files (Read and Copy on Write access)
 /// </summary>
 /// <param name="chainedFileProvider"></param>
 /// <returns></returns>
 public TenantFileSystemBuilderContext <TTenant> AllowAccessTo(IFileProvider chainedFileProvider)
 {
     _parentFileProvider = chainedFileProvider;
     return(this);
 }
Beispiel #37
0
 public ProductController(IProductService productService, ISubCategoryService subCategoryService, ICategoryservice categoryService, IBrandService brandService, ICityService cityService, IFileProvider fileProvider, IHostingEnvironment env, IHostingEnvironment hostingEnvironment)
 {
     _productService     = productService;
     _brandService       = brandService;
     _categoryService    = categoryService;
     _subCategoryService = subCategoryService;
     _cityService        = cityService;
     _fileProvider       = fileProvider;
     _env = env;
     _hostingEnvironment = hostingEnvironment;
 }
Beispiel #38
0
        public RazorViewCompiler(
            IFileProvider fileProvider,
            RazorTemplateEngine templateEngine,
            CSharpCompiler csharpCompiler,
            Action <RoslynCompilationContext> compilationCallback,
            IList <CompiledViewDescriptor> precompiledViews,
            ILogger logger)
        {
            if (fileProvider == null)
            {
                throw new ArgumentNullException(nameof(fileProvider));
            }

            if (templateEngine == null)
            {
                throw new ArgumentNullException(nameof(templateEngine));
            }

            if (csharpCompiler == null)
            {
                throw new ArgumentNullException(nameof(csharpCompiler));
            }

            if (compilationCallback == null)
            {
                throw new ArgumentNullException(nameof(compilationCallback));
            }

            if (precompiledViews == null)
            {
                throw new ArgumentNullException(nameof(precompiledViews));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _fileProvider        = fileProvider;
            _templateEngine      = templateEngine;
            _csharpCompiler      = csharpCompiler;
            _compilationCallback = compilationCallback;
            _logger = logger;

            _normalizedPathLookup = new ConcurrentDictionary <string, string>(StringComparer.Ordinal);
            _cache = new MemoryCache(new MemoryCacheOptions());

            _precompiledViewLookup = new Dictionary <string, Task <CompiledViewDescriptor> >(
                precompiledViews.Count,
                StringComparer.OrdinalIgnoreCase);

            foreach (var precompiledView in precompiledViews)
            {
                if (_precompiledViewLookup.TryGetValue(precompiledView.RelativePath, out var otherValue))
                {
                    var message = string.Join(
                        Environment.NewLine,
                        Resources.RazorViewCompiler_ViewPathsDifferOnlyInCase,
                        otherValue.Result.RelativePath,
                        precompiledView.RelativePath);
                    throw new InvalidOperationException(message);
                }

                _precompiledViewLookup.Add(precompiledView.RelativePath, Task.FromResult(precompiledView));
            }
        }
 public IndexModel(IFileProvider fileProvider)
 {
     _fileProvider = fileProvider;
 }
        public static IConfigurationBuilder AddYamlFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("InvalidFilePath", nameof(path));
            }

            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }
            var source = new YamlConfigurationSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            return(builder);
        }
 public VirtualDirectoriesController(IFileProvider fileProvider)
 {
     _fileProvider = fileProvider;
 }
Beispiel #42
0
 public Download(IFoo foo, IFileProvider fileProvider)
 {
     _foo          = foo;
     _fileProvider = fileProvider;
 }
 public ConsoleModel(IFileProvider files, IMarkdownService md)
 {
     _files = files;
     _md    = md;
 }
 public HomeController(IFileProvider fileProvider)
 {
     _fileProvider = fileProvider;
 }
Beispiel #45
0
 public ReadService(IConfiguration configuration, ILogger <ReadService> logger, IHostingEnvironment hostingEnvironment, IMemoryCache memoryCache, IFileProvider fileProvider)
 {
     _configuration      = configuration;
     _hostingEnvironment = hostingEnvironment;
     _logger             = logger;
     _memoryCache        = memoryCache;
     _fileProvider       = fileProvider;
 }
        public static IConfigurationBuilder AddCPlatformFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            Check.NotNull(builder, "builder");
            Check.CheckCondition(() => string.IsNullOrEmpty(path), "path");
            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }
            var source = new CPlatformConfigurationSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            AppConfig.Configuration = builder.Build();
            AppConfig.ServerOptions = AppConfig.Configuration.Get <SurgingServerOptions>();
            return(builder);
        }
Beispiel #47
0
        /// <summary>
        /// Adds the YAML configuration provider at <paramref name="path"/> to <paramref name="builder"/>
        /// </summary>
        /// <param name="builder">The <see cref="IConfigurationBuilder"/> to add</param>
        /// <param name="provider">The <see cref="IFileProvider"/> to add</param>
        /// <param name="path">relative path</param>
        /// <param name="optional">file is optional</param>
        /// <param name="reloadOnChange">reload the settings on change</param>
        /// <returns>The <see cref="IConfigurationBuilder"/></returns>
        public static IConfigurationBuilder AddYamlFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("File path must be a non-empty string.", nameof(path));
            }

            return(builder.AddYamlFile(s =>
            {
                s.FileProvider = provider;
                s.Path = path;
                s.Optional = optional;
                s.ReloadOnChange = reloadOnChange;
            }));
        }
 public RandomWordResolver(IFileProvider fileProvider)
 {
     this.fileProvider = fileProvider;
 }
        public static IConfigurationBuilder AddPhoneNumbersFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }
            var source = new PhoneNumbersSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            return(builder);
        }
        /// <summary>
        /// Adds a JSON configuration source to <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
        /// <param name="provider">The <see cref="IFileProvider"/> to use to access the file.</param>
        /// <param name="path">Path relative to the base path stored in
        /// <see cref="IConfigurationBuilder.Properties"/> of <paramref name="builder"/>.</param>
        /// <param name="optional">Whether the file is optional.</param>
        /// <param name="reloadOnChange">Whether the configuration should be reloaded if the file changes.</param>
        /// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
        public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, IFileProvider provider, string path, bool optional, bool reloadOnChange)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException(Resources.Error_InvalidFilePath, nameof(path));
            }

            return(builder.AddJsonFile(s =>
            {
                s.FileProvider = provider;
                s.Path = path;
                s.Optional = optional;
                s.ReloadOnChange = reloadOnChange;
                s.ResolveFileProvider();
            }));
        }
 /// <summary>
 /// Create source to file in a file provider.
 /// </summary>
 /// <param name="fileProvider"></param>
 /// <param name="filepath"></param>
 /// <param name="throwIfNotFound"></param>
 public FileProviderSource(IFileProvider fileProvider, string filepath, bool throwIfNotFound)
 {
     this.FilePath        = filepath ?? throw new ArgumentNullException(nameof(filepath));
     this.FileProvider    = fileProvider ?? throw new ArgumentNullException(nameof(fileProvider));
     this.ThrowIfNotFound = throwIfNotFound;
 }
Beispiel #52
0
 public SetupProvider(IFileProvider fileProvider, SetupSettings setupSettings)
 {
     _fileProvider  = fileProvider;
     _setupSettings = setupSettings;
 }
 public IScriptingScope CreateScope(IEnumerable <GlobalMethod> methods, IServiceProvider serviceProvider, IFileProvider fileProvider, string basePath)
 {
     return(new FilesScriptScope(fileProvider, basePath));
 }
 protected RecordFSReaderBase(string rootPath, IFileProvider fileProvider) : base(rootPath, fileProvider)
 {
     PagingProvider = new PagingProvider <TId>(Path.Join(RootPath, "pages"), FileProvider);
 }
 /// <summary>
 /// Create abstract file source.
 /// </summary>
 /// <param name="fileProvider"></param>
 /// <param name="path"></param>
 /// <param name="filePattern"></param>
 public FileProviderPatternSource(IFileProvider fileProvider, string path, ILinePattern filePattern)
 {
     this.FileProvider = fileProvider ?? throw new ArgumentNullException(nameof(fileProvider));
     this.Path         = path ?? throw new ArgumentNullException(nameof(path));
     this.FilePattern  = filePattern ?? throw new ArgumentNullException(nameof(FilePattern));
 }
Beispiel #56
0
 public static void Add(this ICollection <FileMapping> mappings, PathString matchUrl, IFileProvider fileProvider)
 {
     mappings.Add(new FileMapping(matchUrl, fileProvider));
 }
Beispiel #57
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="FileSource"/> class.
 /// </summary>
 /// <param name="path"> The path representing the source. </param>
 public FileSource(string path)
 {
     this.provider = GetProvider(path);
     this.path     = path;
 }
 public Cas30ServiceTicketValidationTest(CasFixture fixture)
 {
     _options = fixture.Options;
     _service = fixture.Service;
     _files   = fixture.FileProvider;
 }
Beispiel #59
0
 public HomeController(ILogger <HomeController> logger, IFileProvider fileprovider, IWebHostEnvironment env)
 {
     _logger            = logger;
     fileProvider       = fileprovider;
     hostingEnvironment = env;
 }
        public static IApplicationBuilder UsePasswordlessLoginAPI(this IApplicationBuilder app, IFileProvider webRootFileProvider)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (webRootFileProvider == null)
            {
                throw new ArgumentNullException(nameof(webRootFileProvider));
            }

            var compositeFileProvider = new CompositeFileProvider(
                new EmbeddedFileProvider(typeof(PasswordlessLoginAPIApplicationBuilderExtensions).GetTypeInfo().Assembly, "SimpleIAM.PasswordlessLogin.API.wwwroot"),
                webRootFileProvider
                );

            #pragma warning disable IDE0059 // webRootFileProvider DOES need to be reasigned (?)
            webRootFileProvider = compositeFileProvider;
            #pragma warning restore IDE0059

            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = compositeFileProvider
            });

            app.UseRouting(); // Must come after UseStaticFiles

            app.UseCors();

            return(app);
        }