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

◆ JoinInternal() [2/3]

static unsafe string System.IO.Path.JoinInternal ( ReadOnlySpan< char > first,
ReadOnlySpan< char > second,
ReadOnlySpan< char > third )
inlinestaticprivate

Definition at line 650 of file Path.cs.

651 {
652 byte b = (byte)((!PathInternal.IsDirectorySeparator(first[first.Length - 1]) && !PathInternal.IsDirectorySeparator(second[0])) ? 1 : 0);
653 byte b2 = (byte)((!PathInternal.IsDirectorySeparator(second[second.Length - 1]) && !PathInternal.IsDirectorySeparator(third[0])) ? 1 : 0);
654 fixed (char* first2 = &MemoryMarshal.GetReference(first))
655 {
656 fixed (char* second2 = &MemoryMarshal.GetReference(second))
657 {
658 fixed (char* third2 = &MemoryMarshal.GetReference(third))
659 {
660 Join3Payload join3Payload = new Join3Payload(first2, first.Length, second2, second.Length, third2, third.Length, (byte)(b | (b2 << 1)));
661 return string.Create(first.Length + second.Length + third.Length + b + b2, (IntPtr)(&join3Payload), delegate(Span<char> destination, IntPtr statePtr)
662 {
663 ref Join3Payload reference = ref *(Join3Payload*)(void*)statePtr;
664 new Span<char>(reference.First, reference.FirstLength).CopyTo(destination);
665 if (((uint)reference.Separators & (true ? 1u : 0u)) != 0)
666 {
667 destination[reference.FirstLength] = '\\';
668 }
669 new Span<char>(reference.Second, reference.SecondLength).CopyTo(destination.Slice(reference.FirstLength + (reference.Separators & 1)));
670 if ((reference.Separators & 2u) != 0)
671 {
672 destination[destination.Length - reference.ThirdLength - 1] = '\\';
673 }
674 new Span<char>(reference.Third, reference.ThirdLength).CopyTo(destination.Slice(destination.Length - reference.ThirdLength));
675 });
676 }
677 }
678 }
679 }

References System.Span< T >.CopyTo(), System.destination, and System.IO.PathInternal.IsDirectorySeparator().