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

◆ Convert() [2/5]

unsafe override void System.Text.DecoderDBCS.Convert ( byte * bytes,
int byteCount,
char * chars,
int charCount,
bool flush,
out int bytesUsed,
out int charsUsed,
out bool completed )
inlinevirtual

Reimplemented from System.Text.Decoder.

Definition at line 243 of file DecoderDBCS.cs.

244 {
245 if (chars == null || bytes == null)
246 {
247 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", System.SR.ArgumentNull_Array);
248 }
249 if (byteCount < 0 || charCount < 0)
250 {
251 throw new ArgumentOutOfRangeException((byteCount < 0) ? "byteCount" : "charCount", System.SR.ArgumentOutOfRange_NeedNonNegNum);
252 }
253 int num;
254 for (num = byteCount; num > 0; num /= 2)
255 {
256 int charCount2 = GetCharCount(bytes, num, flush);
257 if (charCount2 <= charCount)
258 {
259 break;
260 }
261 }
262 if (num > 0)
263 {
264 charsUsed = GetChars(bytes, num, chars, charCount, flush);
265 bytesUsed = num;
266 completed = _leftOverLeadByte == 0 && byteCount == num;
267 }
268 else
269 {
270 bytesUsed = 0;
271 charsUsed = 0;
272 completed = false;
273 }
274 }
override int GetCharCount(byte[] bytes, int index, int count)
override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)

References System.Text.DecoderDBCS._leftOverLeadByte, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.bytes, System.charCount, System.chars, System.Text.DecoderDBCS.GetCharCount(), and System.Text.DecoderDBCS.GetChars().