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

◆ TryJoin() [1/2]

static bool System.IO.Path.TryJoin ( ReadOnlySpan< char > path1,
ReadOnlySpan< char > path2,
ReadOnlySpan< char > path3,
Span< char > destination,
out int charsWritten )
inlinestatic

Definition at line 526 of file Path.cs.

527 {
528 charsWritten = 0;
529 if (path1.Length == 0 && path2.Length == 0 && path3.Length == 0)
530 {
531 return true;
532 }
533 if (path1.Length == 0)
534 {
535 return TryJoin(path2, path3, destination, out charsWritten);
536 }
537 if (path2.Length == 0)
538 {
539 return TryJoin(path1, path3, destination, out charsWritten);
540 }
541 if (path3.Length == 0)
542 {
543 return TryJoin(path1, path2, destination, out charsWritten);
544 }
545 int num = ((!EndsInDirectorySeparator(path1) && !PathInternal.StartsWithDirectorySeparator(path2)) ? 1 : 0);
546 bool flag = !EndsInDirectorySeparator(path2) && !PathInternal.StartsWithDirectorySeparator(path3);
547 if (flag)
548 {
549 num++;
550 }
551 int num2 = path1.Length + path2.Length + path3.Length + num;
552 if (destination.Length < num2)
553 {
554 return false;
555 }
556 bool flag2 = TryJoin(path1, path2, destination, out charsWritten);
557 if (flag)
558 {
559 destination[charsWritten++] = DirectorySeparatorChar;
560 }
561 path3.CopyTo(destination.Slice(charsWritten));
562 charsWritten += path3.Length;
563 return true;
564 }
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static bool TryJoin(ReadOnlySpan< char > path1, ReadOnlySpan< char > path2, Span< char > destination, out int charsWritten)
Definition Path.cs:492
static bool EndsInDirectorySeparator(ReadOnlySpan< char > path)
Definition Path.cs:848
void CopyTo(Span< T > destination)

References System.ReadOnlySpan< T >.CopyTo(), System.destination, System.IO.Path.DirectorySeparatorChar, System.IO.Path.EndsInDirectorySeparator(), System.ReadOnlySpan< T >.Length, System.IO.PathInternal.StartsWithDirectorySeparator(), and System.IO.Path.TryJoin().