Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DecoderExceptionFallbackBuffer.cs
Go to the documentation of this file.
1
using
System.Diagnostics.CodeAnalysis
;
2
3
namespace
System.Text
;
4
5
public
sealed
class
DecoderExceptionFallbackBuffer
:
DecoderFallbackBuffer
6
{
7
public
override
int
Remaining
=> 0;
8
9
public
override
bool
Fallback
(
byte
[] bytesUnknown,
int
index
)
10
{
11
Throw
(bytesUnknown,
index
);
12
return
true
;
13
}
14
15
public
override
char
GetNextChar
()
16
{
17
return
'\0'
;
18
}
19
20
public
override
bool
MovePrevious
()
21
{
22
return
false
;
23
}
24
25
[DoesNotReturn]
26
private
static
void
Throw
(
byte
[] bytesUnknown,
int
index
)
27
{
28
if
(bytesUnknown ==
null
)
29
{
30
bytesUnknown =
Array
.Empty<
byte
>();
31
}
32
StringBuilder
stringBuilder =
new
StringBuilder
(bytesUnknown.Length * 4);
33
for
(
int
i = 0; i < bytesUnknown.Length && i < 20; i++)
34
{
35
StringBuilder
stringBuilder2 = stringBuilder;
36
StringBuilder.AppendInterpolatedStringHandler
handler =
new
StringBuilder
.
AppendInterpolatedStringHandler
(2, 1, stringBuilder2);
37
handler.
AppendLiteral
(
"["
);
38
handler.
AppendFormatted
(bytesUnknown[i],
"X2"
);
39
handler.
AppendLiteral
(
"]"
);
40
stringBuilder2.
Append
(ref handler);
41
}
42
if
(bytesUnknown.Length > 20)
43
{
44
stringBuilder.
Append
(
" ..."
);
45
}
46
throw
new
DecoderFallbackException
(
SR
.
Format
(
SR
.
Argument_InvalidCodePageBytesIndex
, stringBuilder,
index
), bytesUnknown,
index
);
47
}
48
}
System.Array
Definition
Array.cs:16
System.SR.Format
static string Format(string resourceFormat, object p1)
Definition
SR.cs:118
System.SR.Argument_InvalidCodePageBytesIndex
static string Argument_InvalidCodePageBytesIndex
Definition
SR.cs:652
System.SR
Definition
SR.cs:7
System.Text.DecoderExceptionFallbackBuffer.Fallback
override bool Fallback(byte[] bytesUnknown, int index)
Definition
DecoderExceptionFallbackBuffer.cs:9
System.Text.DecoderExceptionFallbackBuffer.MovePrevious
override bool MovePrevious()
Definition
DecoderExceptionFallbackBuffer.cs:20
System.Text.DecoderExceptionFallbackBuffer.Throw
static void Throw(byte[] bytesUnknown, int index)
Definition
DecoderExceptionFallbackBuffer.cs:26
System.Text.DecoderExceptionFallbackBuffer.Remaining
override int Remaining
Definition
DecoderExceptionFallbackBuffer.cs:7
System.Text.DecoderExceptionFallbackBuffer.GetNextChar
override char GetNextChar()
Definition
DecoderExceptionFallbackBuffer.cs:15
System.Text.DecoderExceptionFallbackBuffer
Definition
DecoderExceptionFallbackBuffer.cs:6
System.Text.DecoderFallbackBuffer
Definition
DecoderFallbackBuffer.cs:6
System.Text.DecoderFallbackException
Definition
DecoderFallbackException.cs:9
System.Text.StringBuilder.Append
StringBuilder Append(char value, int repeatCount)
Definition
StringBuilder.cs:744
System.Text.StringBuilder
Definition
StringBuilder.cs:14
System.Diagnostics.CodeAnalysis
Definition
AllowNullAttribute.cs:1
System.Text
Definition
ConsoleEncoding.cs:1
System.ExceptionArgument.index
@ index
System.Text.StringBuilder.AppendInterpolatedStringHandler.AppendLiteral
void AppendLiteral(string value)
Definition
StringBuilder.cs:137
System.Text.StringBuilder.AppendInterpolatedStringHandler.AppendFormatted
void AppendFormatted(ReadOnlySpan< char > value)
Definition
StringBuilder.cs:249
System.Text.StringBuilder.AppendInterpolatedStringHandler
Definition
StringBuilder.cs:116
source
System.Private.CoreLib
System.Text
DecoderExceptionFallbackBuffer.cs
Generated by
1.10.0