public virtual IFileProvider Get([NotNull] string containerName) { Check.NotNull(containerName, nameof(containerName)); var configuration = ConfigurationProvider.Get(containerName); if (!FileProviders.Any()) { throw new AbpException("No FILE Storage provider was registered! At least one provider must be registered to be able to use the Blog Storing System."); } foreach (var provider in FileProviders) { if (provider.Provider.Equals(configuration.Provider, StringComparison.OrdinalIgnoreCase)) { return(provider); } //if (ProxyHelper.GetUnProxiedType(provider).IsAssignableTo(configuration.Provider)) //{ // return provider; //} } throw new AbpException( $"Could not find the FILE Storage provider with the type ({configuration.Provider}) configured for the container {containerName} and no default provider was set." ); }
public static LocalFileProvider AddLocalProvider(params string[] directories) { var provider = new LocalFileProvider(); foreach (var dir in directories) { provider.AddFileDirectory(dir); } FileProviders.Add(provider); return(provider); }
public static void Init() { if (_initialized) { return; } _initialized = true; FileProviders.Add(new WorkshopFileProvider()); AddLocalProvider(Structure.RuntimePath); Build(); }
public IFileProvider GetFileProvider(NormalizedPath path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (path.IsRelative) { throw new ArgumentException("The path must be absolute"); } IFileProvider fileProvider; if (!FileProviders.TryGet(path.Provider, out fileProvider)) { throw new KeyNotFoundException($"Provider {path.Provider} could not be found"); } return(fileProvider); }