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

◆ GetChunks()

static unsafe uint Interop.HttpApi.GetChunks ( IntPtr memoryBlob,
IntPtr originalAddress,
ref int dataChunkIndex,
ref uint dataChunkOffset,
byte[] buffer,
int offset,
int size )
inlinestaticpackage

Definition at line 818 of file Interop.cs.

819 {
820 uint num = 0u;
821 byte* ptr = (byte*)(void*)memoryBlob;
822 HTTP_REQUEST* ptr2 = (HTTP_REQUEST*)ptr;
823 long num2 = ptr - (byte*)(void*)originalAddress;
824 if (ptr2->EntityChunkCount > 0 && dataChunkIndex < ptr2->EntityChunkCount && dataChunkIndex != -1)
825 {
826 HTTP_DATA_CHUNK* ptr3 = (HTTP_DATA_CHUNK*)(num2 + (byte*)(ptr2->pEntityChunks + dataChunkIndex));
827 fixed (byte* ptr4 = buffer)
828 {
829 byte* ptr5 = ptr4 + offset;
830 while (dataChunkIndex < ptr2->EntityChunkCount && num < size)
831 {
832 if (dataChunkOffset >= ptr3->BufferLength)
833 {
836 ptr3++;
837 continue;
838 }
839 byte* ptr6 = ptr3->pBuffer + dataChunkOffset + num2;
840 uint num3 = ptr3->BufferLength - dataChunkOffset;
841 if (num3 > (uint)size)
842 {
843 num3 = (uint)size;
844 }
845 for (uint num4 = 0u; num4 < num3; num4++)
846 {
847 *(ptr5++) = *(ptr6++);
848 }
849 num += num3;
851 }
852 }
853 }
854 if (dataChunkIndex == ptr2->EntityChunkCount)
855 {
856 dataChunkIndex = -1;
857 }
858 return num;
859 }

References System.buffer, and System.offset.