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

◆ WriteCDataSection()

unsafe void System.Xml.XmlUtf8RawTextWriter.WriteCDataSection ( string text)
inlineprotectedinherited

Definition at line 1008 of file XmlUtf8RawTextWriter.cs.

1009 {
1010 if (text.Length == 0)
1011 {
1012 if (_bufPos >= _bufLen)
1013 {
1014 FlushBuffer();
1015 }
1016 return;
1017 }
1018 fixed (char* ptr2 = text)
1019 {
1020 byte[] bufBytes = _bufBytes;
1021 fixed (byte[] array = bufBytes)
1022 {
1023 byte* ptr = (byte*)((bufBytes != null && array.Length != 0) ? Unsafe.AsPointer(ref array[0]) : null);
1024 char* ptr3 = ptr2;
1025 char* ptr4 = ptr2 + text.Length;
1026 byte* ptr5 = ptr + _bufPos;
1027 int num = 0;
1028 while (true)
1029 {
1030 byte* ptr6 = ptr5 + (ptr4 - ptr3);
1031 if (ptr6 > ptr + _bufLen)
1032 {
1033 ptr6 = ptr + _bufLen;
1034 }
1035 while (ptr5 < ptr6 && XmlCharType.IsAttributeValueChar((char)(num = *ptr3)) && num != 93 && num <= 127)
1036 {
1037 *ptr5 = (byte)num;
1038 ptr5++;
1039 ptr3++;
1040 }
1041 if (ptr3 >= ptr4)
1042 {
1043 break;
1044 }
1045 if (ptr5 >= ptr6)
1046 {
1047 _bufPos = (int)(ptr5 - ptr);
1048 FlushBuffer();
1049 ptr5 = ptr + 1;
1050 continue;
1051 }
1052 switch (num)
1053 {
1054 case 62:
1055 if (_hadDoubleBracket && ptr5[-1] == 93)
1056 {
1059 }
1060 *ptr5 = 62;
1061 ptr5++;
1062 break;
1063 case 93:
1064 if (ptr5[-1] == 93)
1065 {
1066 _hadDoubleBracket = true;
1067 }
1068 else
1069 {
1070 _hadDoubleBracket = false;
1071 }
1072 *ptr5 = 93;
1073 ptr5++;
1074 break;
1075 case 13:
1076 if (_newLineHandling == NewLineHandling.Replace)
1077 {
1078 if (ptr3 + 1 < ptr4 && ptr3[1] == '\n')
1079 {
1080 ptr3++;
1081 }
1083 }
1084 else
1085 {
1086 *ptr5 = (byte)num;
1087 ptr5++;
1088 }
1089 break;
1090 case 10:
1091 if (_newLineHandling == NewLineHandling.Replace)
1092 {
1094 break;
1095 }
1096 *ptr5 = (byte)num;
1097 ptr5++;
1098 break;
1099 case 9:
1100 case 34:
1101 case 38:
1102 case 39:
1103 case 60:
1104 *ptr5 = (byte)num;
1105 ptr5++;
1106 break;
1107 default:
1108 if (XmlCharType.IsSurrogate(num))
1109 {
1111 ptr3 += 2;
1112 }
1113 else if (num <= 127 || num >= 65534)
1114 {
1116 ptr3++;
1117 }
1118 else
1119 {
1121 ptr3++;
1122 }
1123 continue;
1124 }
1125 ptr3++;
1126 }
1127 _bufPos = (int)(ptr5 - ptr);
1128 }
1129 }
1130 }
unsafe byte * WriteNewLine(byte *pDst)
static unsafe byte * RawStartCData(byte *pDst)
unsafe byte * InvalidXmlChar(int ch, byte *pDst, bool entitize)
static unsafe byte * RawEndCData(byte *pDst)
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._hadDoubleBracket, System.Xml.XmlUtf8RawTextWriter._newLineHandling, System.array, System.Xml.Dictionary, System.Xml.XmlUtf8RawTextWriter.EncodeMultibyteUTF8(), System.Xml.XmlUtf8RawTextWriter.EncodeSurrogate(), System.Xml.XmlUtf8RawTextWriter.FlushBuffer(), System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsSurrogate(), System.Xml.XmlUtf8RawTextWriter.RawEndCData(), System.Xml.XmlUtf8RawTextWriter.RawStartCData(), System.text, and System.Xml.XmlUtf8RawTextWriter.WriteNewLine().

Referenced by System.Xml.XmlUtf8RawTextWriter.WriteCData().