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

◆ WriteRawWithCharCheckingNoFlush() [1/3]

unsafe int System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharCheckingNoFlush ( char * pSrcBegin,
char * pSrcEnd,
out bool needWriteNewLine )
inlineprotectedinherited

Definition at line 2363 of file XmlUtf8RawTextWriter.cs.

2364 {
2365 needWriteNewLine = false;
2366 fixed (byte* ptr2 = _bufBytes)
2367 {
2368 char* ptr = pSrcBegin;
2369 byte* ptr3 = ptr2 + _bufPos;
2370 int num = 0;
2371 while (true)
2372 {
2373 byte* ptr4 = ptr3 + (pSrcEnd - ptr);
2374 if (ptr4 > ptr2 + _bufLen)
2375 {
2376 ptr4 = ptr2 + _bufLen;
2377 }
2378 while (ptr3 < ptr4 && XmlCharType.IsTextChar((char)(num = *ptr)) && num <= 127)
2379 {
2380 *ptr3 = (byte)num;
2381 ptr3++;
2382 ptr++;
2383 }
2384 if (ptr >= pSrcEnd)
2385 {
2386 break;
2387 }
2388 if (ptr3 >= ptr4)
2389 {
2390 _bufPos = (int)(ptr3 - ptr2);
2391 return (int)(ptr - pSrcBegin);
2392 }
2393 switch (num)
2394 {
2395 case 9:
2396 case 38:
2397 case 60:
2398 case 93:
2399 *ptr3 = (byte)num;
2400 ptr3++;
2401 break;
2402 case 13:
2403 if (_newLineHandling == NewLineHandling.Replace)
2404 {
2405 if (ptr + 1 < pSrcEnd && ptr[1] == '\n')
2406 {
2407 ptr++;
2408 }
2409 _bufPos = (int)(ptr3 - ptr2);
2410 needWriteNewLine = true;
2411 return (int)(ptr - pSrcBegin);
2412 }
2413 *ptr3 = (byte)num;
2414 ptr3++;
2415 break;
2416 case 10:
2417 if (_newLineHandling == NewLineHandling.Replace)
2418 {
2419 _bufPos = (int)(ptr3 - ptr2);
2420 needWriteNewLine = true;
2421 return (int)(ptr - pSrcBegin);
2422 }
2423 *ptr3 = (byte)num;
2424 ptr3++;
2425 break;
2426 default:
2427 if (XmlCharType.IsSurrogate(num))
2428 {
2430 ptr += 2;
2431 }
2432 else if (num <= 127 || num >= 65534)
2433 {
2435 ptr++;
2436 }
2437 else
2438 {
2440 ptr++;
2441 }
2442 continue;
2443 }
2444 ptr++;
2445 }
2446 _bufPos = (int)(ptr3 - ptr2);
2447 }
2448 return -1;
2449 }
unsafe byte * InvalidXmlChar(int ch, byte *pDst, bool entitize)
static unsafe byte * EncodeMultibyteUTF8(int ch, byte *pDst)
static unsafe byte * EncodeSurrogate(char *pSrc, char *pSrcEnd, byte *pDst)

References System.Xml.XmlUtf8RawTextWriter._bufBytes, System.Xml.XmlUtf8RawTextWriter._bufLen, System.Xml.XmlUtf8RawTextWriter._bufPos, System.Xml.XmlUtf8RawTextWriter._newLineHandling, System.Xml.Dictionary, System.Xml.XmlUtf8RawTextWriter.EncodeMultibyteUTF8(), System.Xml.XmlUtf8RawTextWriter.EncodeSurrogate(), System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsSurrogate(), and System.Xml.XmlCharType.IsTextChar().

Referenced by System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharCheckingAsync(), System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharCheckingAsync(), System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharCheckingNoFlush(), and System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharCheckingNoFlush().