@@ -22,36 +22,36 @@ protected Adapter(string prefix, string rootPath)
2222 RootPath = rootPath ;
2323 }
2424
25- public IFile GetFile ( string path )
25+ public IFile GetFile ( string virtualPath )
2626 {
27- return GetFileAsync ( path ) . Result ;
27+ return GetFileAsync ( virtualPath ) . Result ;
2828 }
2929
30- public IDirectory GetDirectory ( string path )
30+ public IDirectory GetDirectory ( string virtualPath )
3131 {
32- return GetDirectoryAsync ( path ) . Result ;
32+ return GetDirectoryAsync ( virtualPath ) . Result ;
3333 }
3434
35- public IEnumerable < IFile > GetFiles ( string path = "" )
35+ public IEnumerable < IFile > GetFiles ( string virtualPath = "" )
3636 {
37- return GetFilesAsync ( path ) . Result ;
37+ return GetFilesAsync ( virtualPath ) . Result ;
3838 }
3939
40- public IEnumerable < IDirectory > GetDirectories ( string path = "" )
40+ public IEnumerable < IDirectory > GetDirectories ( string virtualPath = "" )
4141 {
42- return GetDirectoriesAsync ( path ) . Result ;
42+ return GetDirectoriesAsync ( virtualPath ) . Result ;
4343 }
4444
45- public bool FileExists ( string path )
45+ public bool FileExists ( string virtualPath )
4646 {
47- return FileExistsAsync ( path ) . Result ;
47+ return FileExistsAsync ( virtualPath ) . Result ;
4848 }
4949
50- public async Task < bool > FileExistsAsync ( string path , CancellationToken cancellationToken = default )
50+ public async Task < bool > FileExistsAsync ( string virtualPath , CancellationToken cancellationToken = default )
5151 {
5252 try
5353 {
54- await GetFileAsync ( path , cancellationToken ) ;
54+ await GetFileAsync ( virtualPath , cancellationToken ) ;
5555 }
5656 catch ( FileNotFoundException )
5757 {
@@ -61,16 +61,16 @@ public async Task<bool> FileExistsAsync(string path, CancellationToken cancellat
6161 return true ;
6262 }
6363
64- public bool DirectoryExists ( string path )
64+ public bool DirectoryExists ( string virtualPath )
6565 {
66- return DirectoryExistsAsync ( path ) . Result ;
66+ return DirectoryExistsAsync ( virtualPath ) . Result ;
6767 }
6868
69- public async Task < bool > DirectoryExistsAsync ( string path , CancellationToken cancellationToken = default )
69+ public async Task < bool > DirectoryExistsAsync ( string virtualPath , CancellationToken cancellationToken = default )
7070 {
7171 try
7272 {
73- await GetDirectoryAsync ( path , cancellationToken ) ;
73+ await GetDirectoryAsync ( virtualPath , cancellationToken ) ;
7474 }
7575 catch ( DirectoryNotFoundException )
7676 {
@@ -80,78 +80,78 @@ public async Task<bool> DirectoryExistsAsync(string path, CancellationToken canc
8080 return true ;
8181 }
8282
83- public void CreateDirectory ( string path )
83+ public void CreateDirectory ( string virtualPath )
8484 {
85- CreateDirectoryAsync ( path ) . Wait ( ) ;
85+ CreateDirectoryAsync ( virtualPath ) . Wait ( ) ;
8686 }
8787
88- public void DeleteDirectory ( string path )
88+ public void DeleteDirectory ( string virtualPath )
8989 {
90- DeleteDirectoryAsync ( path ) . Wait ( ) ;
90+ DeleteDirectoryAsync ( virtualPath ) . Wait ( ) ;
9191 }
9292
93- public void DeleteFile ( string path )
93+ public void DeleteFile ( string virtualPath )
9494 {
95- DeleteFileAsync ( path ) . Wait ( ) ;
95+ DeleteFileAsync ( virtualPath ) . Wait ( ) ;
9696 }
9797
98- public byte [ ] ReadFile ( string path )
98+ public byte [ ] ReadFile ( string virtualPath )
9999 {
100- return ReadFileAsync ( path ) . Result ;
100+ return ReadFileAsync ( virtualPath ) . Result ;
101101 }
102102
103- public string ReadTextFile ( string path )
103+ public string ReadTextFile ( string virtualPath )
104104 {
105- return ReadTextFileAsync ( path ) . Result ;
105+ return ReadTextFileAsync ( virtualPath ) . Result ;
106106 }
107107
108- public void WriteFile ( string path , byte [ ] contents , bool overwrite = false )
108+ public void WriteFile ( string virtualPath , byte [ ] contents , bool overwrite = false )
109109 {
110- WriteFileAsync ( path , contents , overwrite ) . Wait ( ) ;
110+ WriteFileAsync ( virtualPath , contents , overwrite ) . Wait ( ) ;
111111 }
112112
113- public void WriteFile ( string path , string contents , bool overwrite = false )
113+ public void WriteFile ( string virtualPath , string contents , bool overwrite = false )
114114 {
115- WriteFileAsync ( path , contents , overwrite ) . Wait ( ) ;
115+ WriteFileAsync ( virtualPath , contents , overwrite ) . Wait ( ) ;
116116 }
117117
118- public async Task WriteFileAsync ( string path , string contents , bool overwrite = false , CancellationToken cancellationToken = default )
118+ public async Task WriteFileAsync ( string virtualPath , string contents , bool overwrite = false , CancellationToken cancellationToken = default )
119119 {
120- await WriteFileAsync ( path , Encoding . UTF8 . GetBytes ( contents ) , overwrite , cancellationToken ) ;
120+ await WriteFileAsync ( virtualPath , Encoding . UTF8 . GetBytes ( contents ) , overwrite , cancellationToken ) ;
121121 }
122122
123- public void AppendFile ( string path , byte [ ] contents )
123+ public void AppendFile ( string virtualPath , byte [ ] contents )
124124 {
125- AppendFileAsync ( path , contents ) . Wait ( ) ;
125+ AppendFileAsync ( virtualPath , contents ) . Wait ( ) ;
126126 }
127127
128- public void AppendFile ( string path , string contents )
128+ public void AppendFile ( string virtualPath , string contents )
129129 {
130- AppendFileAsync ( path , contents ) . Wait ( ) ;
130+ AppendFileAsync ( virtualPath , contents ) . Wait ( ) ;
131131 }
132132
133- public async Task AppendFileAsync ( string path , string contents , CancellationToken cancellationToken = default )
133+ public async Task AppendFileAsync ( string virtualPath , string contents , CancellationToken cancellationToken = default )
134134 {
135- await AppendFileAsync ( path , Encoding . UTF8 . GetBytes ( contents ) , cancellationToken ) ;
135+ await AppendFileAsync ( virtualPath , Encoding . UTF8 . GetBytes ( contents ) , cancellationToken ) ;
136136 }
137137
138138 public abstract void Dispose ( ) ;
139139 public abstract void Connect ( ) ;
140- public abstract Task < IFile > GetFileAsync ( string path , CancellationToken cancellationToken = default ) ;
141- public abstract Task < IDirectory > GetDirectoryAsync ( string path , CancellationToken cancellationToken = default ) ;
142- public abstract Task < IEnumerable < IFile > > GetFilesAsync ( string path = "" , CancellationToken cancellationToken = default ) ;
143- public abstract Task < IEnumerable < IDirectory > > GetDirectoriesAsync ( string path = "" , CancellationToken cancellationToken = default ) ;
144- public abstract Task CreateDirectoryAsync ( string path , CancellationToken cancellationToken = default ) ;
145- public abstract Task DeleteDirectoryAsync ( string path , CancellationToken cancellationToken = default ) ;
146- public abstract Task DeleteFileAsync ( string path , CancellationToken cancellationToken = default ) ;
147- public abstract Task < byte [ ] > ReadFileAsync ( string path , CancellationToken cancellationToken = default ) ;
148- public abstract Task < string > ReadTextFileAsync ( string path , CancellationToken cancellationToken = default ) ;
149- public abstract Task WriteFileAsync ( string path , byte [ ] contents , bool overwrite = false , CancellationToken cancellationToken = default ) ;
150- public abstract Task AppendFileAsync ( string path , byte [ ] contents , CancellationToken cancellationToken = default ) ;
151-
152- protected string GetPath ( string virtualPath )
153- {
154- return PathUtilities . GetPath ( virtualPath , RootPath ) ;
140+ public abstract Task < IFile > GetFileAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
141+ public abstract Task < IDirectory > GetDirectoryAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
142+ public abstract Task < IEnumerable < IFile > > GetFilesAsync ( string virtualPath = "" , CancellationToken cancellationToken = default ) ;
143+ public abstract Task < IEnumerable < IDirectory > > GetDirectoriesAsync ( string virtualPath = "" , CancellationToken cancellationToken = default ) ;
144+ public abstract Task CreateDirectoryAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
145+ public abstract Task DeleteDirectoryAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
146+ public abstract Task DeleteFileAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
147+ public abstract Task < byte [ ] > ReadFileAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
148+ public abstract Task < string > ReadTextFileAsync ( string virtualPath , CancellationToken cancellationToken = default ) ;
149+ public abstract Task WriteFileAsync ( string virtualPath , byte [ ] contents , bool overwrite = false , CancellationToken cancellationToken = default ) ;
150+ public abstract Task AppendFileAsync ( string virtualPath , byte [ ] contents , CancellationToken cancellationToken = default ) ;
151+
152+ protected string GetPath ( string path )
153+ {
154+ return PathUtilities . GetPath ( path , RootPath ) ;
155155 }
156156
157157 protected string GetVirtualPath ( string path )
0 commit comments