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

◆ GetCharCount() [2/7]

unsafe override int System.Text.DecoderDBCS.GetCharCount ( byte * bytes,
int count,
bool flush )
inlinevirtual

Reimplemented from System.Text.Decoder.

Definition at line 92 of file DecoderDBCS.cs.

93 {
94 if (bytes == null)
95 {
96 throw new ArgumentNullException("bytes", System.SR.ArgumentNull_Array);
97 }
98 if (count < 0)
99 {
100 throw new ArgumentOutOfRangeException("count", System.SR.ArgumentOutOfRange_NeedNonNegNum);
101 }
102 bool flag = count > 0 && !flush && IsLastByteALeadByte(bytes, count);
103 if (flag)
104 {
105 count--;
106 }
107 if (_leftOverLeadByte == 0)
108 {
109 if (count <= 0)
110 {
111 return 0;
112 }
113 return OSEncoding.MultiByteToWideChar(_encoding.CodePage, bytes, count, null, 0);
114 }
115 if (count == 0 && !flag && !flush)
116 {
117 return 0;
118 }
119 return ConvertWithLeftOverByte(bytes, count, null, 0);
120 }
static string ArgumentNull_Array
Definition SR.cs:24
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
Definition SR.cs:7
unsafe bool IsLastByteALeadByte(byte *bytes, int count)
readonly Encoding _encoding
Definition DecoderDBCS.cs:7
unsafe int ConvertWithLeftOverByte(byte *bytes, int count, char *chars, int charCount)
virtual int CodePage
Definition Encoding.cs:515

References System.Text.DecoderDBCS._encoding, System.Text.DecoderDBCS._leftOverLeadByte, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.bytes, System.Text.Encoding.CodePage, System.Text.DecoderDBCS.ConvertWithLeftOverByte(), System.count, System.Text.DecoderDBCS.IsLastByteALeadByte(), and System.Text.OSEncoding.MultiByteToWideChar().