-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasePathTransformFileProvider.cs
43 lines (34 loc) · 1.2 KB
/
BasePathTransformFileProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Text;
namespace BibliTech.VersionedFileProvider
{
public abstract class BasePathTransformFileProvider : IPathTransformFileProvider
{
IFileProvider underlyingFileProvider;
public BasePathTransformFileProvider(IFileProvider underlyingFileProvider)
{
this.underlyingFileProvider = underlyingFileProvider;
}
public BasePathTransformFileProvider(string root)
: this(new PhysicalFileProvider(root))
{ }
public abstract string TransformSubpath(string subpath);
public IDirectoryContents GetDirectoryContents(string subpath)
{
return this.underlyingFileProvider.GetDirectoryContents(
this.TransformSubpath(subpath));
}
public IFileInfo GetFileInfo(string subpath)
{
return this.underlyingFileProvider.GetFileInfo(
this.TransformSubpath(subpath));
}
public IChangeToken Watch(string filter)
{
return this.underlyingFileProvider.Watch(filter);
}
}
}