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

◆ WriteRawWithCharChecking()

unsafe void System.Xml.XmlUtf8RawTextWriter.WriteRawWithCharChecking ( char * pSrcBegin,
char * pSrcEnd )
inlineprotectedinherited

Definition at line 797 of file XmlUtf8RawTextWriter.cs.

798 {
799 fixed (byte* ptr2 = _bufBytes)
800 {
801 char* ptr = pSrcBegin;
802 byte* ptr3 = ptr2 + _bufPos;
803 int num = 0;
804 while (true)
805 {
806 byte* ptr4 = ptr3 + (pSrcEnd - ptr);
807 if (ptr4 > ptr2 + _bufLen)
808 {
809 ptr4 = ptr2 + _bufLen;
810 }
811 while (ptr3 < ptr4 && XmlCharType.IsTextChar((char)(num = *ptr)) && num <= 127)
812 {
813 *ptr3 = (byte)num;
814 ptr3++;
815 ptr++;
816 }
817 if (ptr >= pSrcEnd)
818 {
819 break;
820 }
821 if (ptr3 >= ptr4)
822 {
823 _bufPos = (int)(ptr3 - ptr2);
824 FlushBuffer();
825 ptr3 = ptr2 + 1;
826 continue;
827 }
828 switch (num)
829 {
830 case 9:
831 case 38:
832 case 60:
833 case 93:
834 *ptr3 = (byte)num;
835 ptr3++;
836 break;
837 case 13:
838 if (_newLineHandling == NewLineHandling.Replace)
839 {
840 if (ptr + 1 < pSrcEnd && ptr[1] == '\n')
841 {
842 ptr++;
843 }
845 }
846 else
847 {
848 *ptr3 = (byte)num;
849 ptr3++;
850 }
851 break;
852 case 10:
853 if (_newLineHandling == NewLineHandling.Replace)
854 {
856 break;
857 }
858 *ptr3 = (byte)num;
859 ptr3++;
860 break;
861 default:
862 if (XmlCharType.IsSurrogate(num))
863 {
865 ptr += 2;
866 }
867 else if (num <= 127 || num >= 65534)
868 {
870 ptr++;
871 }
872 else
873 {
875 ptr++;
876 }
877 continue;
878 }
879 ptr++;
880 }
881 _bufPos = (int)(ptr3 - ptr2);
882 }
883 }
unsafe byte * WriteNewLine(byte *pDst)
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.FlushBuffer(), System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsSurrogate(), System.Xml.XmlCharType.IsTextChar(), and System.Xml.XmlUtf8RawTextWriter.WriteNewLine().

Referenced by System.Xml.XmlUtf8RawTextWriter.WriteRaw(), and System.Xml.XmlUtf8RawTextWriter.WriteRaw().