Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NumberFormatterBase.cs
Go to the documentation of this file.
1
using
System.Text
;
2
3
namespace
System.Xml.Xsl.Runtime
;
4
5
internal
abstract
class
NumberFormatterBase
6
{
7
private
static
readonly
int
[]
s_romanDigitValue
=
new
int
[13]
8
{
9
1, 4, 5, 9, 10, 40, 50, 90, 100, 400,
10
500, 900, 1000
11
};
12
13
public
static
void
ConvertToAlphabetic
(
StringBuilder
sb,
double
val,
char
firstChar
,
int
totalChars
)
14
{
15
char
[]
array
=
new
char
[7];
16
int
num = 7;
17
int
num2
= (int)val;
18
while
(
num2
>
totalChars
)
19
{
20
int
num3
= --
num2
/
totalChars
;
21
array
[--num] = (char)(
firstChar
+ (
num2
-
num3
*
totalChars
));
22
num2
=
num3
;
23
}
24
array
[--num] = (char)(
firstChar
+ --
num2
);
25
sb.
Append
(
array
, num, 7 - num);
26
}
27
28
public
static
void
ConvertToRoman
(
StringBuilder
sb,
double
val,
bool
upperCase
)
29
{
30
int
num = (int)val;
31
string
value
= (
upperCase
?
"IIVIXXLXCCDCM"
:
"iivixxlxccdcm"
);
32
int
num2
=
s_romanDigitValue
.Length;
33
while
(
num2
-- != 0)
34
{
35
while
(num >=
s_romanDigitValue
[
num2
])
36
{
37
num -=
s_romanDigitValue
[
num2
];
38
sb.
Append
(
value
,
num2
, 1 + (
num2
& 1));
39
}
40
}
41
}
42
}
System.Text.StringBuilder.Append
StringBuilder Append(char value, int repeatCount)
Definition
StringBuilder.cs:744
System.Text.StringBuilder
Definition
StringBuilder.cs:14
System.Xml.Xsl.Runtime.NumberFormatterBase.s_romanDigitValue
static readonly int[] s_romanDigitValue
Definition
NumberFormatterBase.cs:7
System.Xml.Xsl.Runtime.NumberFormatterBase.ConvertToRoman
static void ConvertToRoman(StringBuilder sb, double val, bool upperCase)
Definition
NumberFormatterBase.cs:28
System.Xml.Xsl.Runtime.NumberFormatterBase.ConvertToAlphabetic
static void ConvertToAlphabetic(StringBuilder sb, double val, char firstChar, int totalChars)
Definition
NumberFormatterBase.cs:13
System.Xml.Xsl.Runtime.NumberFormatterBase
Definition
NumberFormatterBase.cs:6
System.Text
Definition
ConsoleEncoding.cs:1
System.Xml.Xsl.Runtime
Definition
AncestorDocOrderIterator.cs:4
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.value
@ value
System.ExceptionArgument.array
@ array
source
System.Private.Xml
System.Xml.Xsl.Runtime
NumberFormatterBase.cs
Generated by
1.10.0