Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EUCJPEncoding.cs
Go to the documentation of this file.
1
namespace
System.Text
;
2
3
internal
sealed
class
EUCJPEncoding
:
DBCSCodePageEncoding
4
{
5
public
EUCJPEncoding
()
6
: base(51932, 932)
7
{
8
}
9
10
protected
override
bool
CleanUpBytes
(ref
int
bytes
)
11
{
12
if
(
bytes
>= 256)
13
{
14
if
(
bytes
>= 64064 &&
bytes
<= 64587)
15
{
16
if
(
bytes
>= 64064 &&
bytes
<= 64091)
17
{
18
if
(
bytes
<= 64073)
19
{
20
bytes
-= 2897;
21
}
22
else
if
(
bytes
>= 64074 &&
bytes
<= 64083)
23
{
24
bytes
-= 29430;
25
}
26
else
if
(
bytes
>= 64084 &&
bytes
<= 64087)
27
{
28
bytes
-= 2907;
29
}
30
else
if
(
bytes
== 64088)
31
{
32
bytes
= 34698;
33
}
34
else
if
(
bytes
== 64089)
35
{
36
bytes
= 34690;
37
}
38
else
if
(
bytes
== 64090)
39
{
40
bytes
= 34692;
41
}
42
else
if
(
bytes
== 64091)
43
{
44
bytes
= 34714;
45
}
46
}
47
else
if
(
bytes
>= 64092 &&
bytes
<= 64587)
48
{
49
byte
b = (byte)
bytes
;
50
if
(b < 92)
51
{
52
bytes
-= 3423;
53
}
54
else
if
(b >= 128 && b <= 155)
55
{
56
bytes
-= 3357;
57
}
58
else
59
{
60
bytes
-= 3356;
61
}
62
}
63
}
64
byte
b2 = (byte)(
bytes
>> 8);
65
byte
b3 = (byte)
bytes
;
66
b2 = (byte)(b2 - ((b2 > 159) ? 177 : 113));
67
b2 = (byte)((b2 << 1) + 1);
68
if
(b3 > 158)
69
{
70
b3 -= 126;
71
b2++;
72
}
73
else
74
{
75
if
(b3 > 126)
76
{
77
b3--;
78
}
79
b3 -= 31;
80
}
81
bytes
= (b2 << 8) | b3 | 0x8080;
82
if
((
bytes
& 0xFF00) < 41216 || (
bytes
& 0xFF00) > 65024 || (
bytes
& 0xFF) < 161 || (
bytes
& 0xFF) > 254)
83
{
84
return
false
;
85
}
86
}
87
else
88
{
89
if
(
bytes
>= 161 &&
bytes
<= 223)
90
{
91
bytes
|= 36352;
92
return
true
;
93
}
94
if
(
bytes
>= 129 &&
bytes
!= 160 &&
bytes
!= 255)
95
{
96
return
false
;
97
}
98
}
99
return
true
;
100
}
101
102
protected
unsafe
override
void
CleanUpEndBytes
(
char
*
chars
)
103
{
104
for
(
int
i = 161; i <= 254; i++)
105
{
106
chars
[i] =
'\ufffe'
;
107
}
108
chars
[142] =
'\ufffe'
;
109
}
110
}
System.Text.DBCSCodePageEncoding
Definition
DBCSCodePageEncoding.cs:9
System.Text.EUCJPEncoding.CleanUpEndBytes
unsafe override void CleanUpEndBytes(char *chars)
Definition
EUCJPEncoding.cs:102
System.Text.EUCJPEncoding.EUCJPEncoding
EUCJPEncoding()
Definition
EUCJPEncoding.cs:5
System.Text.EUCJPEncoding.CleanUpBytes
override bool CleanUpBytes(ref int bytes)
Definition
EUCJPEncoding.cs:10
System.Text.EUCJPEncoding
Definition
EUCJPEncoding.cs:4
System.Text
Definition
ConsoleEncoding.cs:1
System.ExceptionArgument.bytes
@ bytes
System.ExceptionArgument.chars
@ chars
source
System.Text.Encoding.CodePages
System.Text
EUCJPEncoding.cs
Generated by
1.10.0