tgstation-server 6.12.0
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
55 Task<bool> PathIsChildOf(string parentPath, string childPath, CancellationToken cancellationToken);
56
67 ValueTask CopyDirectory(
68 IEnumerable<string>? ignore,
69 Func<string, string, ValueTask>? postCopyCallback,
70 string src,
71 string dest,
72 int? taskThrottle,
73 CancellationToken cancellationToken);
74
81 Task<bool> FileExists(string path, CancellationToken cancellationToken);
82
89 Task<bool> DirectoryExists(string path, CancellationToken cancellationToken);
90
98 ValueTask<byte[]> ReadAllBytes(string path, CancellationToken cancellationToken);
99
106 Task<IReadOnlyList<string>> GetDirectories(string path, CancellationToken cancellationToken);
107
114 Task<IReadOnlyList<string>> GetFiles(string path, CancellationToken cancellationToken);
115
121 FileStream CreateAsyncSequentialWriteStream(string path);
122
128 FileStream CreateAsyncSequentialReadStream(string path);
129
137 ValueTask WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken);
138
146 ValueTask CopyFile(string src, string dest, CancellationToken cancellationToken);
147
154 string GetDirectoryName(string path);
155
164 Task<List<string>> GetFilesWithExtension(string path, string extension, bool recursive, CancellationToken cancellationToken);
165
172 Task DeleteFile(string path, CancellationToken cancellationToken);
173
180 Task CreateDirectory(string path, CancellationToken cancellationToken);
181
188 Task DeleteDirectory(string path, CancellationToken cancellationToken);
189
195 string ConcatPath(params string[] paths);
196
204 Task MoveFile(string source, string destination, CancellationToken cancellationToken);
205
213 Task MoveDirectory(string source, string destination, CancellationToken cancellationToken);
214
222 Task ZipToDirectory(string path, Stream zipFile, CancellationToken cancellationToken);
223
230 Task<DateTimeOffset> GetLastModified(string path, CancellationToken cancellationToken);
231
239 FileStream GetFileStream(string path, bool shareWrite);
240 }
241}
Interface for using filesystems.
Definition IIOManager.cs:13
Task< IReadOnlyList< string > > GetFiles(string path, CancellationToken cancellationToken)
Returns full file names in a given path .
string GetFileName(string path)
Gets the file name portion of a path .
Task< bool > PathIsChildOf(string parentPath, string childPath, CancellationToken cancellationToken)
Check if a given parentPath is a parent of a given parentPath .
string ResolvePath()
Retrieve the full path of the current working directory.
FileStream CreateAsyncSequentialReadStream(string path)
Creates an asynchronous FileStream for sequential reading.
ValueTask< byte[]> ReadAllBytes(string path, CancellationToken cancellationToken)
Returns all the contents of a file at path as a byte array.
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 full 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 .
ValueTask CopyFile(string src, string dest, CancellationToken cancellationToken)
Copy a file 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.
ValueTask WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken)
Writes some contents to a file at path overwriting previous content.
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 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 .
ValueTask CopyDirectory(IEnumerable< string >? ignore, Func< string, string, ValueTask >? postCopyCallback, string src, string dest, int? taskThrottle, CancellationToken cancellationToken)
Copies a directory from src to dest .
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.