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

◆ GetChars() [2/7]

unsafe override int System.Text.DecoderDBCS.GetChars ( byte * bytes,
int byteCount,
char * chars,
int charCount,
bool flush )
inlinevirtual

Reimplemented from System.Text.Decoder.

Definition at line 164 of file DecoderDBCS.cs.

165 {
166 if (chars == null || bytes == null)
167 {
168 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", System.SR.ArgumentNull_Array);
169 }
170 if (byteCount < 0 || charCount < 0)
171 {
172 throw new ArgumentOutOfRangeException((byteCount < 0) ? "byteCount" : "charCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
173 }
174 if (charCount == 0)
175 {
176 return 0;
177 }
178 byte b = (byte)((byteCount > 0 && !flush && IsLastByteALeadByte(bytes, byteCount)) ? bytes[byteCount - 1] : 0);
179 if (b != 0)
180 {
181 byteCount--;
182 }
183 if (_leftOverLeadByte == 0)
184 {
185 if (byteCount <= 0)
186 {
188 return 0;
189 }
190 int result = OSEncoding.MultiByteToWideChar(_encoding.CodePage, bytes, byteCount, chars, charCount);
192 return result;
193 }
194 if (byteCount == 0 && b == 0 && !flush)
195 {
196 return 0;
197 }
200 return result2;
201 }
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.byteCount, System.bytes, System.charCount, System.chars, System.Text.Encoding.CodePage, System.Text.DecoderDBCS.ConvertWithLeftOverByte(), System.Text.DecoderDBCS.IsLastByteALeadByte(), and System.Text.OSEncoding.MultiByteToWideChar().