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

◆ WriteHtmlAttributeText()

unsafe void System.Xml.HtmlUtf8RawTextWriter.WriteHtmlAttributeText ( char * pSrc,
char * pSrcEnd )
inlineprivate

Definition at line 323 of file HtmlUtf8RawTextWriter.cs.

324 {
326 {
327 if (pSrcEnd - pSrc > 0 && *pSrc != '{')
328 {
330 }
331 _endsWithAmpersand = false;
332 }
333 fixed (byte* ptr = _bufBytes)
334 {
335 byte* pDst = ptr + _bufPos;
336 char c = '\0';
337 while (true)
338 {
339 byte* ptr2 = pDst + (pSrcEnd - pSrc);
340 if (ptr2 > ptr + _bufLen)
341 {
342 ptr2 = ptr + _bufLen;
343 }
344 while (pDst < ptr2 && XmlCharType.IsAttributeValueChar(c = *pSrc) && c <= '\u007f')
345 {
346 *(pDst++) = (byte)c;
347 pSrc++;
348 }
349 if (pSrc >= pSrcEnd)
350 {
351 break;
352 }
353 if (pDst >= ptr2)
354 {
355 _bufPos = (int)(pDst - ptr);
356 FlushBuffer();
357 pDst = ptr + 1;
358 continue;
359 }
360 switch (c)
361 {
362 case '&':
363 if (pSrc + 1 == pSrcEnd)
364 {
365 _endsWithAmpersand = true;
366 }
367 else if (pSrc[1] != '{')
368 {
369 pDst = XmlUtf8RawTextWriter.AmpEntity(pDst);
370 break;
371 }
372 *(pDst++) = (byte)c;
373 break;
374 case '"':
375 pDst = XmlUtf8RawTextWriter.QuoteEntity(pDst);
376 break;
377 case '\t':
378 case '\'':
379 case '<':
380 case '>':
381 *(pDst++) = (byte)c;
382 break;
383 case '\r':
384 pDst = XmlUtf8RawTextWriter.CarriageReturnEntity(pDst);
385 break;
386 case '\n':
387 pDst = XmlUtf8RawTextWriter.LineFeedEntity(pDst);
388 break;
389 default:
391 continue;
392 }
393 pSrc++;
394 }
395 _bufPos = (int)(pDst - ptr);
396 }
397 }
unsafe void EncodeChar(ref char *pSrc, char *pSrcEnd, ref byte *pDst)
XmlUtf8RawTextWriter(XmlWriterSettings settings)

References System.Xml.XmlUtf8RawTextWriter._bufBytes, System.Xml.XmlUtf8RawTextWriter._bufLen, System.Xml.XmlUtf8RawTextWriter._bufPos, System.Xml.HtmlUtf8RawTextWriter._endsWithAmpersand, System.Xml.XmlUtf8RawTextWriter.AmpEntity(), System.Xml.XmlUtf8RawTextWriter.CarriageReturnEntity(), System.Xml.Dictionary, System.Xml.XmlUtf8RawTextWriter.EncodeChar(), System.Xml.XmlUtf8RawTextWriter.FlushBuffer(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlUtf8RawTextWriter.LineFeedEntity(), System.Xml.HtmlUtf8RawTextWriter.OutputRestAmps(), and System.Xml.XmlUtf8RawTextWriter.QuoteEntity().

Referenced by System.Xml.HtmlUtf8RawTextWriter.WriteHtmlAttributeTextBlock().