tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
FileDownloadProvider.cs
Go to the documentation of this file.
1using System;
2using System.IO;
3using System.Threading;
4using System.Threading.Tasks;
5
7
9{
13 public sealed class FileDownloadProvider
14 {
18 public Func<ErrorCode?> ActivationCallback { get; }
19
23 public Func<CancellationToken, Task<Stream>>? StreamProvider { get; }
24
28 public string FilePath { get; }
29
33 public bool ShareWrite { get; }
34
43 Func<ErrorCode?> activationCallback,
44 Func<CancellationToken, Task<Stream>>? streamProvider,
45 string filePath,
46 bool shareWrite)
47 {
48 ActivationCallback = activationCallback ?? throw new ArgumentNullException(nameof(activationCallback));
49 StreamProvider = streamProvider;
50 FilePath = filePath ?? throw new ArgumentNullException(nameof(filePath));
51 ShareWrite = shareWrite;
52 }
53 }
54}
Represents a file on disk to be downloaded.
bool ShareWrite
If the file read stream should be allowed to share writes. If this is set, the entire file will be bu...
string FilePath
The full path to the file on disk to download.
FileDownloadProvider(Func< ErrorCode?> activationCallback, Func< CancellationToken, Task< Stream > >? streamProvider, string filePath, bool shareWrite)
Initializes a new instance of the FileDownloadProvider class.
Func< CancellationToken, Task< Stream > >? StreamProvider
A Func<T, TResult> to specially provide a Task<TResult> returning the Stream of the file download....
Func< ErrorCode?> ActivationCallback
A Func<TResult> to run before providing the download. If it returns a non-null ErrorCode,...