tgstation-server 5.12.7
The /tg/station 13 server suite
Loading...
Searching...
No Matches
IIOManager.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Threading;
5using System.Threading.Tasks;
6
8{
12 public interface IIOManager
13 {
18 string ResolvePath();
19
25 string ResolvePath(string path);
26
32 string GetFileName(string path);
33
39 string GetFileNameWithoutExtension(string path);
40
46 bool PathContainsParentAccess(string path);
47
59 IEnumerable<string> ignore,
60 Func<string, string, Task> postCopyCallback,
61 string src,
62 string dest,
63 int? taskThrottle,
64 CancellationToken cancellationToken);
65
72 Task<bool> FileExists(string path, CancellationToken cancellationToken);
73
80 Task<bool> DirectoryExists(string path, CancellationToken cancellationToken);
81
88 Task<byte[]> ReadAllBytes(string path, CancellationToken cancellationToken);
89
96 Task<IReadOnlyList<string>> GetDirectories(string path, CancellationToken cancellationToken);
97
104 Task<IReadOnlyList<string>> GetFiles(string path, CancellationToken cancellationToken);
105
111 FileStream CreateAsyncSequentialWriteStream(string path);
112
120 Task WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken);
121
129 Task CopyFile(string src, string dest, CancellationToken cancellationToken);
130
136 string GetDirectoryName(string path);
137
146 Task<List<string>> GetFilesWithExtension(string path, string extension, bool recursive, CancellationToken cancellationToken);
147
154 Task DeleteFile(string path, CancellationToken cancellationToken);
155
162 Task CreateDirectory(string path, CancellationToken cancellationToken);
163
170 Task DeleteDirectory(string path, CancellationToken cancellationToken);
171
177 string ConcatPath(params string[] paths);
178
186 Task MoveFile(string source, string destination, CancellationToken cancellationToken);
187
195 Task MoveDirectory(string source, string destination, CancellationToken cancellationToken);
196
204 Task ZipToDirectory(string path, Stream zipFile, CancellationToken cancellationToken);
205
212 Task<DateTimeOffset> GetLastModified(string path, CancellationToken cancellationToken);
213
221 FileStream GetFileStream(string path, bool shareWrite);
222 }
223}
Interface for using filesystems.
Definition: IIOManager.cs:13
Task< IReadOnlyList< string > > GetFiles(string path, CancellationToken cancellationToken)
Returns file names in a given path .
string GetFileName(string path)
Gets the file name portion of a path .
string ResolvePath()
Retrieve the full path of the current working directory.
string ConcatPath(params string[] paths)
Combines an array of strings into a path.
Task MoveFile(string source, string destination, CancellationToken cancellationToken)
Moves a file at source to destination .
Task< IReadOnlyList< string > > GetDirectories(string path, CancellationToken cancellationToken)
Returns directory names in a given path .
string GetDirectoryName(string path)
Gets the directory portion of a given path .
Task CreateDirectory(string path, CancellationToken cancellationToken)
Create a directory at path .
Task DeleteFile(string path, CancellationToken cancellationToken)
Deletes a file at path .
Task CopyDirectory(IEnumerable< string > ignore, Func< string, string, Task > postCopyCallback, string src, string dest, int? taskThrottle, CancellationToken cancellationToken)
Copies a directory from src to dest .
Task< DateTimeOffset > GetLastModified(string path, CancellationToken cancellationToken)
Get the DateTimeOffset of when a given path was last modified.
Task ZipToDirectory(string path, Stream zipFile, CancellationToken cancellationToken)
Extract a set of zipFile to a given path .
FileStream CreateAsyncSequentialWriteStream(string path)
Creates an asynchronous FileStream for sequential writing.
FileStream GetFileStream(string path, bool shareWrite)
Gets the Stream for a given file path .
string GetFileNameWithoutExtension(string path)
Gets the file name portion of a path with.
Task< byte[]> ReadAllBytes(string path, CancellationToken cancellationToken)
Returns all the contents of a file at path as a byte array.
Task DeleteDirectory(string path, CancellationToken cancellationToken)
Recursively delete a directory, removes and does not enter any symlinks encounterd.
Task< bool > FileExists(string path, CancellationToken cancellationToken)
Check that the file at path exists.
Task< List< string > > GetFilesWithExtension(string path, string extension, bool recursive, CancellationToken cancellationToken)
Gets a list of files in path with the given extension .
Task MoveDirectory(string source, string destination, CancellationToken cancellationToken)
Moves a directory at source to destination .
Task< bool > DirectoryExists(string path, CancellationToken cancellationToken)
Check that the directory at path exists.
string ResolvePath(string path)
Retrieve the full path of some path given a relative path. Must be used before passing relative path...
bool PathContainsParentAccess(string path)
Check if a path contains the '..' parent directory accessor.
Task WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken)
Writes some contents to a file at path overwriting previous content.
Task CopyFile(string src, string dest, CancellationToken cancellationToken)
Copy a file from src to dest .