public IFileProvider GetFileProvider(string path) { IEnumerable <IFileProvider> fileProviders = new IFileProvider[] { new PhysicalFileProvider(path) }; return(new CompositeFileProvider( fileProviders.Concat( Module.Managers.AssemblyManager.GetAssemblies.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) )); }
public IFileProvider GetFileProvider(IEnumerable <Assembly> assemblies, string path) { IEnumerable <IFileProvider> fileProviders = new IFileProvider[] { new PhysicalFileProvider(path) }; return(new Microsoft.Extensions.FileProviders.CompositeFileProvider( fileProviders.Concat( assemblies.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) )); }
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)) ) ); }
public IFileProvider GetFileProvider(string path) { IEnumerable <IFileProvider> fileProviders = new IFileProvider[] { new PhysicalFileProvider(path) }; return(new CompositeFileProvider( fileProviders.Concat( new Assembly[] { Assembly.Load(new AssemblyName("AspNet5Views.ViewsAsResources")) }.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) )); }
public IFileProvider GetFileProvider(IEnumerable<Assembly> assemblies, string path) { IEnumerable<IFileProvider> fileProviders = new IFileProvider[] { new PhysicalFileProvider(path) }; return new CompositeFileProvider( fileProviders.Concat( assemblies.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) ); }
public static IFileProvider ConcatComposite(this IFileProvider fileProvider, params IFileProvider[] fileProviders) { IEnumerable <IFileProvider>?existingFileProviders = fileProvider switch { CompositeFileProvider compositeFileProvider => compositeFileProvider.FileProviders, _ => new[] { fileProvider }, }; return(new CompositeFileProvider(existingFileProviders.Concat(fileProviders))); }
private IFileProvider CreateCompositeFileProvider() { IFileProvider[] fileProviders = new IFileProvider[] { this.serviceProvider.GetService <IHostingEnvironment>().WebRootFileProvider }; return(new CompositeFileProvider( fileProviders.Concat( ExtensionManager.Assemblies.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) )); }
public static IHostingEnvironment AddCompositeFileProvider(this IHostingEnvironment hostingEnvironment) { IEnumerable <IFileProvider> fileProviders = new IFileProvider[] { hostingEnvironment.WebRootFileProvider }; var compositeFileProvider = new CompositeFileProvider( fileProviders.Concat( ExtensionManager.Assemblies.Select(a => new EmbeddedFileProvider(a, a.GetName().Name)) ) ); hostingEnvironment.WebRootFileProvider = compositeFileProvider; return(hostingEnvironment); }