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

◆ WriteTextNode()

override void System.Xml.XmlBinaryWriter.WriteTextNode ( XmlDictionaryReader reader,
bool attribute )
inlineprotectedvirtual

Reimplemented from System.Xml.XmlDictionaryWriter.

Definition at line 33 of file XmlBinaryWriter.cs.

34 {
35 Type valueType = reader.ValueType;
36 if (valueType == typeof(string))
37 {
38 if (reader.TryGetValueAsDictionaryString(out XmlDictionaryString value))
39 {
41 }
42 else if (reader.CanReadValueChunk)
43 {
44 if (_chars == null)
45 {
46 _chars = new char[256];
47 }
48 int count;
49 while ((count = reader.ReadValueChunk(_chars, 0, _chars.Length)) > 0)
50 {
52 }
53 }
54 else
55 {
56 WriteString(reader.Value);
57 }
58 if (!attribute)
59 {
60 reader.Read();
61 }
62 }
63 else if (valueType == typeof(byte[]))
64 {
65 if (reader.CanReadBinaryContent)
66 {
67 if (_bytes == null)
68 {
69 _bytes = new byte[384];
70 }
71 int count2;
72 while ((count2 = reader.ReadValueAsBase64(_bytes, 0, _bytes.Length)) > 0)
73 {
75 }
76 }
77 else
78 {
79 WriteString(reader.Value);
80 }
81 if (!attribute)
82 {
83 reader.Read();
84 }
85 }
86 else if (valueType == typeof(int))
87 {
88 WriteValue(reader.ReadContentAsInt());
89 }
90 else if (valueType == typeof(long))
91 {
92 WriteValue(reader.ReadContentAsLong());
93 }
94 else if (valueType == typeof(bool))
95 {
96 WriteValue(reader.ReadContentAsBoolean());
97 }
98 else if (valueType == typeof(double))
99 {
100 WriteValue(reader.ReadContentAsDouble());
101 }
102 else if (valueType == typeof(DateTime))
103 {
104 WriteValue(reader.ReadContentAsDateTimeOffset().DateTime);
105 }
106 else if (valueType == typeof(float))
107 {
108 WriteValue(reader.ReadContentAsFloat());
109 }
110 else if (valueType == typeof(decimal))
111 {
112 WriteValue(reader.ReadContentAsDecimal());
113 }
114 else if (valueType == typeof(UniqueId))
115 {
116 WriteValue(reader.ReadContentAsUniqueId());
117 }
118 else if (valueType == typeof(Guid))
119 {
120 WriteValue(reader.ReadContentAsGuid());
121 }
122 else if (valueType == typeof(TimeSpan))
123 {
124 WriteValue(reader.ReadContentAsTimeSpan());
125 }
126 else
127 {
128 WriteValue(reader.ReadContentAsObject());
129 }
130 }
override void WriteString(string value)
override void WriteChars(char[] chars, int offset, int count)
override void WriteValue(object value)
override void WriteBase64(byte[] buffer, int offset, int count)

References System.Xml.XmlBinaryWriter._bytes, System.Xml.XmlBinaryWriter._chars, System.Xml.XmlReader.CanReadBinaryContent, System.Xml.XmlReader.CanReadValueChunk, System.count, System.DateTimeOffset.DateTime, System.Xml.Dictionary, System.Xml.XmlReader.Read(), System.Xml.XmlReader.ReadContentAsBoolean(), System.Xml.XmlReader.ReadContentAsDateTimeOffset(), System.Xml.XmlDictionaryReader.ReadContentAsDecimal(), System.Xml.XmlReader.ReadContentAsDouble(), System.Xml.XmlDictionaryReader.ReadContentAsFloat(), System.Xml.XmlDictionaryReader.ReadContentAsGuid(), System.Xml.XmlReader.ReadContentAsInt(), System.Xml.XmlReader.ReadContentAsLong(), System.Xml.XmlReader.ReadContentAsObject(), System.Xml.XmlDictionaryReader.ReadContentAsTimeSpan(), System.Xml.XmlDictionaryReader.ReadContentAsUniqueId(), System.Xml.XmlDictionaryReader.ReadValueAsBase64(), System.Xml.XmlReader.ReadValueChunk(), System.Xml.XmlDictionaryReader.TryGetValueAsDictionaryString(), System.value, System.Xml.XmlReader.Value, System.Xml.XmlReader.ValueType, System.Xml.XmlBaseWriter.WriteBase64(), System.Xml.XmlBaseWriter.WriteChars(), System.Xml.XmlBaseWriter.WriteString(), and System.Xml.XmlBaseWriter.WriteValue().