Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
StringConcat.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
using
System.ComponentModel
;
3
4
namespace
System.Xml.Xsl.Runtime
;
5
6
[
EditorBrowsable
(
EditorBrowsableState
.Never)]
7
public
struct
StringConcat
8
{
9
private
string
_s1
;
10
11
private
string
_s2
;
12
13
private
string
_s3
;
14
15
private
string
_s4
;
16
17
private
string
_delimiter
;
18
19
private
List<string>
_strList
;
20
21
private
int
_idxStr
;
22
23
public
string
?
Delimiter
24
{
25
get
26
{
27
return
_delimiter
;
28
}
29
set
30
{
31
_delimiter
=
value
;
32
}
33
}
34
35
internal
int
Count
=>
_idxStr
;
36
37
public
void
Clear
()
38
{
39
_idxStr
= 0;
40
_delimiter
=
null
;
41
}
42
43
public
void
Concat
(
string
value
)
44
{
45
if
(
_delimiter
!=
null
&&
_idxStr
!= 0)
46
{
47
ConcatNoDelimiter
(
_delimiter
);
48
}
49
ConcatNoDelimiter
(
value
);
50
}
51
52
public
string
GetResult
()
53
{
54
return
_idxStr
switch
55
{
56
0 =>
string
.Empty,
57
1 =>
_s1
??
string
.Empty,
58
2 =>
_s1
+
_s2
,
59
3 =>
_s1
+
_s2
+
_s3
,
60
4 =>
_s1
+
_s2
+
_s3
+
_s4
,
61
_
=>
string
.Concat(
_strList
.
ToArray
()),
62
};
63
}
64
65
internal
void
ConcatNoDelimiter
(
string
s
)
66
{
67
switch
(
_idxStr
)
68
{
69
case
0:
70
_s1
=
s
;
71
break
;
72
case
1:
73
_s2
=
s
;
74
break
;
75
case
2:
76
_s3
=
s
;
77
break
;
78
case
3:
79
_s4
=
s
;
80
break
;
81
case
4:
82
{
83
int
capacity
= ((
_strList
==
null
) ? 8 :
_strList
.
Count
);
84
List<string>
list
= (
_strList
=
new
List<string>
(
capacity
));
85
list
.
Add
(
_s1
);
86
list
.
Add
(
_s2
);
87
list
.
Add
(
_s3
);
88
list
.
Add
(
_s4
);
89
goto
default
;
90
}
91
default
:
92
_strList
.
Add
(
s
);
93
break
;
94
}
95
_idxStr
++;
96
}
97
}
System.Collections.Generic.Dictionary.Add
void Add(TKey key, TValue value)
Definition
Dictionary.cs:873
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Collections.Generic.List.ToArray
T[] ToArray()
Definition
List.cs:941
System.Collections.Generic.List.Count
int Count
Definition
List.cs:123
System.Collections.Generic.List.Add
void Add(T item)
Definition
List.cs:236
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.ComponentModel.EditorBrowsableState
EditorBrowsableState
Definition
EditorBrowsableState.cs:4
System.ComponentModel
Definition
ColumnAttribute.cs:3
System.Xml.Xsl.Runtime
Definition
AncestorDocOrderIterator.cs:4
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.s
@ s
System.ExceptionArgument.list
@ list
System.ExceptionArgument.value
@ value
System.ExceptionArgument.capacity
@ capacity
System.Xml.Xsl.Runtime.StringConcat._s2
string _s2
Definition
StringConcat.cs:11
System.Xml.Xsl.Runtime.StringConcat._idxStr
int _idxStr
Definition
StringConcat.cs:21
System.Xml.Xsl.Runtime.StringConcat.Clear
void Clear()
Definition
StringConcat.cs:37
System.Xml.Xsl.Runtime.StringConcat._s3
string _s3
Definition
StringConcat.cs:13
System.Xml.Xsl.Runtime.StringConcat._delimiter
string _delimiter
Definition
StringConcat.cs:17
System.Xml.Xsl.Runtime.StringConcat.Delimiter
string? Delimiter
Definition
StringConcat.cs:24
System.Xml.Xsl.Runtime.StringConcat.Concat
void Concat(string value)
Definition
StringConcat.cs:43
System.Xml.Xsl.Runtime.StringConcat._strList
List< string > _strList
Definition
StringConcat.cs:19
System.Xml.Xsl.Runtime.StringConcat._s4
string _s4
Definition
StringConcat.cs:15
System.Xml.Xsl.Runtime.StringConcat.ConcatNoDelimiter
void ConcatNoDelimiter(string s)
Definition
StringConcat.cs:65
System.Xml.Xsl.Runtime.StringConcat.Count
int Count
Definition
StringConcat.cs:35
System.Xml.Xsl.Runtime.StringConcat._s1
string _s1
Definition
StringConcat.cs:9
System.Xml.Xsl.Runtime.StringConcat.GetResult
string GetResult()
Definition
StringConcat.cs:52
System.Xml.Xsl.Runtime.StringConcat
Definition
StringConcat.cs:8
source
System.Private.Xml
System.Xml.Xsl.Runtime
StringConcat.cs
Generated by
1.10.0