Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlEncodedRawTextWriterIndent.cs
Go to the documentation of this file.
1using System.IO;
3
4namespace System.Xml;
5
7{
8 protected int _indentLevel;
9
10 protected bool _newLineOnAttributes;
11
12 protected string _indentChars;
13
14 protected bool _mixedContent;
15
17
19
21 {
22 get
23 {
24 XmlWriterSettings settings = base.Settings;
25 settings.ReadOnly = false;
26 settings.Indent = true;
29 settings.ReadOnly = true;
30 return settings;
31 }
32 }
33
35 : base(writer, settings)
36 {
37 Init(settings);
38 }
39
41 : base(stream, settings)
42 {
43 Init(settings);
44 }
45
46 public override void WriteDocType(string name, string pubid, string sysid, string subset)
47 {
49 {
51 }
52 base.WriteDocType(name, pubid, sysid, subset);
53 }
54
55 public override void WriteStartElement(string prefix, string localName, string ns)
56 {
58 {
60 }
63 base.WriteStartElement(prefix, localName, ns);
64 }
65
66 internal override void StartElementContent()
67 {
68 if (_indentLevel == 1 && _conformanceLevel == ConformanceLevel.Document)
69 {
70 _mixedContent = false;
71 }
72 else
73 {
75 }
76 base.StartElementContent();
77 }
78
83
84 internal override void WriteEndElement(string prefix, string localName, string ns)
85 {
88 {
90 }
92 base.WriteEndElement(prefix, localName, ns);
93 }
94
95 internal override void WriteFullEndElement(string prefix, string localName, string ns)
96 {
99 {
100 WriteIndent();
101 }
103 base.WriteFullEndElement(prefix, localName, ns);
104 }
105
106 public override void WriteStartAttribute(string prefix, string localName, string ns)
107 {
109 {
110 WriteIndent();
111 }
112 base.WriteStartAttribute(prefix, localName, ns);
113 }
114
115 public override void WriteCData(string text)
116 {
117 _mixedContent = true;
118 base.WriteCData(text);
119 }
120
121 public override void WriteComment(string text)
122 {
123 if (!_mixedContent && _textPos != _bufPos)
124 {
125 WriteIndent();
126 }
127 base.WriteComment(text);
128 }
129
130 public override void WriteProcessingInstruction(string target, string text)
131 {
132 if (!_mixedContent && _textPos != _bufPos)
133 {
134 WriteIndent();
135 }
136 base.WriteProcessingInstruction(target, text);
137 }
138
139 public override void WriteEntityRef(string name)
140 {
141 _mixedContent = true;
142 base.WriteEntityRef(name);
143 }
144
145 public override void WriteCharEntity(char ch)
146 {
147 _mixedContent = true;
148 base.WriteCharEntity(ch);
149 }
150
151 public override void WriteSurrogateCharEntity(char lowChar, char highChar)
152 {
153 _mixedContent = true;
154 base.WriteSurrogateCharEntity(lowChar, highChar);
155 }
156
157 public override void WriteWhitespace(string ws)
158 {
159 _mixedContent = true;
160 base.WriteWhitespace(ws);
161 }
162
163 public override void WriteString(string text)
164 {
165 _mixedContent = true;
166 base.WriteString(text);
167 }
168
169 public override void WriteChars(char[] buffer, int index, int count)
170 {
171 _mixedContent = true;
172 base.WriteChars(buffer, index, count);
173 }
174
175 public override void WriteRaw(char[] buffer, int index, int count)
176 {
177 _mixedContent = true;
178 base.WriteRaw(buffer, index, count);
179 }
180
181 public override void WriteRaw(string data)
182 {
183 _mixedContent = true;
184 base.WriteRaw(data);
185 }
186
187 public override void WriteBase64(byte[] buffer, int index, int count)
188 {
189 _mixedContent = true;
190 base.WriteBase64(buffer, index, count);
191 }
192
193 private void Init(XmlWriterSettings settings)
194 {
195 _indentLevel = 0;
196 _indentChars = settings.IndentChars;
199 if (!_checkCharacters)
200 {
201 return;
202 }
204 {
207 return;
208 }
210 if (_newLineHandling != 0)
211 {
213 }
214 }
215
216 private void WriteIndent()
217 {
219 for (int num = _indentLevel; num > 0; num--)
220 {
222 }
223 }
224
225 public override async Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
226 {
228 if (!_mixedContent && _textPos != _bufPos)
229 {
231 }
232 await base.WriteDocTypeAsync(name, pubid, sysid, subset).ConfigureAwait(continueOnCapturedContext: false);
233 }
234
235 public override async Task WriteStartElementAsync(string prefix, string localName, string ns)
236 {
238 if (!_mixedContent && _textPos != _bufPos)
239 {
241 }
242 _indentLevel++;
244 await base.WriteStartElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
245 }
246
247 internal override async Task WriteEndElementAsync(string prefix, string localName, string ns)
248 {
250 _indentLevel--;
252 {
254 }
256 await base.WriteEndElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
257 }
258
259 internal override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
260 {
262 _indentLevel--;
264 {
266 }
268 await base.WriteFullEndElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
269 }
270
271 protected internal override async Task WriteStartAttributeAsync(string prefix, string localName, string ns)
272 {
275 {
277 }
278 await base.WriteStartAttributeAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
279 }
280
281 public override Task WriteCDataAsync(string text)
282 {
284 _mixedContent = true;
285 return base.WriteCDataAsync(text);
286 }
287
288 public override async Task WriteCommentAsync(string text)
289 {
291 if (!_mixedContent && _textPos != _bufPos)
292 {
294 }
295 await base.WriteCommentAsync(text).ConfigureAwait(continueOnCapturedContext: false);
296 }
297
298 public override async Task WriteProcessingInstructionAsync(string target, string text)
299 {
301 if (!_mixedContent && _textPos != _bufPos)
302 {
304 }
305 await base.WriteProcessingInstructionAsync(target, text).ConfigureAwait(continueOnCapturedContext: false);
306 }
307
308 public override Task WriteEntityRefAsync(string name)
309 {
311 _mixedContent = true;
312 return base.WriteEntityRefAsync(name);
313 }
314
315 public override Task WriteCharEntityAsync(char ch)
316 {
318 _mixedContent = true;
319 return base.WriteCharEntityAsync(ch);
320 }
321
323 {
325 _mixedContent = true;
326 return base.WriteSurrogateCharEntityAsync(lowChar, highChar);
327 }
328
329 public override Task WriteWhitespaceAsync(string ws)
330 {
332 _mixedContent = true;
333 return base.WriteWhitespaceAsync(ws);
334 }
335
336 public override Task WriteStringAsync(string text)
337 {
339 _mixedContent = true;
340 return base.WriteStringAsync(text);
341 }
342
343 public override Task WriteCharsAsync(char[] buffer, int index, int count)
344 {
346 _mixedContent = true;
347 return base.WriteCharsAsync(buffer, index, count);
348 }
349
350 public override Task WriteRawAsync(char[] buffer, int index, int count)
351 {
353 _mixedContent = true;
354 return base.WriteRawAsync(buffer, index, count);
355 }
356
357 public override Task WriteRawAsync(string data)
358 {
360 _mixedContent = true;
361 return base.WriteRawAsync(data);
362 }
363
364 public override Task WriteBase64Async(byte[] buffer, int index, int count)
365 {
367 _mixedContent = true;
368 return base.WriteBase64Async(buffer, index, count);
369 }
370
380}
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
void PushBit(bool bit)
Definition BitStack.cs:16
override void WriteRaw(char[] buffer, int index, int count)
override async Task WriteStartElementAsync(string prefix, string localName, string ns)
override void WriteSurrogateCharEntity(char lowChar, char highChar)
override void WriteFullEndElement(string prefix, string localName, string ns)
override async Task WriteEndElementAsync(string prefix, string localName, string ns)
override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
override void WriteStartAttribute(string prefix, string localName, string ns)
override void WriteChars(char[] buffer, int index, int count)
override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
override Task WriteRawAsync(char[] buffer, int index, int count)
override void WriteEndElement(string prefix, string localName, string ns)
override async Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
override void WriteDocType(string name, string pubid, string sysid, string subset)
XmlEncodedRawTextWriterIndent(TextWriter writer, XmlWriterSettings settings)
override async Task WriteStartAttributeAsync(string prefix, string localName, string ns)
override Task WriteBase64Async(byte[] buffer, int index, int count)
override void WriteBase64(byte[] buffer, int index, int count)
override void WriteProcessingInstruction(string target, string text)
override void WriteStartElement(string prefix, string localName, string ns)
override async Task WriteProcessingInstructionAsync(string target, string text)
XmlEncodedRawTextWriterIndent(Stream stream, XmlWriterSettings settings)
override Task WriteCharsAsync(char[] buffer, int index, int count)
override void OnRootElement(ConformanceLevel currentConformanceLevel)
void ValidateContentChars(string chars, string propertyName, bool allowOnlyWhitespace)