C# (CSharp) IFileProvider Examples

C# (CSharp) IFileProvider - 30 examples found. These are the top rated real world C# (CSharp) examples of IFileProvider extracted from open source projects. You can rate examples to help us improve the quality of examples.
 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 ResourceDeployment(IFileProvider fileProvider, string path, string destination, IResourceTransform[] transforms)
 {
     this.FileProvider = fileProvider;
     this.ResourcePath = path;
     this.Destination = destination;
     this.Transforms = transforms;
 }
        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;
            }
        }
Example #4
0
 public Properties(IFileProvider fileProvider, string filename)
 {
     _list = new Dictionary<String, object>();
     _fileProvider = fileProvider;
     _filename = filename;
     LoadFromFile(_filename,"");
 }
 public VirtualPathRazorPageFactory(string rootDirectory, IExecutionContext executionContext, Type basePageType)
 {
     _rootDirectory = rootDirectory;
     _fileProvider = new PhysicalFileProvider(rootDirectory);
     _razorcompilationService = new RazorCompilationService(executionContext, basePageType);
     _executionContext = executionContext;
 }
 public BaseDocumentHandler(IFileProvider fileProvider, string subpath)
 {
     FileInfo = AcceptedExtensions
         .Select(x => fileProvider.GetFileInfo(subpath + x))
         .Where(x => x.Exists)
         .FirstOrDefault();
 }
Example #7
0
 // Internal for unit testing
 internal DefaultChunkTreeCache(
     IFileProvider fileProvider,
     MemoryCacheOptions options)
 {
     _fileProvider = fileProvider;
     _chunkTreeCache = new MemoryCache(options);
 }
 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 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 bool TryResolveHandler(IFileProvider fileProvider, string subpath, out IDocumentHandler handler)
 {
     handler = GetHandlers(fileProvider, subpath)
         .Where(x => x.CanHandleRequest)
         .FirstOrDefault();
     return handler != null;
 }
 public FileEffectiveRights53EntityOperationEvaluator(
     FileEffectiveRightsObjectCollector objectCollector, IFileProvider fileProvider)
 {
     this.FileEffectiveRights53SystemDataSource = objectCollector;
     this.FileProvider = fileProvider;
     this.PathOperatorEvaluator = new PathOperatorEvaluator(fileProvider, FamilyEnumeration.windows);
 }
 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);
 }
 /// <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);
     }
 }
Example #14
0
 public HomeworkController(IFileProvider fileProvider, IStudentHomeworkProvider studentHWProvider, IModuleProvider moduleProvider, IHomeworkProvider homeworkProvider)
 {
     _moduleProvider = moduleProvider;
     _homeworkProvider = homeworkProvider;
     _studentHWProvider = studentHWProvider;
     _fileProvider = 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 RazorCompilationService(ICompilationService compilationService,
                                IMvcRazorHost razorHost,
                                IOptions<RazorViewEngineOptions> viewEngineOptions)
 {
     _compilationService = compilationService;
     _razorHost = razorHost;
     _fileProvider = viewEngineOptions.Options.FileProvider;
 }
 // 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 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 PhysicalAppDataFolder(IAppDataFolderRoot root,
            ILoggerFactory loggerFactory)
        {
            _fileProvider = new PhysicalFileProvider(root.RootFolder);
            _logger = loggerFactory.CreateLogger<PhysicalAppDataFolder>();

            T = NullLocalizer.Instance;
        }
Example #20
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());
 }
Example #21
0
 public BasePanelViewModel(IFileProvider fileProvider, IDirectory currentDirectory)
 {
     this.fileProvider = fileProvider;
     this.fileProvider.FileChangedEvent += FileProviderOnFileChangedEvent;
     this.currentDirectory = currentDirectory;
     openCommand = new OpenFileCommand(this);
     FillDirectoryFiles();
 }
        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"));
        }
 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);
 }
Example #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);
 }
 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;
 }
Example #28
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;
 }
Example #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))
            )
              );
        }