Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
WebHeaderEncoding.cs
Go to the documentation of this file.
1
namespace
System.Net
;
2
3
internal
static
class
WebHeaderEncoding
4
{
5
internal
unsafe
static
string
GetString
(
byte
[]
bytes
,
int
byteIndex
,
int
byteCount
)
6
{
7
if
(
byteCount
< 1)
8
{
9
return
string
.Empty;
10
}
11
return
string
.Create(
byteCount
, (
bytes
,
byteIndex
), delegate(
Span<char>
buffer
, (
byte
[]
bytes
,
int
byteIndex
)
state
)
12
{
13
fixed (
byte
* ptr = &
state
.bytes[
state
.byteIndex])
14
{
15
fixed (
char
* ptr3 =
buffer
)
16
{
17
byte
* ptr2 = ptr;
18
char
* ptr4 = ptr3;
19
int
num;
20
for
(num =
buffer
.Length; num >= 8; num -= 8)
21
{
22
*ptr4 = (char)(*ptr2);
23
ptr4[1] = (char)ptr2[1];
24
ptr4[2] = (char)ptr2[2];
25
ptr4[3] = (char)ptr2[3];
26
ptr4[4] = (char)ptr2[4];
27
ptr4[5] = (char)ptr2[5];
28
ptr4[6] = (char)ptr2[6];
29
ptr4[7] = (char)ptr2[7];
30
ptr4 += 8;
31
ptr2 += 8;
32
}
33
for
(
int
i = 0; i < num; i++)
34
{
35
ptr4[i] = (char)ptr2[i];
36
}
37
}
38
}
39
});
40
}
41
42
internal
static
int
GetByteCount
(
string
myString)
43
{
44
return
myString.Length;
45
}
46
47
internal
unsafe
static
void
GetBytes
(
string
myString,
int
charIndex
,
int
charCount
,
byte
[]
bytes
,
int
byteIndex
)
48
{
49
if
(myString.Length == 0)
50
{
51
return
;
52
}
53
fixed (
byte
* ptr =
bytes
)
54
{
55
byte
* ptr2 = ptr +
byteIndex
;
56
int
num =
charIndex
+
charCount
;
57
while
(
charIndex
< num)
58
{
59
*(ptr2++) = (
byte
)myString[
charIndex
++];
60
}
61
}
62
}
63
}
System.Net.WebHeaderEncoding.GetString
static unsafe string GetString(byte[] bytes, int byteIndex, int byteCount)
Definition
WebHeaderEncoding.cs:5
System.Net.WebHeaderEncoding.GetBytes
static unsafe void GetBytes(string myString, int charIndex, int charCount, byte[] bytes, int byteIndex)
Definition
WebHeaderEncoding.cs:47
System.Net.WebHeaderEncoding.GetByteCount
static int GetByteCount(string myString)
Definition
WebHeaderEncoding.cs:42
System.Net.WebHeaderEncoding
Definition
WebHeaderEncoding.cs:4
System.Net
Definition
HttpClientJsonExtensions.cs:8
System.ExceptionArgument.bytes
@ bytes
System.ExceptionArgument.byteIndex
@ byteIndex
System.ExceptionArgument.buffer
@ buffer
System.ExceptionArgument.charCount
@ charCount
System.ExceptionArgument.state
@ state
System.ExceptionArgument.byteCount
@ byteCount
System.ExceptionArgument.charIndex
@ charIndex
System.Span
Definition
Span.cs:14
source
System.Net.HttpListener
System.Net
WebHeaderEncoding.cs
Generated by
1.10.0