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

◆ InternalFallback() [2/2]

virtual unsafe bool System.Text.DecoderFallbackBuffer.InternalFallback ( byte[] bytes,
byte * pBytes,
ref char * chars )
inlinepackagevirtualinherited

Definition at line 53 of file DecoderFallbackBuffer.cs.

54 {
55 if (Fallback(bytes, (int)(pBytes - byteStart - bytes.Length)))
56 {
57 char* ptr = chars;
58 bool flag = false;
59 char nextChar;
60 while ((nextChar = GetNextChar()) != 0)
61 {
62 if (char.IsSurrogate(nextChar))
63 {
64 if (char.IsHighSurrogate(nextChar))
65 {
66 if (flag)
67 {
68 throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
69 }
70 flag = true;
71 }
72 else
73 {
74 if (!flag)
75 {
76 throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
77 }
78 flag = false;
79 }
80 }
81 if (ptr >= charEnd)
82 {
83 return false;
84 }
85 *(ptr++) = nextChar;
86 }
87 if (flag)
88 {
89 throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
90 }
91 chars = ptr;
92 }
93 return true;
94 }
bool Fallback(byte[] bytesUnknown, int index)

References System.SR.Argument_InvalidCharSequenceNoIndex, System.bytes, System.Text.DecoderFallbackBuffer.byteStart, System.Text.DecoderFallbackBuffer.charEnd, System.chars, System.Text.DecoderFallbackBuffer.Fallback(), and System.Text.DecoderFallbackBuffer.GetNextChar().

Referenced by System.Text.Encoding.EncodingCharBuffer.Fallback(), System.Text.UnicodeEncoding.GetCharCount(), System.Text.UTF32Encoding.GetCharCount(), System.Text.UnicodeEncoding.GetChars(), and System.Text.UTF32Encoding.GetChars().