Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
XmlBoundElement.cs
Go to the documentation of this file.
1using System.Data;
4
5namespace System.Xml;
6
7internal sealed class XmlBoundElement : XmlElement
8{
9 private DataRow _row;
10
12
14 {
15 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
16 get
17 {
19 return base.Attributes;
20 }
21 }
22
23 public override bool HasAttributes => Attributes.Count > 0;
24
25 public override XmlNode FirstChild
26 {
27 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
28 get
29 {
31 return base.FirstChild;
32 }
33 }
34
36
37 public override XmlNode LastChild
38 {
39 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
40 get
41 {
43 return base.LastChild;
44 }
45 }
46
47 public override XmlNode PreviousSibling
48 {
49 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
50 get
51 {
54 {
55 xmlBoundElement.AutoFoliate();
56 return base.PreviousSibling;
57 }
58 return previousSibling;
59 }
60 }
61
63
64 public override XmlNode NextSibling
65 {
66 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
67 get
68 {
71 {
72 xmlBoundElement.AutoFoliate();
73 return base.NextSibling;
74 }
75 return nextSibling;
76 }
77 }
78
80
81 public override bool HasChildNodes
82 {
83 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
84 get
85 {
87 return base.HasChildNodes;
88 }
89 }
90
91 public override string InnerXml
92 {
93 get
94 {
95 return base.InnerXml;
96 }
97 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
98 set
99 {
102 bool ignoreXmlEvents = xmlDataDocument.IgnoreXmlEvents;
103 bool ignoreDataSetEvents = xmlDataDocument.IgnoreDataSetEvents;
107 xmlDataDocument.SyncTree(this);
110 }
111 }
112
113 internal DataRow Row
114 {
115 get
116 {
117 return _row;
118 }
119 set
120 {
121 _row = value;
122 }
123 }
124
125 internal bool IsFoliated
126 {
127 get
128 {
129 while (_state == ElementState.Foliating || _state == ElementState.Defoliating)
130 {
131 Thread.Sleep(0);
132 }
133 return _state != ElementState.Defoliated;
134 }
135 }
136
138 {
139 get
140 {
141 return _state;
142 }
143 set
144 {
145 _state = value;
146 }
147 }
148
149 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
150 internal XmlBoundElement(string prefix, string localName, string namespaceURI, XmlDocument doc)
151 : base(prefix, localName, namespaceURI, doc)
152 {
153 _state = ElementState.None;
154 }
155
156 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
158 {
159 AutoFoliate();
160 return base.InsertBefore(newChild, refChild);
161 }
162
163 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
165 {
166 AutoFoliate();
167 return base.InsertAfter(newChild, refChild);
168 }
169
170 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
172 {
173 AutoFoliate();
174 return base.ReplaceChild(newChild, oldChild);
175 }
176
177 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
179 {
180 AutoFoliate();
181 return base.AppendChild(newChild);
182 }
183
184 internal void RemoveAllChildren()
185 {
187 XmlNode xmlNode2 = null;
188 while (xmlNode != null)
189 {
193 }
194 }
195
196 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
198 {
199 ((XmlDataDocument)OwnerDocument)?.Foliate(this, newState);
200 }
201
202 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
203 private void AutoFoliate()
204 {
206 xmlDataDocument?.Foliate(this, xmlDataDocument.AutoFoliationState);
207 }
208
209 public override XmlNode CloneNode(bool deep)
210 {
214 try
215 {
216 Foliate(ElementState.WeakFoliation);
217 return (XmlElement)base.CloneNode(deep);
218 }
219 finally
220 {
222 }
223 }
224
225 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
226 public override void WriteContentTo(XmlWriter w)
227 {
229 try
230 {
231 dataPointer.AddPointer();
233 }
234 finally
235 {
236 dataPointer.SetNoLongerUse();
237 }
238 }
239
240 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This whole class is unsafe. Constructors are marked as such.")]
241 public override void WriteTo(XmlWriter w)
242 {
244 try
245 {
246 dataPointer.AddPointer();
248 }
249 finally
250 {
251 dataPointer.SetNoLongerUse();
252 }
253 }
254
255 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
257 {
259 w.WriteStartElement(dp.Prefix, dp.LocalName, dp.NamespaceURI);
260 int attributeCount = dp.AttributeCount;
261 bool flag = false;
262 if (attributeCount > 0)
263 {
264 for (int i = 0; i < attributeCount; i++)
265 {
266 dp.MoveToAttribute(i);
267 if (dp.Prefix == "xmlns" && dp.LocalName == "xsi")
268 {
269 flag = true;
270 }
271 WriteTo(dp, w);
272 dp.MoveToOwnerElement();
273 }
274 }
275 if (!flag && xmlDataDocument._bLoadFromDataSet && xmlDataDocument._bHasXSINIL)
276 {
277 w.WriteAttributeString("xmlns", "xsi", "http://www.w3.org/2000/xmlns/", "http://www.w3.org/2001/XMLSchema-instance");
278 }
280 if (dp.IsEmptyElement)
281 {
282 w.WriteEndElement();
283 }
284 else
285 {
286 w.WriteFullEndElement();
287 }
288 }
289
290 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
292 {
293 w.WriteStartElement(dp.Prefix, dp.LocalName, dp.NamespaceURI);
294 int attributeCount = dp.AttributeCount;
295 if (attributeCount > 0)
296 {
297 for (int i = 0; i < attributeCount; i++)
298 {
299 dp.MoveToAttribute(i);
300 WriteTo(dp, w);
301 dp.MoveToOwnerElement();
302 }
303 }
305 if (dp.IsEmptyElement)
306 {
307 w.WriteEndElement();
308 }
309 else
310 {
311 w.WriteFullEndElement();
312 }
313 }
314
315 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
317 {
318 if (!dp.IsEmptyElement && dp.MoveToFirstChild())
319 {
320 do
321 {
322 WriteTo(dp, w);
323 }
324 while (dp.MoveToNextSibling());
325 dp.MoveToParent();
326 }
327 }
328
329 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
330 private static void WriteTo(DataPointer dp, XmlWriter w)
331 {
332 switch (dp.NodeType)
333 {
334 case XmlNodeType.Attribute:
335 if (dp.IsDefault)
336 {
337 break;
338 }
339 w.WriteStartAttribute(dp.Prefix, dp.LocalName, dp.NamespaceURI);
340 if (dp.MoveToFirstChild())
341 {
342 do
343 {
344 WriteTo(dp, w);
345 }
346 while (dp.MoveToNextSibling());
347 dp.MoveToParent();
348 }
349 w.WriteEndAttribute();
350 break;
351 case XmlNodeType.Element:
353 break;
354 case XmlNodeType.Text:
355 w.WriteString(dp.Value);
356 break;
357 default:
358 if (dp.GetNode() != null)
359 {
360 dp.GetNode().WriteTo(w);
361 }
362 break;
363 }
364 }
365
366 public override XmlNodeList GetElementsByTagName(string name)
367 {
368 XmlNodeList elementsByTagName = base.GetElementsByTagName(name);
370 return elementsByTagName;
371 }
372}
static void Sleep(int millisecondsTimeout)
Definition Thread.cs:658
override XmlNode PreviousSibling
void WriteRootBoundElementTo(DataPointer dp, XmlWriter w)
override XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild)
static void WriteBoundElementTo(DataPointer dp, XmlWriter w)
override XmlNode CloneNode(bool deep)
override void WriteTo(XmlWriter w)
override XmlAttributeCollection Attributes
override XmlNodeList GetElementsByTagName(string name)
override XmlNode AppendChild(XmlNode newChild)
override void WriteContentTo(XmlWriter w)
static void WriteBoundElementContentTo(DataPointer dp, XmlWriter w)
XmlBoundElement(string prefix, string localName, string namespaceURI, XmlDocument doc)
override XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
static void WriteTo(DataPointer dp, XmlWriter w)
override XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
void Foliate(ElementState newState)
override? XmlNode ParentNode
Definition XmlElement.cs:47
override XmlDocument OwnerDocument
Definition XmlElement.cs:49
virtual ? XmlNode PreviousSibling
Definition XmlNode.cs:102
virtual ? XmlNode NextSibling
Definition XmlNode.cs:104
virtual XmlNode RemoveChild(XmlNode oldChild)
Definition XmlNode.cs:662
virtual ? XmlNode FirstChild
Definition XmlNode.cs:120