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

◆ WriteRawWithCharCheckingNoFlush() [1/3]

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

Definition at line 2697 of file XmlEncodedRawTextWriter.cs.

2698 {
2699 needWriteNewLine = false;
2700 fixed (char* ptr2 = _bufChars)
2701 {
2702 char* ptr = pSrcBegin;
2703 char* ptr3 = ptr2 + _bufPos;
2704 int num = 0;
2705 while (true)
2706 {
2707 char* ptr4 = ptr3 + (pSrcEnd - ptr);
2708 if (ptr4 > ptr2 + _bufLen)
2709 {
2710 ptr4 = ptr2 + _bufLen;
2711 }
2712 while (ptr3 < ptr4 && XmlCharType.IsTextChar((char)(num = *ptr)))
2713 {
2714 *ptr3 = (char)num;
2715 ptr3++;
2716 ptr++;
2717 }
2718 if (ptr >= pSrcEnd)
2719 {
2720 break;
2721 }
2722 if (ptr3 >= ptr4)
2723 {
2724 _bufPos = (int)(ptr3 - ptr2);
2725 return (int)(ptr - pSrcBegin);
2726 }
2727 switch (num)
2728 {
2729 case 9:
2730 case 38:
2731 case 60:
2732 case 93:
2733 *ptr3 = (char)num;
2734 ptr3++;
2735 break;
2736 case 13:
2737 if (_newLineHandling == NewLineHandling.Replace)
2738 {
2739 if (ptr + 1 < pSrcEnd && ptr[1] == '\n')
2740 {
2741 ptr++;
2742 }
2743 _bufPos = (int)(ptr3 - ptr2);
2744 needWriteNewLine = true;
2745 return (int)(ptr - pSrcBegin);
2746 }
2747 *ptr3 = (char)num;
2748 ptr3++;
2749 break;
2750 case 10:
2751 if (_newLineHandling == NewLineHandling.Replace)
2752 {
2753 _bufPos = (int)(ptr3 - ptr2);
2754 needWriteNewLine = true;
2755 return (int)(ptr - pSrcBegin);
2756 }
2757 *ptr3 = (char)num;
2758 ptr3++;
2759 break;
2760 default:
2761 if (XmlCharType.IsSurrogate(num))
2762 {
2764 ptr += 2;
2765 }
2766 else if (num <= 127 || num >= 65534)
2767 {
2769 ptr++;
2770 }
2771 else
2772 {
2773 *ptr3 = (char)num;
2774 ptr3++;
2775 ptr++;
2776 }
2777 continue;
2778 }
2779 ptr++;
2780 }
2781 _bufPos = (int)(ptr3 - ptr2);
2782 }
2783 return -1;
2784 }
unsafe char * InvalidXmlChar(int ch, char *pDst, bool entitize)
static unsafe char * EncodeSurrogate(char *pSrc, char *pSrcEnd, char *pDst)

References System.Xml.XmlEncodedRawTextWriter._bufChars, System.Xml.XmlEncodedRawTextWriter._bufLen, System.Xml.XmlEncodedRawTextWriter._bufPos, System.Xml.XmlEncodedRawTextWriter._newLineHandling, System.Xml.Dictionary, System.Xml.XmlEncodedRawTextWriter.EncodeSurrogate(), System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsSurrogate(), and System.Xml.XmlCharType.IsTextChar().

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