Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlUtf8RawTextWriterIndent.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(stream, settings)
36 {
37 Init(settings);
38 }
39
40 public override void WriteDocType(string name, string pubid, string sysid, string subset)
41 {
43 {
45 }
46 base.WriteDocType(name, pubid, sysid, subset);
47 }
48
49 public override void WriteStartElement(string prefix, string localName, string ns)
50 {
52 {
54 }
57 base.WriteStartElement(prefix, localName, ns);
58 }
59
60 internal override void StartElementContent()
61 {
62 if (_indentLevel == 1 && _conformanceLevel == ConformanceLevel.Document)
63 {
64 _mixedContent = false;
65 }
66 else
67 {
69 }
70 base.StartElementContent();
71 }
72
77
78 internal override void WriteEndElement(string prefix, string localName, string ns)
79 {
82 {
84 }
86 base.WriteEndElement(prefix, localName, ns);
87 }
88
89 internal override void WriteFullEndElement(string prefix, string localName, string ns)
90 {
93 {
95 }
97 base.WriteFullEndElement(prefix, localName, ns);
98 }
99
100 public override void WriteStartAttribute(string prefix, string localName, string ns)
101 {
103 {
104 WriteIndent();
105 }
106 base.WriteStartAttribute(prefix, localName, ns);
107 }
108
109 public override void WriteCData(string text)
110 {
111 _mixedContent = true;
112 base.WriteCData(text);
113 }
114
115 public override void WriteComment(string text)
116 {
117 if (!_mixedContent && _textPos != _bufPos)
118 {
119 WriteIndent();
120 }
121 base.WriteComment(text);
122 }
123
124 public override void WriteProcessingInstruction(string target, string text)
125 {
126 if (!_mixedContent && _textPos != _bufPos)
127 {
128 WriteIndent();
129 }
130 base.WriteProcessingInstruction(target, text);
131 }
132
133 public override void WriteEntityRef(string name)
134 {
135 _mixedContent = true;
136 base.WriteEntityRef(name);
137 }
138
139 public override void WriteCharEntity(char ch)
140 {
141 _mixedContent = true;
142 base.WriteCharEntity(ch);
143 }
144
145 public override void WriteSurrogateCharEntity(char lowChar, char highChar)
146 {
147 _mixedContent = true;
148 base.WriteSurrogateCharEntity(lowChar, highChar);
149 }
150
151 public override void WriteWhitespace(string ws)
152 {
153 _mixedContent = true;
154 base.WriteWhitespace(ws);
155 }
156
157 public override void WriteString(string text)
158 {
159 _mixedContent = true;
160 base.WriteString(text);
161 }
162
163 public override void WriteChars(char[] buffer, int index, int count)
164 {
165 _mixedContent = true;
166 base.WriteChars(buffer, index, count);
167 }
168
169 public override void WriteRaw(char[] buffer, int index, int count)
170 {
171 _mixedContent = true;
172 base.WriteRaw(buffer, index, count);
173 }
174
175 public override void WriteRaw(string data)
176 {
177 _mixedContent = true;
178 base.WriteRaw(data);
179 }
180
181 public override void WriteBase64(byte[] buffer, int index, int count)
182 {
183 _mixedContent = true;
184 base.WriteBase64(buffer, index, count);
185 }
186
187 private void Init(XmlWriterSettings settings)
188 {
189 _indentLevel = 0;
190 _indentChars = settings.IndentChars;
193 if (!_checkCharacters)
194 {
195 return;
196 }
198 {
201 return;
202 }
204 if (_newLineHandling != 0)
205 {
207 }
208 }
209
210 private void WriteIndent()
211 {
213 for (int num = _indentLevel; num > 0; num--)
214 {
216 }
217 }
218
219 public override async Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
220 {
222 if (!_mixedContent && _textPos != _bufPos)
223 {
225 }
226 await base.WriteDocTypeAsync(name, pubid, sysid, subset).ConfigureAwait(continueOnCapturedContext: false);
227 }
228
229 public override async Task WriteStartElementAsync(string prefix, string localName, string ns)
230 {
232 if (!_mixedContent && _textPos != _bufPos)
233 {
235 }
236 _indentLevel++;
238 await base.WriteStartElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
239 }
240
241 internal override async Task WriteEndElementAsync(string prefix, string localName, string ns)
242 {
244 _indentLevel--;
246 {
248 }
250 await base.WriteEndElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
251 }
252
253 internal override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
254 {
256 _indentLevel--;
258 {
260 }
262 await base.WriteFullEndElementAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
263 }
264
265 protected internal override async Task WriteStartAttributeAsync(string prefix, string localName, string ns)
266 {
269 {
271 }
272 await base.WriteStartAttributeAsync(prefix, localName, ns).ConfigureAwait(continueOnCapturedContext: false);
273 }
274
275 public override Task WriteCDataAsync(string text)
276 {
278 _mixedContent = true;
279 return base.WriteCDataAsync(text);
280 }
281
282 public override async Task WriteCommentAsync(string text)
283 {
285 if (!_mixedContent && _textPos != _bufPos)
286 {
288 }
289 await base.WriteCommentAsync(text).ConfigureAwait(continueOnCapturedContext: false);
290 }
291
292 public override async Task WriteProcessingInstructionAsync(string target, string text)
293 {
295 if (!_mixedContent && _textPos != _bufPos)
296 {
298 }
299 await base.WriteProcessingInstructionAsync(target, text).ConfigureAwait(continueOnCapturedContext: false);
300 }
301
302 public override Task WriteEntityRefAsync(string name)
303 {
305 _mixedContent = true;
306 return base.WriteEntityRefAsync(name);
307 }
308
309 public override Task WriteCharEntityAsync(char ch)
310 {
312 _mixedContent = true;
313 return base.WriteCharEntityAsync(ch);
314 }
315
317 {
319 _mixedContent = true;
320 return base.WriteSurrogateCharEntityAsync(lowChar, highChar);
321 }
322
323 public override Task WriteWhitespaceAsync(string ws)
324 {
326 _mixedContent = true;
327 return base.WriteWhitespaceAsync(ws);
328 }
329
330 public override Task WriteStringAsync(string text)
331 {
333 _mixedContent = true;
334 return base.WriteStringAsync(text);
335 }
336
337 public override Task WriteCharsAsync(char[] buffer, int index, int count)
338 {
340 _mixedContent = true;
341 return base.WriteCharsAsync(buffer, index, count);
342 }
343
344 public override Task WriteRawAsync(char[] buffer, int index, int count)
345 {
347 _mixedContent = true;
348 return base.WriteRawAsync(buffer, index, count);
349 }
350
351 public override Task WriteRawAsync(string data)
352 {
354 _mixedContent = true;
355 return base.WriteRawAsync(data);
356 }
357
358 public override Task WriteBase64Async(byte[] buffer, int index, int count)
359 {
361 _mixedContent = true;
362 return base.WriteBase64Async(buffer, index, count);
363 }
364
374}
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
void PushBit(bool bit)
Definition BitStack.cs:16
override async Task WriteStartAttributeAsync(string prefix, string localName, string ns)
override void OnRootElement(ConformanceLevel currentConformanceLevel)
XmlUtf8RawTextWriterIndent(Stream stream, XmlWriterSettings settings)
override void WriteProcessingInstruction(string target, string text)
override void WriteDocType(string name, string pubid, string sysid, string subset)
override void WriteStartAttribute(string prefix, string localName, string ns)
override void WriteFullEndElement(string prefix, string localName, string ns)
override Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)
override void WriteBase64(byte[] buffer, int index, int count)
override async Task WriteEndElementAsync(string prefix, string localName, string ns)
override void WriteStartElement(string prefix, string localName, string ns)
override void WriteChars(char[] buffer, int index, int count)
override async Task WriteStartElementAsync(string prefix, string localName, string ns)
override async Task WriteProcessingInstructionAsync(string target, string text)
override void WriteRaw(char[] buffer, int index, int count)
override async Task WriteCommentAsync(string text)
override async Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)
override Task WriteRawAsync(char[] buffer, int index, int count)
override async Task WriteFullEndElementAsync(string prefix, string localName, string ns)
override void WriteEndElement(string prefix, string localName, string ns)
override Task WriteCharsAsync(char[] buffer, int index, int count)
override void WriteSurrogateCharEntity(char lowChar, char highChar)
override Task WriteBase64Async(byte[] buffer, int index, int count)
void ValidateContentChars(string chars, string propertyName, bool allowOnlyWhitespace)