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

◆ Write() [1/2]

void System.Xml.XmlTextEncoder.Write ( char[] array,
int offset,
int count )
inlinepackage

Definition at line 82 of file XmlTextEncoder.cs.

83 {
84 if (array == null)
85 {
86 throw new ArgumentNullException("array");
87 }
88 if (0 > offset)
89 {
90 throw new ArgumentOutOfRangeException("offset");
91 }
92 if (0 > count)
93 {
94 throw new ArgumentOutOfRangeException("count");
95 }
96 if (count > array.Length - offset)
97 {
98 throw new ArgumentOutOfRangeException("count");
99 }
100 if (_cacheAttrValue)
101 {
103 }
104 int num = offset + count;
105 int i = offset;
106 char c = '\0';
107 while (true)
108 {
109 int num2 = i;
110 for (; i < num; i++)
111 {
112 if (!XmlCharType.IsAttributeValueChar(c = array[i]))
113 {
114 break;
115 }
116 }
117 if (num2 < i)
118 {
120 }
121 if (i == num)
122 {
123 break;
124 }
125 switch (c)
126 {
127 case '\t':
129 break;
130 case '\n':
131 case '\r':
132 if (_inAttribute)
133 {
135 }
136 else
137 {
139 }
140 break;
141 case '<':
142 WriteEntityRefImpl("lt");
143 break;
144 case '>':
145 WriteEntityRefImpl("gt");
146 break;
147 case '&':
148 WriteEntityRefImpl("amp");
149 break;
150 case '\'':
151 if (_inAttribute && _quoteChar == c)
152 {
153 WriteEntityRefImpl("apos");
154 }
155 else
156 {
157 _textWriter.Write('\'');
158 }
159 break;
160 case '"':
161 if (_inAttribute && _quoteChar == c)
162 {
163 WriteEntityRefImpl("quot");
164 }
165 else
166 {
167 _textWriter.Write('"');
168 }
169 break;
170 default:
171 if (XmlCharType.IsHighSurrogate(c))
172 {
173 if (i + 1 >= num)
174 {
176 }
177 WriteSurrogateChar(array[++i], c);
178 }
179 else
180 {
181 if (XmlCharType.IsLowSurrogate(c))
182 {
183 throw XmlConvert.CreateInvalidHighSurrogateCharException(c);
184 }
186 }
187 break;
188 }
189 i++;
190 }
191 }
virtual void Write(char value)
static string Xml_SurrogatePairSplit
Definition SR.cs:360
Definition SR.cs:7
StringBuilder Append(char value, int repeatCount)
void WriteEntityRefImpl(string name)
void WriteSurrogateChar(char lowChar, char highChar)
void WriteCharEntityImpl(char ch)
readonly TextWriter _textWriter

References System.Xml.XmlTextEncoder._attrValue, System.Xml.XmlTextEncoder._cacheAttrValue, System.Xml.XmlTextEncoder._inAttribute, System.Xml.XmlTextEncoder._quoteChar, System.Xml.XmlTextEncoder._textWriter, System.Text.StringBuilder.Append(), System.Xml.ArgumentException, System.array, System.count, System.Xml.XmlConvert.CreateInvalidHighSurrogateCharException(), System.Xml.Dictionary, System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.offset, System.IO.TextWriter.Write(), System.Xml.XmlTextEncoder.WriteCharEntityImpl(), System.Xml.XmlTextEncoder.WriteEntityRefImpl(), System.Xml.XmlTextEncoder.WriteSurrogateChar(), and System.SR.Xml_SurrogatePairSplit.

Referenced by System.Xml.Xsl.XsltOld.ReaderOutput.XmlEncoder.AttributeInnerXml(), and System.Xml.Xsl.XsltOld.ReaderOutput.XmlEncoder.AttributeOuterXml().