Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DecoderFallbackBufferHelper.cs
Go to the documentation of this file.
1namespace System.Text;
2
4{
5 internal unsafe byte* byteStart;
6
7 internal unsafe char* charEnd;
8
10
12 {
13 _fallbackBuffer = fallbackBuffer;
14 byteStart = null;
15 charEnd = null;
16 }
17
18 internal unsafe void InternalReset()
19 {
20 byteStart = null;
22 }
23
24 internal unsafe void InternalInitialize(byte* _byteStart, char* _charEnd)
25 {
26 byteStart = _byteStart;
27 charEnd = _charEnd;
28 }
29
30 internal unsafe bool InternalFallback(byte[] bytes, byte* pBytes, ref char* chars)
31 {
32 if (_fallbackBuffer.Fallback(bytes, (int)(pBytes - byteStart - bytes.Length)))
33 {
34 char* ptr = chars;
35 bool flag = false;
36 char nextChar;
37 while ((nextChar = _fallbackBuffer.GetNextChar()) != 0)
38 {
39 if (char.IsSurrogate(nextChar))
40 {
41 if (char.IsHighSurrogate(nextChar))
42 {
43 if (flag)
44 {
46 }
47 flag = true;
48 }
49 else
50 {
51 if (!flag)
52 {
54 }
55 flag = false;
56 }
57 }
58 if (ptr >= charEnd)
59 {
60 return false;
61 }
62 *(ptr++) = nextChar;
63 }
64 if (flag)
65 {
67 }
68 chars = ptr;
69 }
70 return true;
71 }
72
73 internal unsafe int InternalFallback(byte[] bytes, byte* pBytes)
74 {
75 if (_fallbackBuffer.Fallback(bytes, (int)(pBytes - byteStart - bytes.Length)))
76 {
77 int num = 0;
78 bool flag = false;
79 char nextChar;
80 while ((nextChar = _fallbackBuffer.GetNextChar()) != 0)
81 {
82 if (char.IsSurrogate(nextChar))
83 {
84 if (char.IsHighSurrogate(nextChar))
85 {
86 if (flag)
87 {
89 }
90 flag = true;
91 }
92 else
93 {
94 if (!flag)
95 {
97 }
98 flag = false;
99 }
100 }
101 num++;
102 }
103 if (flag)
104 {
106 }
107 return num;
108 }
109 return 0;
110 }
111}
static string Argument_InvalidCharSequenceNoIndex
Definition SR.cs:92
Definition SR.cs:7
bool Fallback(byte[] bytesUnknown, int index)
unsafe bool InternalFallback(byte[] bytes, byte *pBytes, ref char *chars)
unsafe DecoderFallbackBufferHelper(DecoderFallbackBuffer fallbackBuffer)
unsafe void InternalInitialize(byte *_byteStart, char *_charEnd)
unsafe int InternalFallback(byte[] bytes, byte *pBytes)