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

◆ JoinInternal() [3/3]

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

Definition at line 681 of file Path.cs.

682 {
683 byte b = (byte)((!PathInternal.IsDirectorySeparator(first[first.Length - 1]) && !PathInternal.IsDirectorySeparator(second[0])) ? 1 : 0);
684 byte b2 = (byte)((!PathInternal.IsDirectorySeparator(second[second.Length - 1]) && !PathInternal.IsDirectorySeparator(third[0])) ? 1 : 0);
685 byte b3 = (byte)((!PathInternal.IsDirectorySeparator(third[third.Length - 1]) && !PathInternal.IsDirectorySeparator(fourth[0])) ? 1 : 0);
686 fixed (char* first2 = &MemoryMarshal.GetReference(first))
687 {
688 fixed (char* second2 = &MemoryMarshal.GetReference(second))
689 {
690 fixed (char* third2 = &MemoryMarshal.GetReference(third))
691 {
692 fixed (char* fourth2 = &MemoryMarshal.GetReference(fourth))
693 {
694 Join4Payload join4Payload = new Join4Payload(first2, first.Length, second2, second.Length, third2, third.Length, fourth2, fourth.Length, (byte)(b | (b2 << 1) | (b3 << 2)));
695 return string.Create(first.Length + second.Length + third.Length + fourth.Length + b + b2 + b3, (IntPtr)(&join4Payload), delegate(Span<char> destination, IntPtr statePtr)
696 {
697 ref Join4Payload reference = ref *(Join4Payload*)(void*)statePtr;
698 new Span<char>(reference.First, reference.FirstLength).CopyTo(destination);
699 int firstLength = reference.FirstLength;
700 if (((uint)reference.Separators & (true ? 1u : 0u)) != 0)
701 {
702 destination[firstLength++] = '\\';
703 }
704 new Span<char>(reference.Second, reference.SecondLength).CopyTo(destination.Slice(firstLength));
705 firstLength += reference.SecondLength;
706 if ((reference.Separators & 2u) != 0)
707 {
708 destination[firstLength++] = '\\';
709 }
710 new Span<char>(reference.Third, reference.ThirdLength).CopyTo(destination.Slice(firstLength));
711 firstLength += reference.ThirdLength;
712 if ((reference.Separators & 4u) != 0)
713 {
714 destination[firstLength++] = '\\';
715 }
716 new Span<char>(reference.Fourth, reference.FourthLength).CopyTo(destination.Slice(firstLength));
717 });
718 }
719 }
720 }
721 }
722 }

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