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

◆ WriteCDataSection()

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

Definition at line 1210 of file XmlEncodedRawTextWriter.cs.

1211 {
1212 if (text.Length == 0)
1213 {
1214 if (_bufPos >= _bufLen)
1215 {
1216 FlushBuffer();
1217 }
1218 return;
1219 }
1220 fixed (char* ptr2 = text)
1221 {
1222 char[] bufChars = _bufChars;
1223 fixed (char[] array = bufChars)
1224 {
1225 char* ptr = (char*)((bufChars != null && array.Length != 0) ? Unsafe.AsPointer(ref array[0]) : null);
1226 char* ptr3 = ptr2;
1227 char* ptr4 = ptr2 + text.Length;
1228 char* ptr5 = ptr + _bufPos;
1229 int num = 0;
1230 while (true)
1231 {
1232 char* ptr6 = ptr5 + (ptr4 - ptr3);
1233 if (ptr6 > ptr + _bufLen)
1234 {
1235 ptr6 = ptr + _bufLen;
1236 }
1237 while (ptr5 < ptr6 && XmlCharType.IsAttributeValueChar((char)(num = *ptr3)) && num != 93)
1238 {
1239 *ptr5 = (char)num;
1240 ptr5++;
1241 ptr3++;
1242 }
1243 if (ptr3 >= ptr4)
1244 {
1245 break;
1246 }
1247 if (ptr5 >= ptr6)
1248 {
1249 _bufPos = (int)(ptr5 - ptr);
1250 FlushBuffer();
1251 ptr5 = ptr + 1;
1252 continue;
1253 }
1254 switch (num)
1255 {
1256 case 62:
1257 if (_hadDoubleBracket && ptr5[-1] == ']')
1258 {
1261 }
1262 *ptr5 = '>';
1263 ptr5++;
1264 break;
1265 case 93:
1266 if (ptr5[-1] == ']')
1267 {
1268 _hadDoubleBracket = true;
1269 }
1270 else
1271 {
1272 _hadDoubleBracket = false;
1273 }
1274 *ptr5 = ']';
1275 ptr5++;
1276 break;
1277 case 13:
1278 if (_newLineHandling == NewLineHandling.Replace)
1279 {
1280 if (ptr3 + 1 < ptr4 && ptr3[1] == '\n')
1281 {
1282 ptr3++;
1283 }
1285 }
1286 else
1287 {
1288 *ptr5 = (char)num;
1289 ptr5++;
1290 }
1291 break;
1292 case 10:
1293 if (_newLineHandling == NewLineHandling.Replace)
1294 {
1296 break;
1297 }
1298 *ptr5 = (char)num;
1299 ptr5++;
1300 break;
1301 case 9:
1302 case 34:
1303 case 38:
1304 case 39:
1305 case 60:
1306 *ptr5 = (char)num;
1307 ptr5++;
1308 break;
1309 default:
1310 if (XmlCharType.IsSurrogate(num))
1311 {
1313 ptr3 += 2;
1314 }
1315 else if (num <= 127 || num >= 65534)
1316 {
1318 ptr3++;
1319 }
1320 else
1321 {
1322 *ptr5 = (char)num;
1323 ptr5++;
1324 ptr3++;
1325 }
1326 continue;
1327 }
1328 ptr3++;
1329 }
1330 _bufPos = (int)(ptr5 - ptr);
1331 }
1332 }
1333 }
unsafe char * InvalidXmlChar(int ch, char *pDst, bool entitize)
static unsafe char * RawStartCData(char *pDst)
static unsafe char * RawEndCData(char *pDst)
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._hadDoubleBracket, System.Xml.XmlEncodedRawTextWriter._newLineHandling, System.array, System.Xml.Dictionary, System.Xml.XmlEncodedRawTextWriter.EncodeSurrogate(), System.Xml.XmlEncodedRawTextWriter.FlushBuffer(), System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsSurrogate(), System.Xml.XmlEncodedRawTextWriter.RawEndCData(), System.Xml.XmlEncodedRawTextWriter.RawStartCData(), System.text, and System.Xml.XmlEncodedRawTextWriter.WriteNewLine().

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