Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SurrogateChar.cs
Go to the documentation of this file.
1
using
System.Globalization
;
2
using
System.Runtime.Serialization
;
3
4
namespace
System.Text
;
5
6
internal
struct
SurrogateChar
7
{
8
private
readonly
char
_lowChar
;
9
10
private
readonly
char
_highChar
;
11
12
public
const
int
MinValue
= 65536;
13
14
public
const
int
MaxValue
= 1114111;
15
16
private
const
char
surHighMin
=
'\ud800'
;
17
18
private
const
char
surHighMax
=
'\udbff'
;
19
20
private
const
char
surLowMin
=
'\udc00'
;
21
22
private
const
char
surLowMax
=
'\udfff'
;
23
24
public
char
LowChar
=>
_lowChar
;
25
26
public
char
HighChar
=>
_highChar
;
27
28
public
int
Char
=> (
_lowChar
- 56320) | ((
_highChar
- 55296 << 10) + 65536);
29
30
public
SurrogateChar
(
int
ch
)
31
{
32
if
(
ch < 65536 || ch >
1114111)
33
{
34
throw
DiagnosticUtility
.
ExceptionUtility
.
ThrowHelperError
(
new
ArgumentException
(
System
.
SR
.
Format
(
System
.
SR
.
XmlInvalidSurrogate
,
ch
.ToString(
"X"
,
CultureInfo
.
InvariantCulture
)),
"ch"
));
35
}
36
_lowChar
= (char)(((
ch
- 65536) & 0
x3FF
) + 56320);
37
_highChar
= (char)(((
ch
- 65536 >> 10) & 0x3FF) + 55296);
38
}
39
40
public
SurrogateChar
(
char
lowChar
,
char
highChar
)
41
{
42
if
(
lowChar
<
'\udc00'
||
lowChar
>
'\udfff'
)
43
{
44
string
xmlInvalidLowSurrogate
=
System
.
SR
.
XmlInvalidLowSurrogate
;
45
int
num =
lowChar
;
46
throw
DiagnosticUtility
.
ExceptionUtility
.
ThrowHelperError
(
new
ArgumentException
(
System
.
SR
.
Format
(
xmlInvalidLowSurrogate
, num.ToString(
"X"
,
CultureInfo
.
InvariantCulture
)),
"lowChar"
));
47
}
48
if
(
highChar
<
'\ud800'
||
highChar
>
'\udbff'
)
49
{
50
string
xmlInvalidHighSurrogate
=
System
.
SR
.
XmlInvalidHighSurrogate
;
51
int
num =
highChar
;
52
throw
DiagnosticUtility
.
ExceptionUtility
.
ThrowHelperError
(
new
ArgumentException
(
System
.
SR
.
Format
(
xmlInvalidHighSurrogate
, num.ToString(
"X"
,
CultureInfo
.
InvariantCulture
)),
"highChar"
));
53
}
54
_lowChar
=
lowChar
;
55
_highChar
=
highChar
;
56
}
57
}
System.ArgumentException
Definition
ArgumentException.cs:9
System.Globalization.CultureInfo.InvariantCulture
static CultureInfo InvariantCulture
Definition
CultureInfo.cs:144
System.Globalization.CultureInfo
Definition
CultureInfo.cs:8
System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError
static Exception ThrowHelperError(Exception e)
Definition
DiagnosticUtility.cs:15
System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility
Definition
DiagnosticUtility.cs:9
System.Runtime.Serialization.DiagnosticUtility
Definition
DiagnosticUtility.cs:7
System.SR.XmlInvalidHighSurrogate
static string XmlInvalidHighSurrogate
Definition
SR.cs:340
System.SR.Format
static string Format(string resourceFormat, object p1)
Definition
SR.cs:118
System.SR.XmlInvalidSurrogate
static string XmlInvalidSurrogate
Definition
SR.cs:344
System.SR.XmlInvalidLowSurrogate
static string XmlInvalidLowSurrogate
Definition
SR.cs:342
System.SR
Definition
SR.cs:7
System.Globalization
Definition
Calendar.cs:1
System.Runtime.Serialization.CollectionKind.Dictionary
@ Dictionary
System.Runtime.Serialization
Definition
SerializationGuard.cs:3
System.Text
Definition
ConsoleEncoding.cs:1
System.ExceptionArgument.ch
@ ch
System
Definition
BlockingCollection.cs:8
System.Char
Definition
Char.cs:14
System.Text.SurrogateChar._highChar
readonly char _highChar
Definition
SurrogateChar.cs:10
System.Text.SurrogateChar.surHighMin
const char surHighMin
Definition
SurrogateChar.cs:16
System.Text.SurrogateChar.HighChar
char HighChar
Definition
SurrogateChar.cs:26
System.Text.SurrogateChar.LowChar
char LowChar
Definition
SurrogateChar.cs:24
System.Text.SurrogateChar._lowChar
readonly char _lowChar
Definition
SurrogateChar.cs:8
System.Text.SurrogateChar.SurrogateChar
SurrogateChar(int ch)
Definition
SurrogateChar.cs:30
System.Text.SurrogateChar.surHighMax
const char surHighMax
Definition
SurrogateChar.cs:18
System.Text.SurrogateChar.surLowMin
const char surLowMin
Definition
SurrogateChar.cs:20
System.Text.SurrogateChar.surLowMax
const char surLowMax
Definition
SurrogateChar.cs:22
System.Text.SurrogateChar.SurrogateChar
SurrogateChar(char lowChar, char highChar)
Definition
SurrogateChar.cs:40
System.Text.SurrogateChar.MinValue
const int MinValue
Definition
SurrogateChar.cs:12
System.Text.SurrogateChar.MaxValue
const int MaxValue
Definition
SurrogateChar.cs:14
System.Text.SurrogateChar
Definition
SurrogateChar.cs:7
source
System.Private.DataContractSerialization
System.Text
SurrogateChar.cs
Generated by
1.10.0