Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BuilderInfo.cs
Go to the documentation of this file.
2using System.Text;
3
5
6internal sealed class BuilderInfo
7{
8 private string _name;
9
10 private string _localName;
11
12 private string _namespaceURI;
13
14 private string _prefix;
15
17
18 private int _depth;
19
20 private bool _isEmptyTag;
21
22 internal string[] TextInfo = new string[4];
23
24 internal int TextInfoCount;
25
26 internal bool search;
27
29
31
32 internal string Name
33 {
34 get
35 {
36 if (_name == null)
37 {
38 string prefix = Prefix;
39 string localName = LocalName;
40 if (prefix != null && 0 < prefix.Length)
41 {
42 if (localName.Length > 0)
43 {
44 _name = prefix + ":" + localName;
45 }
46 else
47 {
48 _name = prefix;
49 }
50 }
51 else
52 {
53 _name = localName;
54 }
55 }
56 return _name;
57 }
58 }
59
60 internal string LocalName
61 {
62 get
63 {
64 return _localName;
65 }
66 set
67 {
69 }
70 }
71
72 internal string NamespaceURI
73 {
74 get
75 {
76 return _namespaceURI;
77 }
78 set
79 {
81 }
82 }
83
84 internal string Prefix
85 {
86 get
87 {
88 return _prefix;
89 }
90 set
91 {
92 _prefix = value;
93 }
94 }
95
96 internal string Value
97 {
98 get
99 {
100 switch (TextInfoCount)
101 {
102 case 0:
103 return string.Empty;
104 case 1:
105 return TextInfo[0];
106 default:
107 {
108 int num = 0;
109 for (int i = 0; i < TextInfoCount; i++)
110 {
111 string text = TextInfo[i];
112 if (text != null)
113 {
114 num += text.Length;
115 }
116 }
118 for (int j = 0; j < TextInfoCount; j++)
119 {
120 string text2 = TextInfo[j];
121 if (text2 != null)
122 {
123 stringBuilder.Append(text2);
124 }
125 }
126 return stringBuilder.ToString();
127 }
128 }
129 }
130 set
131 {
132 TextInfoCount = 0;
134 }
135 }
136
138 {
139 get
140 {
141 return _nodeType;
142 }
143 set
144 {
146 }
147 }
148
149 internal int Depth
150 {
151 get
152 {
153 return _depth;
154 }
155 set
156 {
157 _depth = value;
158 }
159 }
160
161 internal bool IsEmptyTag
162 {
163 get
164 {
165 return _isEmptyTag;
166 }
167 set
168 {
170 }
171 }
172
173 internal BuilderInfo()
174 {
175 Initialize(string.Empty, string.Empty, string.Empty);
176 }
177
178 [MemberNotNull("_prefix")]
179 [MemberNotNull("_localName")]
180 [MemberNotNull("_namespaceURI")]
181 internal void Initialize(string prefix, string name, string nspace)
182 {
183 _prefix = prefix;
184 _localName = name;
186 _name = null;
187 htmlProps = null;
188 htmlAttrProps = null;
189 TextInfoCount = 0;
190 }
191
192 [MemberNotNull("_prefix")]
193 [MemberNotNull("_localName")]
194 [MemberNotNull("_namespaceURI")]
196 {
197 _prefix = src.Prefix;
198 _localName = src.LocalName;
199 _namespaceURI = src.NamespaceURI;
200 _name = null;
201 _depth = src.Depth;
202 _nodeType = src.NodeType;
203 htmlProps = src.htmlProps;
204 htmlAttrProps = src.htmlAttrProps;
205 TextInfoCount = 0;
206 EnsureTextInfoSize(src.TextInfoCount);
207 src.TextInfo.CopyTo(TextInfo, 0);
208 TextInfoCount = src.TextInfoCount;
209 }
210
211 private void EnsureTextInfoSize(int newSize)
212 {
213 if (TextInfo.Length < newSize)
214 {
215 string[] array = new string[newSize * 2];
217 TextInfo = array;
218 }
219 }
220
222 {
224 builderInfo.Initialize(this);
225 return builderInfo;
226 }
227
228 internal void ValueAppend(string s, bool disableEscaping)
229 {
230 if (s != null && s.Length != 0)
231 {
233 if (disableEscaping)
234 {
235 TextInfo[TextInfoCount++] = null;
236 }
238 }
239 }
240}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
void ValueAppend(string s, bool disableEscaping)
void Initialize(string prefix, string name, string nspace)
void Initialize(BuilderInfo src)