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

◆ WriteElementTextBlockNoFlush() [1/3]

unsafe int System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlockNoFlush ( char * pSrc,
char * pSrcEnd,
out bool needWriteNewLine )
inlineprotectedinherited

Definition at line 2017 of file XmlUtf8RawTextWriter.cs.

2018 {
2019 needWriteNewLine = false;
2020 char* ptr = pSrc;
2021 fixed (byte* ptr2 = _bufBytes)
2022 {
2023 byte* ptr3 = ptr2 + _bufPos;
2024 int num = 0;
2025 while (true)
2026 {
2027 byte* ptr4 = ptr3 + (pSrcEnd - pSrc);
2028 if (ptr4 > ptr2 + _bufLen)
2029 {
2030 ptr4 = ptr2 + _bufLen;
2031 }
2032 while (ptr3 < ptr4 && XmlCharType.IsAttributeValueChar((char)(num = *pSrc)) && num <= 127)
2033 {
2034 *ptr3 = (byte)num;
2035 ptr3++;
2036 pSrc++;
2037 }
2038 if (pSrc >= pSrcEnd)
2039 {
2040 break;
2041 }
2042 if (ptr3 >= ptr4)
2043 {
2044 _bufPos = (int)(ptr3 - ptr2);
2045 return (int)(pSrc - ptr);
2046 }
2047 switch (num)
2048 {
2049 case 38:
2050 ptr3 = AmpEntity(ptr3);
2051 break;
2052 case 60:
2053 ptr3 = LtEntity(ptr3);
2054 break;
2055 case 62:
2056 ptr3 = GtEntity(ptr3);
2057 break;
2058 case 9:
2059 case 34:
2060 case 39:
2061 *ptr3 = (byte)num;
2062 ptr3++;
2063 break;
2064 case 10:
2065 if (_newLineHandling == NewLineHandling.Replace)
2066 {
2067 _bufPos = (int)(ptr3 - ptr2);
2068 needWriteNewLine = true;
2069 return (int)(pSrc - ptr);
2070 }
2071 *ptr3 = (byte)num;
2072 ptr3++;
2073 break;
2074 case 13:
2075 switch (_newLineHandling)
2076 {
2077 case NewLineHandling.Replace:
2078 if (pSrc + 1 < pSrcEnd && pSrc[1] == '\n')
2079 {
2080 pSrc++;
2081 }
2082 _bufPos = (int)(ptr3 - ptr2);
2083 needWriteNewLine = true;
2084 return (int)(pSrc - ptr);
2085 case NewLineHandling.Entitize:
2087 break;
2088 case NewLineHandling.None:
2089 *ptr3 = (byte)num;
2090 ptr3++;
2091 break;
2092 }
2093 break;
2094 default:
2095 if (XmlCharType.IsSurrogate(num))
2096 {
2098 pSrc += 2;
2099 }
2100 else if (num <= 127 || num >= 65534)
2101 {
2103 pSrc++;
2104 }
2105 else
2106 {
2108 pSrc++;
2109 }
2110 continue;
2111 }
2112 pSrc++;
2113 }
2114 _bufPos = (int)(ptr3 - ptr2);
2115 _textPos = _bufPos;
2116 _contentPos = 0;
2117 }
2118 return -1;
2119 }
static unsafe byte * AmpEntity(byte *pDst)
static unsafe byte * CarriageReturnEntity(byte *pDst)
unsafe byte * InvalidXmlChar(int ch, byte *pDst, bool entitize)
static unsafe byte * LtEntity(byte *pDst)
static unsafe byte * GtEntity(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._contentPos, System.Xml.XmlUtf8RawTextWriter._newLineHandling, System.Xml.XmlUtf8RawTextWriter._textPos, System.Xml.XmlUtf8RawTextWriter.AmpEntity(), System.Xml.XmlUtf8RawTextWriter.CarriageReturnEntity(), System.Xml.Dictionary, System.Xml.XmlUtf8RawTextWriter.EncodeMultibyteUTF8(), System.Xml.XmlUtf8RawTextWriter.EncodeSurrogate(), System.Xml.XmlUtf8RawTextWriter.GtEntity(), System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsSurrogate(), and System.Xml.XmlUtf8RawTextWriter.LtEntity().

Referenced by System.Xml.XmlUtf8RawTextWriter._WriteElementTextBlockAsync(), System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlockAsync(), System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlockAsync(), System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlockNoFlush(), and System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlockNoFlush().