Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XStreamingElement.cs
Go to the documentation of this file.
3using System.IO;
4
5namespace System.Xml.Linq;
6
7public class XStreamingElement
8{
9 internal XName name;
10
11 internal object content;
12
13 public XName Name
14 {
15 get
16 {
17 return name;
18 }
19 set
20 {
21 if (value == null)
22 {
23 throw new ArgumentNullException("value");
24 }
25 name = value;
26 }
27 }
28
30 {
31 if (name == null)
32 {
33 throw new ArgumentNullException("name");
34 }
36 }
37
39 : this(name)
40 {
41 this.content = ((!(content is List<object>)) ? content : new object[1] { content });
42 }
43
45 : this(name)
46 {
48 }
49
50 public void Add(object? content)
51 {
52 if (content == null)
53 {
54 return;
55 }
57 if (list == null)
58 {
59 list = new List<object>();
60 if (this.content != null)
61 {
62 list.Add(this.content);
63 }
65 }
66 list.Add(content);
67 }
68
69 public void Add(params object?[] content)
70 {
71 Add((object?)content);
72 }
73
74 public void Save(Stream stream)
75 {
76 Save(stream, SaveOptions.None);
77 }
78
85
87 {
89 }
90
97
98 public void Save(XmlWriter writer)
99 {
100 if (writer == null)
101 {
102 throw new ArgumentNullException("writer");
103 }
104 writer.WriteStartDocument();
106 writer.WriteEndDocument();
107 }
108
109 public void Save(string fileName)
110 {
112 }
113
120
121 public override string ToString()
122 {
123 return GetXmlString(SaveOptions.None);
124 }
125
127 {
128 return GetXmlString(options);
129 }
130
132 {
133 if (writer == null)
134 {
135 throw new ArgumentNullException("writer");
136 }
138 }
139
140 private string GetXmlString(SaveOptions o)
141 {
145 if ((o & SaveOptions.DisableFormatting) == 0)
146 {
148 }
149 if ((o & SaveOptions.OmitDuplicateNamespaces) != 0)
150 {
152 }
154 {
156 }
157 return stringWriter.ToString();
158 }
159}
static CultureInfo InvariantCulture
static XmlWriterSettings GetXmlWriterSettings(SaveOptions o)
Definition XNode.cs:512
XStreamingElement(XName name, object? content)
void Add(params object?[] content)
void Save(string fileName, SaveOptions options)
void Save(Stream stream, SaveOptions options)
void Save(TextWriter textWriter)
void Save(TextWriter textWriter, SaveOptions options)
string ToString(SaveOptions options)
XStreamingElement(XName name, params object?[] content)
static XmlWriter Create(string outputFileName)
Definition XmlWriter.cs:468