Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AppendAllTextAsync() [2/2]

static Task System.IO.File.AppendAllTextAsync ( string path,
string? contents,
Encoding encoding,
CancellationToken cancellationToken = default(CancellationToken) )
inlinestatic

Definition at line 934 of file File.cs.

935 {
936 if (path == null)
937 {
938 throw new ArgumentNullException("path");
939 }
940 if (encoding == null)
941 {
942 throw new ArgumentNullException("encoding");
943 }
944 if (path.Length == 0)
945 {
946 throw new ArgumentException(SR.Argument_EmptyPath, "path");
947 }
948 if (cancellationToken.IsCancellationRequested)
949 {
951 }
952 if (string.IsNullOrEmpty(contents))
953 {
954 new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read).Dispose();
955 return Task.CompletedTask;
956 }
958 }
static StreamWriter AsyncStreamWriter(string path, Encoding encoding, bool append)
Definition File.cs:631
static async Task InternalWriteAllTextAsync(StreamWriter sw, string contents, CancellationToken cancellationToken)
Definition File.cs:920
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363
static Task CompletedTask
Definition Task.cs:1120

References System.SR.Argument_EmptyPath, System.IO.File.AsyncStreamWriter(), System.cancellationToken, System.Threading.Tasks.Task< TResult >.CompletedTask, System.IO.FileStream.Dispose(), System.Threading.Tasks.Task< TResult >.FromCanceled(), and System.IO.File.InternalWriteAllTextAsync().