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

◆ FormatSequence()

string System.Xml.Xsl.Runtime.NumberFormatter.FormatSequence ( IList< XPathItem > val)
inline

Definition at line 61 of file NumberFormatter.cs.

62 {
64 if (val.Count == 1 && val[0].ValueType == typeof(double))
65 {
66 double valueAsDouble = val[0].ValueAsDouble;
67 if (!(0.5 <= valueAsDouble) || !(valueAsDouble < double.PositiveInfinity))
68 {
69 return XPathConvert.DoubleToString(valueAsDouble);
70 }
71 }
72 if (_tokens == null)
73 {
74 for (int i = 0; i < val.Count; i++)
75 {
76 if (i > 0)
77 {
78 stringBuilder.Append('.');
79 }
80 FormatItem(stringBuilder, val[i], '1', 1);
81 }
82 }
83 else
84 {
85 int num = _tokens.Count;
86 TokenInfo tokenInfo = _tokens[0];
87 TokenInfo tokenInfo2 = ((num % 2 != 0) ? _tokens[--num] : null);
88 TokenInfo tokenInfo3 = ((2 < num) ? _tokens[num - 2] : s_defaultSeparator);
89 TokenInfo tokenInfo4 = ((0 < num) ? _tokens[num - 1] : s_defaultFormat);
90 if (tokenInfo != null)
91 {
92 stringBuilder.Append(tokenInfo.formatString, tokenInfo.startIdx, tokenInfo.length);
93 }
94 int count = val.Count;
95 for (int j = 0; j < count; j++)
96 {
97 int num2 = j * 2;
98 bool flag = num2 < num;
99 if (j > 0)
100 {
101 TokenInfo tokenInfo5 = (flag ? _tokens[num2] : tokenInfo3);
102 stringBuilder.Append(tokenInfo5.formatString, tokenInfo5.startIdx, tokenInfo5.length);
103 }
104 TokenInfo tokenInfo6 = (flag ? _tokens[num2 + 1] : tokenInfo4);
105 FormatItem(stringBuilder, val[j], tokenInfo6.startChar, tokenInfo6.length);
106 }
107 if (tokenInfo2 != null)
108 {
109 stringBuilder.Append(tokenInfo2.formatString, tokenInfo2.startIdx, tokenInfo2.length);
110 }
111 }
112 return stringBuilder.ToString();
113 }
void FormatItem(StringBuilder sb, XPathItem item, char startChar, int length)
static readonly TokenInfo s_defaultSeparator
readonly List< TokenInfo > _tokens
static readonly TokenInfo s_defaultFormat

References System.Xml.Xsl.Runtime.NumberFormatter._tokens, System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Xsl.XPathConvert.DoubleToString(), System.Xml.Xsl.Runtime.NumberFormatter.FormatItem(), System.Xml.Xsl.Runtime.NumberFormatter.s_defaultFormat, and System.Xml.Xsl.Runtime.NumberFormatter.s_defaultSeparator.